- push(@obst_req, $tmp."\n");
- }
-
-}
-
-###
-# Determines whether $name is a specified register class or not.
-# @return 1 if name is register class, 0 otherwise
-###
-sub is_reg_class {
- my $name = shift;
- return 1 if exists($reg_classes{"$name"});
- return 0;
-}
-
-###
-# Returns the register class for a given register.
-# @return class or undef
-###
-sub get_reg_class {
- my $reg = shift;
- return $reg2class{"$reg"}{"class"} if (exists($reg2class{"$reg"}));
- return undef;
-}
-
-###
-# Returns the index of a given register within it's register class.
-# @return index or undef
-###
-sub get_reg_index {
- my $reg = shift;
- return $reg2class{"$reg"}{"index"} if (exists($reg2class{"$reg"}));
- return undef;
-}
-
-###
-# Generates the function for a given $op and a given IN-index
-# which returns a subset of possible register from a register class
-# @return classname from which the subset is derived or undef and
-# pos which corresponds to in/out reference position or undef
-###
-sub build_subset_class_func {
- my $neg = undef;
- my $class = undef;
- my $temp;
- my $has_limit = 0;
-
- # 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 $outin = $in ? "out" : "in";
- my @regs = split(/ /, shift);
-
- my @idx_class = build_inout_idx_class($n, $op, $outin);
-
- # 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";
- return (undef, undef, undef, undef);
- }
- $same = 0 if ($1);
- $class = $idx_class[$2 - 1];
- $pos = $in ? -$2 : $2 - 1;
- next CHECK_REQS;
- }
-
- # check for negate
- if (substr($_, 0, 1) eq "!") {
- if (defined($neg) && $neg == 0) {
- # we have seen a positiv constraint as first one but this one is negative
- # this doesn't make sense
- print STDERR "Mixed positive and negative constraints for the same slot are not allowed.\n";
- return (undef, undef, undef, undef);
- }
-
- 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 {
- if (defined($neg) && $neg == 1) {
- # we have seen a negative constraint as first one but this one is positive
- # this doesn't make sense
- print STDERR "Mixed positive and negative constraints for the same slot are not allowed.\n";
- 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");
- }
- $neg = 0;
- }
-
- # check if register belongs to one of the given classes
- $temp = get_reg_class($_);
- if (!defined($temp)) {
- print STDERR "Unknown register '$_'!\n";
- return (undef, undef, undef, undef);