X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fscripts%2Fgenerate_new_opcodes.pl;h=1a634a6e37c5ba6b7623fdcf873022de63c0566a;hb=93da909d12b7bec51aa36ee5f05966c331f90fb9;hp=0b0680181012335bb26f045b8f970598d1c66727;hpb=590df14827a8ff5a5b53c506ac654876107bd8c9;p=libfirm diff --git a/ir/be/scripts/generate_new_opcodes.pl b/ir/be/scripts/generate_new_opcodes.pl index 0b0680181..1a634a6e3 100755 --- a/ir/be/scripts/generate_new_opcodes.pl +++ b/ir/be/scripts/generate_new_opcodes.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # -# Copyright (C) 1995-2007 University of Karlsruhe. All right reserved. +# Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. # # This file is part of libFirm. # @@ -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"})) { @@ -562,6 +568,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 +581,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 +593,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 +653,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)); @@ -1160,21 +1184,6 @@ sub generate_requirements { 0 /* different pos */ }; -EOF - } elsif ($reqs =~ /^new_reg_(.*)$/) { - if(!is_reg_class($1)) { - die "$1 is not a register class in requirements for $op\n"; - } - $class = $1; - $result = <