X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fscripts%2Fgenerate_new_opcodes.pl;h=6890d536dd92092f75fb64a5d444cb17cbe19082;hb=a3ff5d70ee39a6308a81fb4d7f53258d11f93013;hp=363b56e53192a075d9da601ed8398398cecc4004;hpb=1ce363f80e6a204d4011f85813362d9bd1d0e7e4;p=libfirm diff --git a/ir/be/scripts/generate_new_opcodes.pl b/ir/be/scripts/generate_new_opcodes.pl index 363b56e53..6890d536d 100755 --- a/ir/be/scripts/generate_new_opcodes.pl +++ b/ir/be/scripts/generate_new_opcodes.pl @@ -158,7 +158,7 @@ foreach my $class_name (keys(%reg_classes)) { # for registering additional opcodes $n_opcodes += $additional_opcodes if (defined($additional_opcodes)); -push(@obst_header, "void ".$arch."_create_opcodes(void);\n"); +push(@obst_header, "void ".$arch."_create_opcodes(const arch_irn_ops_t *be_ops);\n"); push(@obst_enum_op, "typedef enum _$arch\_opcodes {\n"); foreach my $op (keys(%nodes)) { @@ -265,6 +265,12 @@ foreach my $op (keys(%nodes)) { $attr_type = $default_attr_type; } + # determine hash function + my $hash_func; + if (exists($n{"hash_func"})) { + $hash_func = $n{"hash_func"}; + } + # determine compare function my $cmp_attr_func; if (exists($n{"cmp_attr"})) { @@ -311,7 +317,7 @@ foreach my $op (keys(%nodes)) { my $complete_args = ""; $temp = ""; - $temp = "ir_node *new_rd_$op(dbg_info *db, ir_graph *irg, ir_node *block"; + $temp = "ir_node *new_bd_$op(dbg_info *db, ir_node *block"; if (!exists($n{"args"})) { # default args if ($arity == $ARITY_VARIABLE) { $complete_args = ", int arity, ir_node *in[]"; @@ -481,10 +487,8 @@ foreach my $op (keys(%nodes)) { $temp .= "\tflags |= arch_irn_flags_rematerializable;\n"; } elsif ($flag eq "N") { $temp .= "\tflags |= arch_irn_flags_dont_spill;\n"; - } elsif ($flag eq "I") { - $temp .= "\tflags |= arch_irn_flags_ignore;\n"; - } elsif ($flag eq "S") { - $temp .= "\tflags |= arch_irn_flags_modify_sp;\n"; + } else { + die "Fatal error: unknown flag $flag for ${op}\n"; } } $temp .= "\n"; @@ -492,7 +496,7 @@ foreach my $op (keys(%nodes)) { $temp .= "\t/* create node */\n"; $temp .= "\tassert(op != NULL);\n"; - $temp .= "\tres = new_ir_node(db, irg, block, op, mode, arity, in);\n"; + $temp .= "\tres = new_ir_node(db, current_ir_graph, block, op, mode, arity, in);\n"; $temp .= "\n"; $temp .= "\t/* init node attributes */\n"; @@ -507,33 +511,6 @@ foreach my $op (keys(%nodes)) { } $temp .= "\n"; - # set flags for outs - if (exists($n{"outs"})) { - undef my @outs; - @outs = @{ $n{"outs"} }; - - for (my $idx = 0; $idx <= $#outs; $idx++) { - # check, if we have additional flags annotated to out - if ($outs[$idx] =~ /:((S|I)(\|(S|I))*)/) { - my $flag_string = $1; - my $prefix = ""; - my $flags = ""; - - foreach my $flag (split(/\|/, $flag_string)) { - if ($flag eq "I") { - $flags .= $prefix."arch_irn_flags_ignore"; - $prefix = " | "; - } elsif ($flag eq "S") { - $flags .= $prefix."arch_irn_flags_modify_sp"; - $prefix = " | "; - } - } - - $temp .= "\tset_$arch\_out_flags(res, $flags, $idx);\n"; - } - } - } - if (exists($n{"init_attr"})) { $temp .= "\tattr = get_irn_generic_attr(res);\n"; $temp .= "\t".$n{"init_attr"}."\n"; @@ -541,7 +518,7 @@ foreach my $op (keys(%nodes)) { $temp .= "\t/* optimize node */\n"; $temp .= "\tres = optimize_node(res);\n"; - $temp .= "\tirn_vrfy_irg(res, irg);\n"; + $temp .= "\tirn_vrfy_irg(res, current_ir_graph);\n"; $temp .= "\n"; $temp .= "\treturn res;\n"; @@ -562,6 +539,7 @@ foreach my $op (keys(%nodes)) { push(@obst_new_irop, "\n\tmemset(&ops, 0, sizeof(ops));\n"); + push(@obst_new_irop, "\tops.be_ops = be_ops;\n"); push(@obst_new_irop, "\tops.dump_node = $arch\_dump_node;\n"); if (defined($cmp_attr_func)) { @@ -574,6 +552,9 @@ foreach my $op (keys(%nodes)) { if (defined($copy_attr_func)) { push(@obst_new_irop, "\tops.copy_attr = ${copy_attr_func};\n"); } + if (defined($hash_func)) { + push(@obst_new_irop, "\tops.hash = ${hash_func};\n"); + } $n_opcodes++; my $n_res = $out_arity; @@ -583,10 +564,9 @@ foreach my $op (keys(%nodes)) { $temp = "\top_$op = new_ir_op(cur_opcode + iro_$op, \"$op\", op_pin_state_".$n{"state"}.", ".$n{"op_flags"}; $temp .= "|M, ".translate_arity($arity).", 0, sizeof(${attr_type}), &ops);\n"; push(@obst_new_irop, $temp); - push(@obst_new_irop, "\tset_op_tag(op_$op, &$arch\_op_tag);\n"); + push(@obst_new_irop, "\tset_op_tag(op_$op, $arch\_op_tag);\n"); if(defined($default_op_attr_type)) { - push(@obst_new_irop, "\tattr = ($default_op_attr_type *) xmalloc(sizeof(attr[0]));\n"); - push(@obst_new_irop, "\tmemset(attr, 0, sizeof(attr[0]));\n"); + push(@obst_new_irop, "\tattr = &attrs[iro_$op];\n"); if(defined($n{op_attr_init})) { push(@obst_new_irop, "\t".$n{op_attr_init}."\n"); } @@ -644,7 +624,7 @@ if (length($arch) >= 4) { print OUT<