# emit constructor code
$temp = <<EOF;
- ir_node *res;
- ir_op *op = op_${arch}_${op};
- int flags = 0;
- backend_info_t *info;
+ ir_node *res;
+ ir_op *op = op_${arch}_${op};
+ arch_irn_flags_t flags = arch_irn_flags_none;
+ backend_info_t *info;
EOF
if($arity == $ARITY_DYNAMIC) {
"rematerializable" => "arch_irn_flags_rematerializable",
"modify_flags" => "arch_irn_flags_modify_flags",
"simple_jump" => "arch_irn_flags_simple_jump",
+ "not_scheduled" => "arch_irn_flags_not_scheduled",
);
if (defined(%custom_irn_flags)) {
%known_irn_flags = (%known_irn_flags, %custom_irn_flags);
EOF
if (exists($n->{"init_attr"})) {
- $temp .= "\tattr = get_irn_generic_attr(res);\n";
+ $temp .= "\tattr = (${attr_type}*)get_irn_generic_attr(res);\n";
$temp .= "\t".$n->{"init_attr"}."\n";
}
$temp .= <<EOF;
/* optimize node */
res = optimize_node(res);
- irn_vrfy_irg(res, current_ir_graph);
+ irn_verify_irg(res, current_ir_graph);
return res;
EOF
$obst_constructor .= "}\n\n";
}
-push(@obst_enum_op, "typedef enum _${arch}_opcodes {\n");
+push(@obst_enum_op, "typedef enum ${arch}_opcodes {\n");
foreach my $op (keys(%nodes)) {
my %n = %{ $nodes{"$op"} };
my $known_mode;
$num_outs = $#outs + 1;
- $obst_proj .= "\nenum pn_${op} {\n";
+ if ($num_outs > 0) {
+ $obst_proj .= "\nenum pn_${op} {\n";
- for (my $idx = 0; $idx <= $#outs; $idx++) {
- # check, if we have additional flags annotated to out
- if ($outs[$idx] =~ /:((S|I)(\|(S|I))*)/) {
- push(@out_flags, $1);
- $outs[$idx] =~ s/:((S|I)(\|(S|I))*)//;
+ for (my $idx = 0; $idx <= $#outs; $idx++) {
+ # check, if we have additional flags annotated to out
+ if ($outs[$idx] =~ /:((S|I)(\|(S|I))*)/) {
+ push(@out_flags, $1);
+ $outs[$idx] =~ s/:((S|I)(\|(S|I))*)//;
+ }
+ $obst_proj .= "\tpn_${op}_".$outs[$idx]." = ${idx},\n";
}
- $obst_proj .= "\tpn_${op}_".$outs[$idx]." = ${idx},\n";
- }
- $obst_proj .= "};\n";
+ $obst_proj .= "};\n";
+ }
# outs have names, it must be a mode_T node
if (!defined($n{mode})) {
$n{mode} = "mode_T";
die "Fatal error: Op ${op} has different number of ins and arity\n";
}
- $obst_proj .= "\nenum n_$op {\n";
- for (my $idx = 0; $idx <= $#ins; $idx++) {
- $obst_proj .= "\tn_${op}_".$ins[$idx]." = ${idx},\n";
+ if ($#ins >= 0) {
+ $obst_proj .= "\nenum n_$op {\n";
+ for (my $idx = 0; $idx <= $#ins; $idx++) {
+ $obst_proj .= "\tn_${op}_".$ins[$idx]." = ${idx},\n";
+ }
+ $obst_proj .= "};\n";
}
- $obst_proj .= "};\n";
}
# Create opcode
open(OUT, ">$target_c") || die("Fatal error: Could not open $target_c, reason: $!\n");
-print OUT "#include \"gen_$arch\_regalloc_if.h\"\n\n";
+print OUT "#include \"gen_$arch\_regalloc_if.h\"\n";
+print OUT "#include \"irverify_t.h\"\n";
+print OUT "\n";
print OUT @obst_cmp_attr;
print OUT "\n";
print OUT @obst_opvar;
#ifdef BIT
#undef BIT
#endif
-#define BIT(x) (1 << (x % 32))
+#define BIT(x) (1 << (x))
END
ENDOFMAIN
if (defined($default_op_attr_type)) {
- print OUT "\tattrs = xmalloc(sizeof(attr[0]) * iro_$arch\_last);\n";
- print OUT "\tmemset(attrs, 0, sizeof(attr[0]) * iro_$arch\_last);\n";
+ print OUT "\tattrs = XMALLOCNZ(${default_op_attr_type}, iro_${arch}_last);\n";
}
print OUT @obst_new_irop;
} elsif(defined($temp)) {
$temp .= " | ";
}
- $temp .= "BIT(REG_".uc(${reg}).")";
+ my $firstreg = uc($reg_classes{$class}[0]->{"name"});
+ my $classuc = uc($class);
+ my $reguc = uc($reg);
+ $temp .= "BIT(REG_${classuc}_${reguc})";
}
if(defined($temp)) {
push(@obst_limit_func, "${temp}");
my $idx = shift;
my $is_in = shift;
my $class = "";
+ my $width = 1;
my $result;
my @req_type_mask;
push(@req_type_mask, "arch_register_req_type_ignore");
} elsif ($f eq "S") {
push(@req_type_mask, "arch_register_req_type_produces_sp");
+ } elsif ($f eq "a") {
+ push(@req_type_mask, "arch_register_req_type_aligned");
+ } elsif ($f eq "2" or $f eq "4" or $f eq "8") {
+ $width = int($f);
}
}
}
NULL, /* regclass */
NULL, /* limit bitset */
0, /* same pos */
- 0 /* different pos */
+ 0, /* different pos */
+ 0 /* width */
};
EOF
& ${arch}_reg_classes[CLASS_${arch}_${class}],
NULL, /* limit bitset */
0, /* same pos */
- 0 /* different pos */
+ 0, /* different pos */
+ $width /* width */
};
EOF
& ${arch}_reg_classes[CLASS_${arch}_${class}],
${limit_bitset},
${same_pos}, /* same pos */
- ${different_pos} /* different pos */
+ ${different_pos}, /* different pos */
+ $width /* width */
};
EOF