# 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;
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");
}
$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,
$regdef .= "\tREG_${ucname},\n";
$regdef2 .= "\tREG_${classuc}_${ucname} = $idx,\n";
+ my $dwarf_number = 0;
+ if (defined($_->{dwarf})) {
+ $dwarf_number = $_->{dwarf};
+ }
$regtypes_def .= <<EOF;
{
REG_${classuc}_${ucname},
REG_${ucname},
${type},
- &${arch}_single_reg_req_${old_classname}_${name}
+ &${arch}_single_reg_req_${old_classname}_${name},
+ ${dwarf_number}
},
EOF
#ifndef FIRM_BE_${archuc}_GEN_${archuc}_REGALLOC_IF_H
#define FIRM_BE_${archuc}_GEN_${archuc}_REGALLOC_IF_H
-#include "../bearch.h"
+#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}
};
extern arch_register_class_t ${arch}_reg_classes[N_${archuc}_CLASSES];
void ${arch}_register_init(void);
-unsigned ${arch}_get_n_regs(void);
#endif
EOF
#include "config.h"
#include "gen_${arch}_regalloc_if.h"
-#include "gen_${arch}_machine.h"
#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}
}
EOF
close(OUT);
-
-###
-# 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 $name;
-}