X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fscripts%2Fgenerate_new_opcodes.pl;h=85e26270e07041c88dbf6ab42bf29c478ef7f006;hb=ba52c5d1ccbf1f80e7cd7f11b7946914c56f3333;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..85e26270e 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)) { @@ -562,6 +562,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)) { @@ -583,10 +584,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 +644,7 @@ if (length($arch) >= 4) { print OUT<ops.be_ops == NULL) + op->ops.be_ops = be_ops; + } + cur_opcode = get_next_ir_opcodes(iro_$arch\_last); $arch\_opcode_start = cur_opcode; 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 @obst_new_irop; print OUT "\n"; print OUT "\t$arch\_register_additional_opcodes(cur_opcode);\n" if (defined($additional_opcodes));