X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fscripts%2Fgenerate_regalloc_if.pl;h=535182d8cfaad526f52494a87dce5c48f388c6b4;hb=8535fe8732b0acf822be252812a7158ce5b8134a;hp=3b758bc002992e194d56e0378a0df820a348982e;hpb=a4a460fa1b3c89cf13801ac4e1d62faa2ac0521a;p=libfirm diff --git a/ir/be/scripts/generate_regalloc_if.pl b/ir/be/scripts/generate_regalloc_if.pl index 3b758bc00..535182d8c 100755 --- a/ir/be/scripts/generate_regalloc_if.pl +++ b/ir/be/scripts/generate_regalloc_if.pl @@ -1,13 +1,13 @@ #!/usr/bin/perl -w -# This script generates C code which emits assembler code for the -# assembler ir nodes. It takes a "emit" key from the node specification -# and substitutes lines starting with . with a corresponding fprintf(). +# This script generates C code which creates ands sets up functions and +# data structures for the register allocator. # Creation: 2005/11/14 # $Id$ use strict; use Data::Dumper; +use integer; my $specfile = $ARGV[0]; my $target_dir = $ARGV[1]; @@ -15,12 +15,13 @@ my $target_dir = $ARGV[1]; our $arch; our %reg_classes; our %nodes; +our %cpu; # include spec file my $return; -no strict "subs"; +use strict "subs"; unless ($return = do $specfile) { warn "couldn't parse $specfile: $@" if $@; warn "couldn't do $specfile: $!" unless defined $return; @@ -33,23 +34,50 @@ my $target_h = $target_dir."/gen_".$arch."_regalloc_if.h"; my $target_h_t = $target_dir."/gen_".$arch."_regalloc_if_t.h"; # helper function -my @rt = ("arch_register_type_none", - "arch_register_type_write_invariant", - "arch_register_type_caller_saved", - "arch_register_type_callee_saved", - "arch_register_type_ignore"); +sub translate_reg_type { + my $t = shift; + + if ($t == 0) { + return "arch_register_type_none"; + } + else { + my @types; + + if ($t & 1) { + push(@types, "arch_register_type_caller_save"); + } + + if ($t & 2) { + push(@types, "arch_register_type_callee_save"); + } + + if ($t & 4) { + push(@types, "arch_register_type_ignore"); + } + + if ($t & 8) { + push(@types, "arch_register_type_joker"); + } + + if ($t & 16) { + push(@types, "arch_register_type_virtual"); + } + + return join(" | ", @types); + } +} # stacks for output -my @obst_regtypes; # stack for the register type variables +my @obst_regtypes_def; # stack for the register type variables definitions +my @obst_regtypes_decl;# stack for the register type variables declarations my @obst_regclasses; # stack for the register class variables my @obst_classdef; # stack to define a name for a class index my @obst_regdef; # stack to define a name for a register index my @obst_reginit; # stack for the register type inits my @obst_req; # stack for the register requirements my @obst_limit_func; # stack for functions to return a subset of a register class -my @obst_defreq_head; # stack for prototypes of default requirement function my @obst_header_all; # stack for some extern struct defs needed for bearch_$arch include -my @obst_projnum_map; # stack for mapping register projnums to requirements +my @obst_header_t; my $numregs; my $class_ptr; @@ -58,27 +86,18 @@ my $class_idx = 0; my $tmp; my %reg2class; +my %regclass2len; -# there is a default NONE requirement -$tmp = "/* Default NONE register requirements */\n"; -$tmp .= "const $arch\_register_req_t $arch\_default_req_none = {\n"; -$tmp .= " {\n"; -$tmp .= " arch_register_req_type_none,\n"; -$tmp .= " NULL,\n"; -$tmp .= " NULL,\n"; -$tmp .= " NULL,\n"; -$tmp .= " NULL\n"; -$tmp .= " },\n"; -$tmp .= " 0\n"; -$tmp .= "};\n\n"; -push(@obst_req, $tmp); - -push(@obst_header_all, "extern arch_register_class_t $arch\_reg_classes[N_CLASSES];\n\n"); -push(@obst_header_all, "extern const $arch\_register_req_t $arch\_default_req_none;\n"); +push(@obst_classdef, "enum reg_classes {\n"); -push(@obst_classdef, "#define N_CLASSES ".scalar(keys(%reg_classes))."\n"); +my $class_mode; -my $global_projnum_idx = 0; +# assure, the initialization is done only once +push(@obst_reginit, "\tstatic int run_once = 0;\n"); +push(@obst_reginit, "\n"); +push(@obst_reginit, "\tif (run_once)\n"); +push(@obst_reginit, "\t\treturn;\n"); +push(@obst_reginit, "\trun_once = 1;\n"); # generate register type and class variable, init function and default requirements foreach my $class_name (keys(%reg_classes)) { @@ -88,89 +107,42 @@ foreach my $class_name (keys(%reg_classes)) { $class_name = $arch."_".$class_name; $numregs = "N_".$class_name."_REGS"; $class_ptr = "&".$arch."_reg_classes[CLASS_".$class_name."]"; + $class_mode = pop(@class)->{"mode"}; - push(@obst_regtypes, "#define $numregs ".($#class + 1)."\n"); - push(@obst_regtypes, "arch_register_t ".$class_name."_regs[$numregs];\n\n"); - - push(@obst_classdef, "#define CLASS_$class_name $class_idx\n"); - push(@obst_regclasses, "{ \"$class_name\", $numregs, ".$class_name."_regs }"); + push(@obst_regtypes_decl, "extern arch_register_t ".$class_name."_regs[$numregs];\n"); + push(@obst_regtypes_def, "arch_register_t ".$class_name."_regs[$numregs];\n"); - # there is a default NORMAL requirement for each class - $tmp = "/* Default NORMAL register requirements for class $class_name */\n"; - $tmp .= "const $arch\_register_req_t $arch\_default_req_$class_name = {\n"; - $tmp .= " {\n"; - $tmp .= " arch_register_req_type_normal,\n"; - $tmp .= " $class_ptr,\n"; - $tmp .= " NULL,\n"; - $tmp .= " NULL,\n"; - $tmp .= " NULL\n"; - $tmp .= " },\n"; - $tmp .= " 0\n"; - $tmp .= "};\n\n"; - push(@obst_req, $tmp); - - push(@obst_header_all, "\nextern const $arch\_register_req_t $arch\_default_req_$class_name;\n"); + push(@obst_classdef, "\tCLASS_$class_name = $class_idx,\n"); + push(@obst_regclasses, "{ \"$class_name\", $numregs, NULL, ".$class_name."_regs }"); my $idx = 0; - push(@obst_reginit, " /* Init of all registers in class '$class_name' */\n\n"); + push(@obst_reginit, "\t/* Init of all registers in class '$class_name' */\n\n"); + push(@obst_reginit, "\t/* set largest possible mode for '$class_name' */\n"); + push(@obst_reginit, "\t$arch\_reg_classes[CLASS_".$class_name."].mode = $class_mode;\n\n"); + push(@obst_regdef, "enum reg_".$class_name."_values {\n"); foreach (@class) { - # For each class we build for each of it's member registers a limit function - # which limits the class to this particular register. We also build the - # corresponding requirement structs. - # We need those functions to set register requirements on demand in transformation - # esp. for Call and RegParams where we can mix int and float parameters. - - my $limit_func_name = $arch."_limit_".$class_name."_".$_->{"name"}; - - # push the function prototype - $tmp = "void $limit_func_name(void *_unused, bitset_t *bs)"; - push(@obst_defreq_head, $tmp.";\n"); - - # push the function definition - $tmp .= " {\n"; - $tmp .= " bs = bitset_clear_all(bs);\n"; - $tmp .= " bitset_set(bs, REG_".uc($_->{"name"}).");\n"; # REGISTER to index assignment is done some lines down - $tmp .= "}\n\n"; - push(@obst_limit_func, $tmp); - - # push the default requirement struct - $tmp = "const $arch\_register_req_t $arch\_default_req_$class_name\_".$_->{"name"}." = {\n"; - $tmp .= " {\n"; - $tmp .= " arch_register_req_type_limited,\n"; - $tmp .= " $class_ptr,\n"; - $tmp .= " $limit_func_name,\n"; - $tmp .= " NULL,\n"; - $tmp .= " NULL\n"; - $tmp .= " },\n"; - $tmp .= " 0\n"; - $tmp .= "};\n\n"; - push(@obst_req, $tmp); - - push(@obst_header_all, "extern const $arch\_register_req_t $arch\_default_req_$class_name\_".$_->{"name"}.";\n"); + # realname is name if not set by user + $_->{"realname"} = $_->{"name"} if (! exists($_->{"realname"})); $reg2class{$_->{"name"}} = { "class" => $old_classname, "index" => $idx }; # remember reg to class for later use - push(@obst_regdef, "#define REG_".uc($_->{"name"})." $idx\n"); - push(@obst_reginit, " ".$class_name."_regs[$idx].name = \"".$_->{"name"}."\";\n"); - push(@obst_reginit, " ".$class_name."_regs[$idx].reg_class = $class_ptr;\n"); - push(@obst_reginit, " ".$class_name."_regs[$idx].index = $idx;\n"); - push(@obst_reginit, " ".$class_name."_regs[$idx].type = ".$rt[$_->{"type"}].";\n"); - if ($_->{"type"} == 2) { - # this is a caller saved register - push(@obst_reginit, " ia32_set_reg_projnum(&".$class_name."_regs[$idx], $global_projnum_idx, isa->reg_projnum_map);\n"); - push(@obst_projnum_map, "&$arch\_default_req_$class_name\_".$_->{"name"}); - $global_projnum_idx++; - } + push(@obst_regdef, "\tREG_".uc($_->{"name"})." = $idx,\n"); + push(@obst_reginit, "\t${class_name}_regs[$idx].name = \"".$_->{"realname"}."\";\n"); + push(@obst_reginit, "\t${class_name}_regs[$idx].reg_class = $class_ptr;\n"); + push(@obst_reginit, "\t${class_name}_regs[$idx].index = $idx;\n"); + push(@obst_reginit, "\t${class_name}_regs[$idx].type = ".translate_reg_type($_->{"type"}).";\n"); + push(@obst_reginit, "\t${class_name}_regs[$idx].data = ".get_execunit_variable_name($_->{"unit"}).";\n"); push(@obst_reginit, "\n"); $idx++; } + $regclass2len{$old_classname} = $idx; + push(@obst_regdef, "\t$numregs = $idx\n"); + push(@obst_regdef, "};\n\n"); $class_idx++; } -push(@obst_regdef, "\n#define N_CALLER_SAVE_REGS ".scalar(@obst_projnum_map)."\n"); - -push(@obst_header_all, "\nextern const $arch\_register_req_t *$arch\_projnum_reg_req_map[N_CALLER_SAVE_REGS];\n\n"); -push(@obst_header_all, "\n/* node specific requirements */\n"); +push(@obst_classdef, "\tN_CLASSES = ".scalar(keys(%reg_classes))."\n"); +push(@obst_classdef, "};\n\n"); # generate node-register constraints foreach my $op (keys(%nodes)) { @@ -203,9 +175,6 @@ my $creation_time = localtime(time()); $tmp = uc($arch); print OUT<$target_h") || die("Could not open $target_h, reason: $!\n"); $creation_time = localtime(time()); print OUT<$target_c") || die("Could not open $target_c, reason: $!\n"); $creation_time = localtime(time()); @@ -280,23 +252,33 @@ print OUT< +#endif -#include "gen_$arch\_regalloc_if.h" -#include "bearch_ia32_t.h" /* we need this to put the caller saved registers into the isa set */ -#include "ia32_map_regs.h" +#include "gen_${arch}_regalloc_if.h" +#include "gen_${arch}_machine.h" +#include "bearch_${arch}_t.h" +#include "${arch}_map_regs.h" +#include "irmode.h" + +#ifdef BIT +#undef BIT +#endif +#define BIT(x) (1 << (x % 32)) EOF -print OUT "arch_register_class_t $arch\_reg_classes[] = {\n ".join(",\n ", @obst_regclasses)."\n};\n\n"; +print OUT "arch_register_class_t ${arch}_reg_classes[] = {\n\t".join(",\n\t", @obst_regclasses)."\n};\n\n"; -print OUT "const $arch\_register_req_t *$arch\_projnum_reg_req_map[] = {\n ".join(",\n ", @obst_projnum_map)."\n};\n\n"; +print OUT @obst_regtypes_def, "\n"; -print OUT "void ".$arch."_register_init(void *isa_ptr) {\n"; -print OUT " ia32_isa_t *isa = (ia32_isa_t *)isa_ptr;\n\n"; +print OUT "void ${arch}_register_init(void *isa_ptr) {\n"; print OUT @obst_reginit; print OUT "}\n\n"; print OUT @obst_limit_func; + print OUT @obst_req; close(OUT); @@ -320,14 +302,12 @@ sub build_inout_idx_class { if ($reqs[$idx] eq "none") { $class = "none"; - } - elsif (is_reg_class($reqs[$idx])) { + } elsif (is_reg_class($reqs[$idx])) { $class = $reqs[$idx]; - } - else { + } else { my @regs = split(/ /, $reqs[$idx]); GET_CLASS: foreach my $reg (@regs) { - if ($reg =~ /!?(in|out)\_r\d+/) { + if ($reg =~ /!?(in|out)\_r\d+/ || $reg =~ /!in/) { $class = "UNKNOWN_CLASS"; } else { @@ -365,44 +345,80 @@ sub generate_requirements { for (my $idx = 0; $idx <= $#reqs; $idx++) { my $class = undef; - my $tmp2 = "const $arch\_register_req_t _".$op."_reg_req_$inout\_$idx = "; - my $tmp = "const $arch\_register_req_t *".$op."_reg_req_$inout\_$idx = "; - - push(@obst_header_all, "extern const $arch\_register_req_t *".$op."_reg_req_$inout\_$idx;\n"); + my $tmp2 = "const arch_register_req_t ${op}_reg_req_${inout}_${idx} = "; if ($reqs[$idx] eq "none") { - $tmp .= "&$arch\_default_req_none;\n"; - } - elsif (is_reg_class($reqs[$idx])) { - $tmp .= "&$arch\_default_req_".$arch."_".$reqs[$idx].";\n"; - } - else { + $tmp2 .= "{\n"; + $tmp2 .= "\tarch_register_req_type_none,\n"; + $tmp2 .= "\tNULL, /* regclass */\n"; + $tmp2 .= "\tNULL, /* limit bitset */\n"; + $tmp2 .= "\t-1, /* same pos */\n"; + $tmp2 .= "\t-1 /* different pos */\n"; + $tmp2 .= "};\n"; + + push(@obst_req, $tmp2."\n"); + push(@obst_header_t, "extern const arch_register_req_t ${op}_reg_req_${inout}_${idx};\n"); + } elsif ($reqs[$idx] =~ /^new_reg_(.*)$/) { + if (is_reg_class($1)) { + $tmp2 .= "{\n"; + $tmp2 .= "\tarch_register_req_type_should_be_different_from_all,\n"; + $tmp2 .= "\t&${arch}_reg_classes[CLASS_${arch}_$1],\n"; + $tmp2 .= "\tNULL, /* limit bitset */\n"; + $tmp2 .= "\t-1, /* same pos */\n"; + $tmp2 .= "\t-1 /* different pos */\n"; + $tmp2 .= "};\n"; + + push(@obst_req, $tmp2."\n"); + push(@obst_header_t, "extern const arch_register_req_t ${op}_reg_req_${inout}_${idx};\n"); + } else { + print STDERR "Invalid register class '$1' given in OUT requirement $idx for '$op'.\n"; + } + } elsif (is_reg_class($reqs[$idx])) { + my $class = $reqs[$idx]; + $tmp2 .= "{\n"; + $tmp2 .= "\tarch_register_req_type_normal,\n"; + $tmp2 .= "\t&${arch}_reg_classes[CLASS_${arch}_${class}],\n"; + $tmp2 .= "\tNULL, /* limit bitset */\n"; + $tmp2 .= "\t-1, /* same pos */\n"; + $tmp2 .= "\t-1 /* different pos */\n"; + $tmp2 .= "};\n"; + + push(@obst_req, $tmp2."\n"); + push(@obst_header_t, "extern const arch_register_req_t ${op}_reg_req_${inout}_${idx};\n"); + } else { my @req_type_mask; - my ($class, $has_limit, $pos, $same) = build_subset_class_func($n, $op, $idx, (($inout eq "in") ? 1 : 0), $reqs[$idx]); + my ($class, $has_limit, $same_pos, $different_pos) = build_subset_class_func($n, $op, $idx, (($inout eq "in") ? 1 : 0), $reqs[$idx]); + if (!defined($class)) { die("Could not build subset for ".uc($inout)." requirements '$op' pos $idx ... exiting.\n"); } + if ($has_limit) { push(@req_type_mask, "arch_register_req_type_limited"); } - if (defined($pos)) { - push(@req_type_mask, "arch_register_req_type_should_be_".($same ? "same" : "different")); + if (defined($same_pos)) { + push(@req_type_mask, "arch_register_req_type_should_be_same"); } - $tmp .= "&_".$op."_reg_req_$inout\_$idx;\n"; - $tmp2 .= " {\n"; - $tmp2 .= " {\n"; - $tmp2 .= " ".join(" | ", @req_type_mask).",\n"; - $tmp2 .= " &$arch\_reg_classes[CLASS_$arch\_".$class."],\n"; - $tmp2 .= " ".($has_limit ? "limit_reg_".$op."_$inout\_".$idx : "NULL").",\n"; - $tmp2 .= " NULL,\n"; - $tmp2 .= " NULL\n"; - $tmp2 .= " },\n"; - $tmp2 .= " ".(defined($pos) ? $pos : "0")."\n};\n"; - - $tmp = $tmp2.$tmp; - } + if (defined($different_pos)) { + if ($different_pos == 666) { + push(@req_type_mask, "arch_register_req_type_should_be_different_from_all"); + undef $different_pos; + } else { + push(@req_type_mask, "arch_register_req_type_should_be_different"); + } + } + + $tmp2 .= "{\n"; + $tmp2 .= "\t".join(" | ", @req_type_mask).",\n"; + $tmp2 .= "\t&${arch}_reg_classes[CLASS_${arch}_${class}],\n"; + $tmp2 .= "\t".($has_limit ? "limit_reg_${op}_${inout}_${idx}" : "NULL").",\n"; + $tmp2 .= "\t".(defined($same_pos) ? $same_pos : "-1").",\n"; + $tmp2 .= "\t".(defined($different_pos) ? $different_pos : "-1")."\n"; + $tmp2 .= "};\n"; - push(@obst_req, $tmp."\n"); + push(@obst_req, $tmp2."\n"); + push(@obst_header_t, "extern const arch_register_req_t ${op}_reg_req_${inout}_${idx};\n"); + } } } @@ -423,6 +439,7 @@ sub is_reg_class { ### sub get_reg_class { my $reg = shift; + $reg = substr($reg, 1) if ($reg =~ /!.*/); return $reg2class{"$reg"}{"class"} if (exists($reg2class{"$reg"})); return undef; } @@ -444,20 +461,22 @@ sub get_reg_index { # pos which corresponds to in/out reference position or undef ### sub build_subset_class_func { - my $neg = undef; - my $class = undef; + my $neg = undef; + my $class = undef; + my $has_limit = 0; + my $same_pos = undef; + my $different_pos = undef; my $temp; - my $has_limit = 0; + my @obst_init; + my @obst_limits; + my @obst_ignore; + my @limit_array; # build function header - my $n = shift; - my $op = shift; - my $idx = shift; - my $in = shift; - my $pos = undef; - my $same = 1; - - my @temp_obst; + my $n = shift; + my $op = shift; + my $idx = shift; + my $in = shift; my $outin = $in ? "out" : "in"; my @regs = split(/ /, shift); @@ -467,15 +486,25 @@ sub build_subset_class_func { # set/unset registers CHECK_REQS: foreach (@regs) { if (/(!)?$outin\_r(\d+)/) { - if (defined($pos)) { - print STDERR "Multiple in/out references in one requirement not allowed.\n"; + if (($1 && defined($different_pos)) || (!$1 && defined($same_pos))) { + print STDERR "Multiple in/out references of same type in one requirement not allowed.\n"; return (undef, undef, undef, undef); } - $same = 0 if ($1); + + if ($1) { + $different_pos = $in ? -$2 : $2 - 1; + } + else { + $same_pos = $in ? -$2 : $2 - 1; + } + $class = $idx_class[$2 - 1]; - $pos = $in ? -$2 : $2 - 1; next CHECK_REQS; } + elsif (/!in/) { + $class = $idx_class[0]; + return ($class, 0, undef, 666); + } # check for negate if (substr($_, 0, 1) eq "!") { @@ -488,13 +517,11 @@ CHECK_REQS: foreach (@regs) { if (!defined($neg)) { $has_limit = 1; - push(@temp_obst, " bs = bitset_set_all(bs); /* allow all register (negative constraints given) */\n"); } $_ = substr($_, 1); # skip '!' $neg = 1; - } - else { + } else { if (defined($neg) && $neg == 1) { # we have seen a negative constraint as first one but this one is positive # this doesn't make sense @@ -502,10 +529,7 @@ CHECK_REQS: foreach (@regs) { return (undef, undef, undef, undef); } - if (!defined($neg)) { - $has_limit = 1; - push(@temp_obst, " bs = bitset_clear_all(bs); /* disallow all register (positive constraints given) */\n"); - } + $has_limit = 1; $neg = 0; } @@ -519,29 +543,94 @@ CHECK_REQS: foreach (@regs) { # set class if (!defined($class)) { $class = $temp; - } - elsif ($class ne $temp) { + } elsif ($class ne $temp) { # all registers must belong to the same class print STDERR "Registerclass mismatch. '$_' is not member of class '$class'.\n"; return (undef, undef, undef, undef); } - if ($neg == 1) { - $has_limit = 1; - push(@temp_obst, " bitset_clear(bs, ".get_reg_index($_)."); /* disallow $_ */\n"); - } - else { - $has_limit = 1; - push(@temp_obst, " bitset_set(bs, ".get_reg_index($_)."); /* allow $_ */\n"); + # calculate position inside the initializer bitfield (only 32 bits per + # element) + my $regidx = get_reg_index($_); + my $arrayp = $regidx / 32; + push(@{$limit_array[$arrayp]}, $_); + } + + # don't allow ignore regs in negative constraints + if($neg) { + my @cur_class = @{ $reg_classes{"$class"} }; + for (my $idx = 0; $idx <= $#cur_class; $idx++) { + if (defined($cur_class[$idx]{"type"}) && ($cur_class[$idx]{"type"} & 4)) { + my $reg = $cur_class[$idx]{"name"}; + my $regix = get_reg_index($reg); + my $arrayp = $regix / 32; + push(@{$limit_array[$arrayp]}, $reg); + } } } if ($has_limit == 1) { - push(@obst_limit_func, "/* limit the possible registers for ".($in ? "IN" : "OUT")." $idx at op $op */\n"); - push(@obst_limit_func, "void limit_reg_".$op."_".($in ? "in" : "out")."_".$idx."(void *_unused, bitset_t *bs) {\n"); - push(@obst_limit_func, @temp_obst); - push(@obst_limit_func, "}\n\n"); + push(@obst_limit_func, "static const unsigned limit_reg_${op}_".($in ? "in" : "out")."_${idx}[] = { "); + my $first = 1; + my $limitbitsetlen = $regclass2len{$class}; + my $limitarraylen = $limitbitsetlen / 32 + ($limitbitsetlen % 32 > 0 ? 1 : 0); + for(my $i = 0; $i < $limitarraylen; $i++) { + my $limitarraypart = $limit_array[$i]; + if($first) { + $first = 0; + } else { + push(@obst_limit_func, ", "); + } + my $temp; + if($neg) { + $temp = "0xFFFFFFFF"; + } + foreach my $reg (@{$limitarraypart}) { + if($neg) { + $temp .= " & ~"; + } elsif(defined($temp)) { + $temp .= " | "; + } + $temp .= "BIT(REG_".uc(${reg}).")"; + } + if(defined($temp)) { + push(@obst_limit_func, "${temp}"); + } else { + push(@obst_limit_func, "0"); + } + } + push(@obst_limit_func, " };\n"); + } + + return ($class, $has_limit, $same_pos, $different_pos); +} + +### +# Gets the variable name for the execution unit assigned to this register. +### +sub get_execunit_variable_name { + my $unit = shift; + my $name = "NULL"; + my $uc_arch = uc($arch); + + if ($unit) { + my $found = 0; +SRCH: foreach my $cur_type (keys(%cpu)) { + foreach my $cur_unit (@{ $cpu{"$cur_type"} }) { + if ($unit eq $cur_unit) { + my $tp_name = "$arch\_execution_units_$cur_type"; + my $unit_name = "$uc_arch\_EXECUNIT_TP_$cur_type\_$unit"; + $name = "&".$tp_name."[".$unit_name."]"; + $found = 1; + last SRCH; + } + } + } + + if (! $found) { + print STDERR "Invalid execution unit $unit specified!\n"; + } } - return ($class, $has_limit, $pos, $same); + return $name; }