+
+###
+# Return the list of pointers for the given execution units.
+###
+sub get_execunit_list {
+ my $units = shift;
+ my $uc_arch = uc($arch);
+ my $ret = "";
+
+ foreach my $unit (@{ $units }) {
+ if (exists($cpu{"$unit"})) {
+ # operation can be executed on all units of this type
+ # -> add them all
+ my $tp_name = "$arch\_execution_units_$unit";
+ foreach (@{ $cpu{"$unit"} }) {
+ my $unit_name = "$uc_arch\_EXECUNIT_TP_$unit\_$_";
+ $ret .= " &".$tp_name."[".$unit_name."],\n";
+ }
+ }
+ else {
+ # operation can be executed only a certain unit
+ # -> find corresponding unit type
+ my $found = 0;
+TP_SEARCH: 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";
+ $ret .= " &".$tp_name."[".$unit_name."],\n";
+ $found = 1;
+ last TP_SEARCH;
+ }
+ }
+ }
+
+ if (! $found) {
+ print STDERR "Invalid execution unit $unit specified!\n";
+ }
+ }
+ }
+
+ $ret .= " NULL\n";
+
+ return $ret;
+}