- my %n = %{ $nodes{"$op"} };
-
- next if (!exists($n{"reg_req"}));
-
- $op = $arch."_".$op;
-
- push(@obst_req, "/* IN requirements for '$op' */\n");
-
- # We can have IN requirements like "out_d1"
- # and for those we need the associated register class
- # That's why we have to check all out requirements first
- # and remember their classes.
- my @outidx_class;
- if (exists($n{"reg_req"}{"out"})) {
- my @out = @{ $n{"reg_req"}{"out"} };
-
- for (my $idx = 0; $idx <= $#out; $idx++) {
- my $class = undef;
-
- if ($out[$idx] eq "none") {
- $class = "none";
- }
- elsif (is_reg_class($out[$idx])) {
- $class = $out[$idx];
- }
- elsif ($out[$idx] =~ /^(!)?in_s(\d+)/) {
- $class = "UNKNOWN_CLASS";
- }
- else {
- my @regs = split(/ /, $out[$idx]);
- $class = get_reg_class($regs[0]);
- if (!defined $class) {
- die("Could not get register class for '$op' pos $idx ... exiting.\n");
- }
- }
-
- push(@outidx_class, $class);
- }
- }
-
-
- # we need to remember the classes of the IN constraints for
- # OUT constraints like "in_s1"
- my @inidx_class;
-
- # check for argument requirements
- if (exists($n{"reg_req"}{"in"})) {
- my @in = @{ $n{"reg_req"}{"in"} };
-
- for (my $idx = 0; $idx <= $#in; $idx++) {
- my $class = undef;
-
- my $tmp2 = "const arch_register_req_t _".$op."_reg_req_in_$idx = ";
-
- $tmp = "const arch_register_req_t *".$op."_reg_req_in_$idx = ";
-
- push(@obst_header_all, "extern const arch_register_req_t *".$op."_reg_req_in_$idx;\n");
-
- if ($in[$idx] eq "none") {
- push(@inidx_class, "none");
- $tmp .= "&ia32_default_req_none;\n";
- }
- elsif (is_reg_class($in[$idx])) {
- push(@inidx_class, $in[$idx]);
- $tmp .= "&ia32_default_req_".$arch."_".$in[$idx].";\n";
- }
- elsif ($in[$idx] =~ /^(!)?out_d(\d+)/) { # this is a "should be (un)equal to register at out_X"
- $tmp .= "&_".$op."_reg_req_in_$idx;\n";
- $tmp2 .= " {\n";
- $tmp2 .= " arch_register_req_type_should_be_".($1 ? "different" : "same").",\n";
- $tmp2 .= " &$arch\_reg_classes[CLASS_$arch\_".$outidx_class[$2 - 1]."],\n";
- $tmp2 .= " NULL,\n -$2\n};\n";
-
- $tmp = $tmp2.$tmp
- }
- else {
- $class = build_subset_class_func($op, $idx, 1, $in[$idx]);
- if (!defined $class) {
- die("Could not build subset for IN requirements '$op' pos $idx ... exiting.\n");
- }
- push(@inidx_class, $class);
- $tmp .= "&_".$op."_reg_req_in_$idx;\n";
- $tmp2 .= " {\n arch_register_req_type_limited,\n &$arch\_reg_classes[CLASS_$arch\_".$class."],\n limit_reg_".$op."_in_".$idx.",\n 0\n};\n";
-
- $tmp = $tmp2.$tmp;
- }
-
- push(@obst_req, $tmp."\n");
- }
- }
-
- push(@obst_req, "/* OUT requirements for '$op' */\n");
-
- # check for result requirements
- if (exists($n{"reg_req"}{"out"})) {
- my @out = @{ $n{"reg_req"}{"out"} };
-
- for (my $idx = 0; $idx <= $#out; $idx++) {
- my $class = undef;
-
- my $tmp2 = "const arch_register_req_t _".$op."_reg_req_out_$idx = ";
-
- $tmp = "const arch_register_req_t *".$op."_reg_req_out_$idx = ";
-
- push(@obst_header_all, "extern const arch_register_req_t *".$op."_reg_req_out_$idx;\n");
-
- if ($out[$idx] eq "none") {
- $tmp .= "&ia32_default_req_none;\n";
- }
- elsif (is_reg_class($out[$idx])) {
- $tmp .= "&ia32_default_req_".$arch."_".$out[$idx].";\n";
- }
- elsif ($out[$idx] =~ /^(!)?in_s(\d+)/) { # this is a "should be (un)equal to register at in_X"
- $tmp .= "&_".$op."_reg_req_out_$idx;\n";
- $tmp2 .= " {\n";
- $tmp2 .= " arch_register_req_type_should_be_".($1 ? "different" : "same").",\n";
- $tmp2 .= " &$arch\_reg_classes[CLASS_$arch\_".$inidx_class[$2 - 1]."],\n";
- $tmp2 .= " NULL,\n ".($2 - 1)."\n};\n";
-
- $tmp = $tmp2.$tmp
- }
- else {
- $class = build_subset_class_func($op, $idx, 0, $out[$idx]);
- if (!defined $class) {
- die("Could not build subset for OUT requirements '$op' pos $idx ... exiting.\n");
- }
- $tmp .= "&_".$op."_reg_req_out_$idx;\n";
- $tmp2 .= " {\n arch_register_req_type_limited,\n &$arch\_reg_classes[CLASS_$arch\_".$class."],\n limit_reg_".$op."_out_".$idx.",\n 0\n};\n";
-
- $tmp = $tmp2.$tmp
- }
-
- push(@obst_req, $tmp."\n");
- }
- }