From e44426021b5f23c05bcae04ee99d1e7afdd71b82 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Mon, 6 Dec 2010 19:01:56 +0000 Subject: [PATCH] Removed the arch_register_type_is() macro. Only makes it hard to search for arch_register_type_* flags. [r28185] --- ir/be/arm/arm_emitter.c | 2 +- ir/be/beabi.c | 17 ++++++++--------- ir/be/bearch.h | 9 --------- ir/be/bepeephole.c | 4 ++-- ir/be/bespill.c | 4 ++-- ir/be/beverify.c | 6 +++--- 6 files changed, 16 insertions(+), 26 deletions(-) diff --git a/ir/be/arm/arm_emitter.c b/ir/be/arm/arm_emitter.c index 92eba4009..febba2f04 100644 --- a/ir/be/arm/arm_emitter.c +++ b/ir/be/arm/arm_emitter.c @@ -84,7 +84,7 @@ static const arch_register_t *get_in_reg(const ir_node *irn, int pos) assert(reg && "no in register found"); /* in case of a joker register: just return a valid register */ - if (arch_register_type_is(reg, joker)) { + if (reg->type & arch_register_type_joker) { const arch_register_req_t *req = arch_get_register_req(irn, pos); if (arch_register_req_is(req, limited)) { diff --git a/ir/be/beabi.c b/ir/be/beabi.c index 567ac1fec..ffa46c192 100644 --- a/ir/be/beabi.c +++ b/ir/be/beabi.c @@ -526,15 +526,15 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp) if (reg == arch_env->sp || reg == arch_env->bp) continue; - if (arch_register_type_is(reg, state)) { + if (reg->type & arch_register_type_state) { ARR_APP1(const arch_register_t*, destroyed_regs, reg); ARR_APP1(const arch_register_t*, states, reg); /* we're already in the destroyed set so no need for further * checking */ continue; } - if (destroy_all_regs || arch_register_type_is(reg, caller_save)) { - if (! arch_register_type_is(reg, ignore)) { + if (destroy_all_regs || (reg->type & arch_register_type_caller_save)) { + if (!(reg->type & arch_register_type_ignore)) { ARR_APP1(const arch_register_t*, destroyed_regs, reg); } } @@ -1325,7 +1325,7 @@ static ir_node *create_be_return(be_abi_irg_t *env, ir_node *irn, ir_node *bl, /* Add uses of the callee save registers. */ foreach_pmap(env->regs, ent) { const arch_register_t *reg = (const arch_register_t*)ent->key; - if (arch_register_type_is(reg, callee_save) || arch_register_type_is(reg, ignore)) + if (reg->type & (arch_register_type_callee_save | arch_register_type_ignore)) pmap_insert(reg_map, ent->key, ent->value); } @@ -1840,8 +1840,7 @@ static void modify_irg(ir_graph *irg) const arch_register_class_t *cls = &arch_env->register_classes[i]; for (j = 0; j < cls->n_regs; ++j) { const arch_register_t *reg = &cls->regs[j]; - if (arch_register_type_is(reg, callee_save) || - arch_register_type_is(reg, state)) { + if (reg->type & (arch_register_type_callee_save | arch_register_type_state)) { pmap_insert(env->regs, (void *) reg, NULL); } } @@ -2005,7 +2004,7 @@ static void fix_call_state_inputs(ir_graph *irg) const arch_register_class_t *cls = &arch_env->register_classes[i]; for (j = 0; j < cls->n_regs; ++j) { const arch_register_t *reg = arch_register_for_index(cls, j); - if (arch_register_type_is(reg, state)) { + if (reg->type & arch_register_type_state) { ARR_APP1(arch_register_t*, stateregs, (arch_register_t *)reg); } } @@ -2323,14 +2322,14 @@ void be_set_allocatable_regs(const ir_graph *irg, ir_node *be_abi_get_callee_save_irn(be_abi_irg_t *abi, const arch_register_t *reg) { - assert(arch_register_type_is(reg, callee_save)); + assert(reg->type & arch_register_type_callee_save); assert(pmap_contains(abi->regs, (void *) reg)); return (ir_node*)pmap_get(abi->regs, (void *) reg); } ir_node *be_abi_get_ignore_irn(be_abi_irg_t *abi, const arch_register_t *reg) { - assert(arch_register_type_is(reg, ignore)); + assert(reg->type & arch_register_type_ignore); assert(pmap_contains(abi->regs, (void *) reg)); return (ir_node*)pmap_get(abi->regs, (void *) reg); } diff --git a/ir/be/bearch.h b/ir/be/bearch.h index 549092122..f6f133c43 100644 --- a/ir/be/bearch.h +++ b/ir/be/bearch.h @@ -262,15 +262,6 @@ static inline const char *arch_register_get_name(const arch_register_t *reg) return reg->name; } -/** - * Convenience macro to check for register type. - * @param req A pointer to register. - * @param kind The kind of type to check for (see arch_register_type_t). - * @return 1, If register is of given kind, 0 if not. - */ -#define arch_register_type_is(reg, kind) \ - (((reg)->type & arch_register_type_ ## kind) != 0) - /** * A class of registers. * Like general purpose or floating point. diff --git a/ir/be/bepeephole.c b/ir/be/bepeephole.c index 26a9c4a30..490bc92dc 100644 --- a/ir/be/bepeephole.c +++ b/ir/be/bepeephole.c @@ -62,7 +62,7 @@ static void clear_reg_value(ir_node *node) if (reg == NULL) { panic("No register assigned at %+F", node); } - if (arch_register_type_is(reg, virtual)) + if (reg->type & arch_register_type_virtual) return; cls = arch_register_get_class(reg); reg_idx = arch_register_get_index(reg); @@ -87,7 +87,7 @@ static void set_reg_value(ir_node *node) if (reg == NULL) { panic("No register assigned at %+F", node); } - if (arch_register_type_is(reg, virtual)) + if (reg->type & arch_register_type_virtual) return; cls = arch_register_get_class(reg); reg_idx = arch_register_get_index(reg); diff --git a/ir/be/bespill.c b/ir/be/bespill.c index b38967ad6..4eecd8eb6 100644 --- a/ir/be/bespill.c +++ b/ir/be/bespill.c @@ -87,8 +87,8 @@ static void prepare_constr_insn(be_pre_spill_env_t *env, ir_node *node) /* precolored with an ignore register (which is not a joker like unknown/noreg) */ - if (arch_register_type_is(reg, joker) - || rbitset_is_set(birg->allocatable_regs, reg->global_index)) + if ((reg->type & arch_register_type_joker) || + rbitset_is_set(birg->allocatable_regs, reg->global_index)) continue; if (! (req->type & arch_register_req_type_limited)) diff --git a/ir/be/beverify.c b/ir/be/beverify.c index f01d9aeae..a443aea4b 100644 --- a/ir/be/beverify.c +++ b/ir/be/beverify.c @@ -673,7 +673,7 @@ static void check_output_constraints(ir_node *node) ir_fprintf(stderr, "Verify warning: Node %+F in block %+F(%s) should have a register assigned\n", node, get_nodes_block(node), get_irg_dump_name(irg)); problem_found = 1; - } else if (!arch_register_type_is(reg, joker) && !arch_reg_out_is_allocatable(node, reg)) { + } else if (!(reg->type & arch_register_type_joker) && !arch_reg_out_is_allocatable(node, reg)) { ir_fprintf(stderr, "Verify warning: Register %s assigned as output of %+F not allowed (register constraint) in block %+F(%s)\n", reg->name, node, get_nodes_block(node), get_irg_dump_name(irg)); problem_found = 1; @@ -722,7 +722,7 @@ static void check_input_constraints(ir_node *node) pred, get_nodes_block(pred), get_irg_dump_name(irg), node); problem_found = 1; continue; - } else if (!arch_register_type_is(reg, joker) && ! arch_reg_is_allocatable(node, i, reg)) { + } else if (!(reg->type & arch_register_type_joker) && ! arch_reg_is_allocatable(node, i, reg)) { ir_fprintf(stderr, "Verify warning: Register %s as input %d of %+F not allowed (register constraint) in block %+F(%s)\n", reg->name, i, node, get_nodes_block(node), get_irg_dump_name(irg)); problem_found = 1; @@ -741,7 +741,7 @@ static void check_input_constraints(ir_node *node) ir_node *pred = get_Phi_pred(node, i); const arch_register_t *pred_reg = arch_get_irn_register(pred); - if (reg != pred_reg && !arch_register_type_is(pred_reg, joker)) { + if (reg != pred_reg && !(pred_reg->type & arch_register_type_joker)) { const char *pred_name = pred_reg != NULL ? pred_reg->name : "(null)"; const char *reg_name = reg != NULL ? reg->name : "(null)"; ir_fprintf(stderr, "Verify warning: Input %d of %+F in block %+F(%s) uses register %s instead of %s\n", -- 2.20.1