Commit f5bccf5d authored by Matthias Braun's avatar Matthias Braun
Browse files

get rid of arch_register_flags_t enum in favor of a simple bitfield

parent 7726c953
......@@ -20,13 +20,6 @@
#include "beinfo.h"
#include "be.h"
typedef enum arch_register_class_flags_t {
arch_register_class_flag_none = 0,
/** don't do automatic register allocation for this class */
arch_register_class_flag_manual_ra = 1U << 0,
} arch_register_class_flags_t;
ENUM_BITSET(arch_register_class_flags_t)
typedef enum arch_register_type_t {
arch_register_type_none = 0,
/** This is just a virtual register. Virtual registers fulfill any register
......@@ -209,14 +202,15 @@ struct arch_register_t {
* Like general purpose or floating point.
*/
struct arch_register_class_t {
const char *name; /**< The name of the register class.*/
ir_mode *mode; /**< The mode of the register class.*/
const arch_register_t *regs; /**< The array of registers. */
const arch_register_req_t *class_req;
unsigned index; /**< index of this register class */
unsigned n_regs; /**< Number of registers in this
class. */
arch_register_class_flags_t flags; /**< register class flags. */
const char *name; /**< The name of the register class.*/
ir_mode *mode; /**< The mode of the register class.*/
const arch_register_t *regs; /**< The array of registers. */
const arch_register_req_t *class_req;
unsigned index; /**< index of this register class */
unsigned n_regs; /**< Number of registers in this
class. */
/** don't do register allocation for this class */
bool manual_ra : 1;
};
static inline const arch_register_t *arch_register_for_index(
......
......@@ -289,7 +289,7 @@ static void be_ra_chordal_main(ir_graph *irg, const regalloc_if_t *regif)
arch_register_class_t const *const reg_classes = isa_if->register_classes;
for (int j = 0, m = isa_if->n_register_classes; j < m; ++j) {
arch_register_class_t const *const cls = &reg_classes[j];
if (cls->flags & arch_register_class_flag_manual_ra)
if (cls->manual_ra)
continue;
stat_ev_ctx_push_str("bechordal_cls", cls->name);
......
......@@ -1829,7 +1829,7 @@ static void be_pref_alloc(ir_graph *new_irg, const regalloc_if_t *regif)
arch_register_class_t const *const reg_classes = isa_if->register_classes;
for (int c = 0, n_cls = isa_if->n_register_classes; c < n_cls; ++c) {
cls = &reg_classes[c];
if (cls->flags & arch_register_class_flag_manual_ra)
if (cls->manual_ra)
continue;
stat_ev_ctx_push_str("regcls", cls->name);
......
......@@ -1116,7 +1116,7 @@ static void add_missing_keep_walker(ir_node *node, void *data)
for (unsigned i = 0; i < n_outs; ++i) {
arch_register_req_t const *const req = arch_get_irn_register_req_out(node, i);
arch_register_class_t const *const cls = req->cls;
if (cls && !(cls->flags & arch_register_class_flag_manual_ra)) {
if (cls && !cls->manual_ra) {
ir_node *value = existing_projs[i];
if (!value) {
value = new_r_Proj(node, cls->mode, i);
......@@ -1134,7 +1134,7 @@ static void add_missing_keep_walker(ir_node *node, void *data)
} else if (!is_Proj(node)) {
arch_register_req_t const *const req = arch_get_irn_register_req(node);
arch_register_class_t const *const cls = req->cls;
if (cls && !(cls->flags & arch_register_class_flag_manual_ra)) {
if (cls && !cls->manual_ra) {
if (!has_real_user(node)) {
ir_node *const keep = be_new_Keep_one(node);
sched_add_after(node, keep);
......
......@@ -117,7 +117,6 @@ foreach my $class_name (sort(keys(%reg_classes))) {
$class_ptr = "&".$arch."_reg_classes[CLASS_".$class_name."]";
my $flags = pop(@class);
my $class_mode = $flags->{"mode"};
my $flags_prepared = map_flags("arch_register_class_flag_", $flags->{"flags"});
$single_constraints .= <<EOF;
const arch_register_req_t ${arch}_class_reg_req_${old_classname} = {
......@@ -133,6 +132,13 @@ EOF
$classdef .= "\tCLASS_$class_name = $class_idx,\n";
my $numregs = @class;
my $manual_ra;
$manual_ra = "false";
for ($flags->{"flags"}) {
if (defined($_) && $_ eq "manual_ra") {
$manual_ra = "true";
}
}
my $first_reg = "&${arch}_registers[REG_". uc($class[0]->{"name"}) . "]";
my $rcdef = <<EOF;
{
......@@ -142,7 +148,7 @@ EOF
.class_req = &${arch}_class_reg_req_${old_classname},
.index = $class_idx,
.n_regs = $numregs,
.flags = $flags_prepared,
.manual_ra = ${manual_ra},
},
EOF
push(@regclasses, $rcdef);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment