sparc: fix mode of fdiv result
[libfirm] / ir / be / scripts / generate_regalloc_if.pl
index 87714c9..284ca6b 100755 (executable)
@@ -61,26 +61,18 @@ sub translate_reg_type {
                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) {
+               if ($t & 2) {
                        push(@types, "arch_register_type_joker");
                }
 
-               if ($t & 16) {
+               if ($t & 4) {
                        push(@types, "arch_register_type_virtual");
                }
 
-               if ($t & 32) {
+               if ($t & 8) {
                        push(@types, "arch_register_type_state");
                }
 
@@ -181,13 +173,9 @@ foreach my $class_name (keys(%reg_classes)) {
                        $flags_prepared .= "arch_register_class_flag_$flag";
                }
        } else {
-               $flags_prepared = "0";
+               $flags_prepared = "arch_register_class_flag_none";
        }
 
-       $single_constraints_decls .= <<EOF;
-static const arch_register_req_t ${arch}_class_reg_req_${old_classname};
-EOF
-
        $single_constraints .= <<EOF;
 static const arch_register_req_t ${arch}_class_reg_req_${old_classname} = {
        arch_register_req_type_normal,
@@ -208,9 +196,10 @@ EOF
        $reginit .= "\t$arch\_reg_classes[CLASS_".$class_name."].mode = $class_mode;\n";
        my $lastreg;
        foreach (@class) {
-               my $name = $_->{"name"};
+               my $name   = $_->{"name"};
                my $ucname = uc($name);
-               my $type = translate_reg_type($_->{"type"});
+               my $type   = "arch_register_type_none";
+               $type = translate_reg_type($_->{"type"}) if (exists($_->{"type"}));
                # realname is name if not set by user
                $_->{"realname"} = $_->{"name"} if (! exists($_->{"realname"}));
                my $realname = $_->{realname};
@@ -276,14 +265,17 @@ print OUT<<EOF;
 #include "../bearch.h"
 #include "${arch}_nodes_attr.h"
 
+/** global register indices for ${arch} registers */
 enum reg_indices {
 ${regdef}
        N_${archuc}_REGISTERS
 };
+/** local register indices for ${arch} registers */
 enum {
 ${regdef2}
 };
 
+/** number of registers in ${arch} register classes. */
 enum {
 ${regcounts}
 };
@@ -294,7 +286,6 @@ extern const arch_register_t ${arch}_registers[N_${archuc}_REGISTERS];
 extern arch_register_class_t ${arch}_reg_classes[N_${archuc}_CLASSES];
 
 void ${arch}_register_init(void);
-unsigned ${arch}_get_n_regs(void);
 
 #endif
 EOF
@@ -324,18 +315,21 @@ print OUT<<EOF;
 #include "bearch_${arch}_t.h"
 #include "irmode.h"
 
-${single_constraints_decls}
+${single_constraints}
 EOF
 
 print OUT "arch_register_class_t ${arch}_reg_classes[] = {\n\t".join(",\n\t", @regclasses)."\n};\n\n";
 
 print OUT<<EOF;
-${single_constraints}
 
+/** The array of all registers in the ${arch} architecture, sorted by its global index.*/
 const arch_register_t ${arch}_registers[] = {
 ${regtypes_def}
 };
 
+/**
+ * Initializes ${arch} register classes.
+ */
 void ${arch}_register_init(void)
 {
 ${reginit}