Another version of copy elimination
[libfirm] / ir / be / scripts / generate_new_opcodes.pl
index 86b5a1c..cfc5669 100755 (executable)
@@ -66,7 +66,7 @@ foreach my $op (keys(%nodes)) {
        my $n_res = 0;
 
        # determine arity from in requirements
-       $arity = 0;
+       $arity = exists($n{"arity"}) ? $n{"arity"} : 0;
        if (exists($n{"reg_req"}) && exists($n{"reg_req"}{"in"})) {
                $arity = scalar(@{ $n{"reg_req"}{"in"} });
        }
@@ -88,7 +88,7 @@ foreach my $op (keys(%nodes)) {
 
        push(@obst_opvar, "ir_op *op_$op = NULL;\n");
        push(@obst_get_opvar, "ir_op *get_op_$op(void)         { return op_$op; }\n");
-       push(@obst_get_opvar, "int    is_$op(const ir_node *n) { return get_irn_opcode(n) == iro_$op; }\n\n");
+       push(@obst_get_opvar, "int    is_$op(const ir_node *n) { return get_$arch\_irn_opcode(n) == iro_$op; }\n\n");
 
        push(@obst_is_archirn, "is_$op(node)");
 
@@ -251,6 +251,10 @@ foreach my $op (keys(%nodes)) {
                                        $out_param = "NULL, 0";
                                }
                        }
+                       else {
+                               $in_param = "NULL";
+                               $out_param = "NULL, 0";
+                       }
                        $temp .= "\n  /* create node */\n";
                        my $mode = "mode";
                        if ($tuple == 1) {
@@ -348,8 +352,9 @@ int is_$arch\_irn(const ir_node *node) {
 }
 
 int get_$arch\_irn_opcode(const ir_node *node) {
-  assert(is_$arch\_irn(node));
-  return get_irn_opcode(node) - $arch\_opcode_start;
+  if (is_$arch\_irn(node))
+       return get_irn_opcode(node) - $arch\_opcode_start;
+  return -1;
 }
 
 ENDOFISIRN