From c23b55879df97f49fc6f1e95651f9f28a980b620 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Fri, 23 May 2008 17:52:54 +0000 Subject: [PATCH] we don't need no stinking selfs [r19739] --- ir/be/TEMPLATE/bearch_TEMPLATE.c | 39 ++++++++----------- ir/be/arm/bearch_arm.c | 32 +++++----------- ir/be/bearch.c | 34 ++++++++-------- ir/be/bearch_t.h | 27 +++++++------ ir/be/benode.c | 66 +++++++++----------------------- ir/be/ia32/bearch_ia32.c | 52 ++++++++----------------- ir/be/mips/bearch_mips.c | 39 +++++++------------ ir/be/ppc32/bearch_ppc32.c | 39 +++++++++---------- 8 files changed, 125 insertions(+), 203 deletions(-) diff --git a/ir/be/TEMPLATE/bearch_TEMPLATE.c b/ir/be/TEMPLATE/bearch_TEMPLATE.c index c1fd4b6f6..5f40b135f 100644 --- a/ir/be/TEMPLATE/bearch_TEMPLATE.c +++ b/ir/be/TEMPLATE/bearch_TEMPLATE.c @@ -72,12 +72,11 @@ static set *cur_reg_set = NULL; * If the node returns a tuple (mode_T) then the proj's * will be asked for this information. */ -static const -arch_register_req_t *TEMPLATE_get_irn_reg_req(const void *self, - const ir_node *node, int pos) { +static const arch_register_req_t *TEMPLATE_get_irn_reg_req(const ir_node *node, + int pos) +{ long node_pos = pos == -1 ? 0 : pos; ir_mode *mode = get_irn_mode(node); - (void) self; if (mode == mode_T || mode == mode_M) { return arch_no_register_req; @@ -115,10 +114,9 @@ arch_register_req_t *TEMPLATE_get_irn_reg_req(const void *self, return arch_no_register_req; } -static void TEMPLATE_set_irn_reg(const void *self, ir_node *irn, const arch_register_t *reg) +static void TEMPLATE_set_irn_reg(ir_node *irn, const arch_register_t *reg) { int pos = 0; - (void) self; if (is_Proj(irn)) { pos = TEMPLATE_translate_proj_pos(irn); @@ -137,13 +135,10 @@ static void TEMPLATE_set_irn_reg(const void *self, ir_node *irn, const arch_regi } } -static -const arch_register_t *TEMPLATE_get_irn_reg(const void *self, - const ir_node *irn) +static const arch_register_t *TEMPLATE_get_irn_reg(const ir_node *irn) { int pos = 0; const arch_register_t *reg = NULL; - (void) self; if (is_Proj(irn)) { pos = TEMPLATE_translate_proj_pos(irn); @@ -162,9 +157,9 @@ const arch_register_t *TEMPLATE_get_irn_reg(const void *self, return reg; } -static arch_irn_class_t TEMPLATE_classify(const void *self, const ir_node *irn) { +static arch_irn_class_t TEMPLATE_classify(const ir_node *irn) +{ irn = skip_Proj_const(irn); - (void) self; if (is_cfop(irn)) { return arch_irn_class_branch; @@ -176,9 +171,9 @@ static arch_irn_class_t TEMPLATE_classify(const void *self, const ir_node *irn) return 0; } -static arch_irn_flags_t TEMPLATE_get_flags(const void *self, const ir_node *irn) { +static arch_irn_flags_t TEMPLATE_get_flags(const ir_node *irn) +{ irn = skip_Proj_const(irn); - (void) self; if (is_TEMPLATE_irn(irn)) { return get_TEMPLATE_flags(irn); @@ -190,15 +185,15 @@ static arch_irn_flags_t TEMPLATE_get_flags(const void *self, const ir_node *irn) return 0; } -static ir_entity *TEMPLATE_get_frame_entity(const void *self, const ir_node *node) { - (void) self; +static ir_entity *TEMPLATE_get_frame_entity(const ir_node *node) +{ (void) node; /* TODO: return the ir_entity assigned to the frame */ return NULL; } -static void TEMPLATE_set_frame_entity(const void *self, ir_node *node, ir_entity *ent) { - (void) self; +static void TEMPLATE_set_frame_entity(ir_node *node, ir_entity *ent) +{ (void) node; (void) ent; /* TODO: set the ir_entity assigned to the frame */ @@ -208,15 +203,15 @@ static void TEMPLATE_set_frame_entity(const void *self, ir_node *node, ir_entity * This function is called by the generic backend to correct offsets for * nodes accessing the stack. */ -static void TEMPLATE_set_frame_offset(const void *self, ir_node *irn, int offset) { - (void) self; +static void TEMPLATE_set_frame_offset(ir_node *irn, int offset) +{ (void) irn; (void) offset; /* TODO: correct offset if irn accesses the stack */ } -static int TEMPLATE_get_sp_bias(const void *self, const ir_node *irn) { - (void) self; +static int TEMPLATE_get_sp_bias(const ir_node *irn) +{ (void) irn; return 0; } diff --git a/ir/be/arm/bearch_arm.c b/ir/be/arm/bearch_arm.c index fbb341ab7..63dcbed26 100644 --- a/ir/be/arm/bearch_arm.c +++ b/ir/be/arm/bearch_arm.c @@ -86,13 +86,11 @@ static set *cur_reg_set = NULL; * If the node returns a tuple (mode_T) then the proj's * will be asked for this information. */ -static const -arch_register_req_t *arm_get_irn_reg_req(const void *self, const ir_node *node, - int pos) +static const arch_register_req_t *arm_get_irn_reg_req(const ir_node *node, + int pos) { long node_pos = pos == -1 ? 0 : pos; ir_mode *mode = get_irn_mode(node); - (void) self; if (is_Block(node) || mode == mode_X) { return arch_no_register_req; @@ -131,11 +129,9 @@ arch_register_req_t *arm_get_irn_reg_req(const void *self, const ir_node *node, return arch_no_register_req; } -static void arm_set_irn_reg(const void *self, ir_node *irn, - const arch_register_t *reg) +static void arm_set_irn_reg(ir_node *irn, const arch_register_t *reg) { int pos = 0; - (void) self; if (get_irn_mode(irn) == mode_X) { return; @@ -158,12 +154,10 @@ static void arm_set_irn_reg(const void *self, ir_node *irn, } } -static const arch_register_t *arm_get_irn_reg(const void *self, - const ir_node *irn) +static const arch_register_t *arm_get_irn_reg(const ir_node *irn) { int pos = 0; const arch_register_t *reg = NULL; - (void) self; if (is_Proj(irn)) { @@ -187,9 +181,8 @@ static const arch_register_t *arm_get_irn_reg(const void *self, return reg; } -static arch_irn_class_t arm_classify(const void *self, const ir_node *irn) +static arch_irn_class_t arm_classify(const ir_node *irn) { - (void) self; irn = skip_Proj_const(irn); if (is_cfop(irn)) { @@ -202,10 +195,9 @@ static arch_irn_class_t arm_classify(const void *self, const ir_node *irn) return 0; } -static arch_irn_flags_t arm_get_flags(const void *self, const ir_node *irn) +static arch_irn_flags_t arm_get_flags(const ir_node *irn) { arch_irn_flags_t flags = arch_irn_flags_none; - (void) self; if(is_Unknown(irn)) { return arch_irn_flags_ignore; @@ -226,17 +218,15 @@ static arch_irn_flags_t arm_get_flags(const void *self, const ir_node *irn) return flags; } -static ir_entity *arm_get_frame_entity(const void *self, const ir_node *irn) +static ir_entity *arm_get_frame_entity(const ir_node *irn) { - (void) self; (void) irn; /* TODO: return the entity assigned to the frame */ return NULL; } -static void arm_set_frame_entity(const void *self, ir_node *irn, ir_entity *ent) +static void arm_set_frame_entity(ir_node *irn, ir_entity *ent) { - (void) self; (void) irn; (void) ent; /* TODO: set the entity assigned to the frame */ @@ -246,17 +236,15 @@ static void arm_set_frame_entity(const void *self, ir_node *irn, ir_entity *ent) * This function is called by the generic backend to correct offsets for * nodes accessing the stack. */ -static void arm_set_stack_bias(const void *self, ir_node *irn, int bias) +static void arm_set_stack_bias(ir_node *irn, int bias) { - (void) self; (void) irn; (void) bias; /* TODO: correct offset if irn accesses the stack */ } -static int arm_get_sp_bias(const void *self, const ir_node *irn) +static int arm_get_sp_bias(const ir_node *irn) { - (void) self; (void) irn; return 0; } diff --git a/ir/be/bearch.c b/ir/be/bearch.c index 71e703dcf..8aeb0c617 100644 --- a/ir/be/bearch.c +++ b/ir/be/bearch.c @@ -94,31 +94,31 @@ const arch_register_req_t *arch_get_register_req(const arch_env_t *env, const ir_node *irn, int pos) { const arch_irn_ops_t *ops = get_irn_ops(env, irn); - return ops->get_irn_reg_req(ops, irn, pos); + return ops->get_irn_reg_req(irn, pos); } void arch_set_frame_offset(const arch_env_t *env, ir_node *irn, int offset) { const arch_irn_ops_t *ops = get_irn_ops(env, irn); - ops->set_frame_offset(ops, irn, offset); + ops->set_frame_offset(irn, offset); } ir_entity *arch_get_frame_entity(const arch_env_t *env, const ir_node *irn) { const arch_irn_ops_t *ops = get_irn_ops(env, irn); - return ops->get_frame_entity(ops, irn); + return ops->get_frame_entity(irn); } void arch_set_frame_entity(const arch_env_t *env, ir_node *irn, ir_entity *ent) { const arch_irn_ops_t *ops = get_irn_ops(env, irn); - ops->set_frame_entity(ops, irn, ent); + ops->set_frame_entity(irn, ent); } int arch_get_sp_bias(const arch_env_t *env, ir_node *irn) { const arch_irn_ops_t *ops = get_irn_ops(env, irn); - return ops->get_sp_bias(ops, irn); + return ops->get_sp_bias(irn); } arch_inverse_t *arch_get_inverse(const arch_env_t *env, const ir_node *irn, int i, arch_inverse_t *inverse, struct obstack *obstack) @@ -126,7 +126,7 @@ arch_inverse_t *arch_get_inverse(const arch_env_t *env, const ir_node *irn, int const arch_irn_ops_t *ops = get_irn_ops(env, irn); if(ops->get_inverse) { - return ops->get_inverse(ops, irn, i, inverse, obstack); + return ops->get_inverse(irn, i, inverse, obstack); } else { return NULL; } @@ -136,7 +136,7 @@ int arch_possible_memory_operand(const arch_env_t *env, const ir_node *irn, unsi const arch_irn_ops_t *ops = get_irn_ops(env, irn); if(ops->possible_memory_operand) { - return ops->possible_memory_operand(ops, irn, i); + return ops->possible_memory_operand(irn, i); } else { return 0; } @@ -146,7 +146,7 @@ void arch_perform_memory_operand(const arch_env_t *env, ir_node *irn, ir_node *s const arch_irn_ops_t *ops = get_irn_ops(env, irn); if(ops->perform_memory_operand) { - ops->perform_memory_operand(ops, irn, spill, i); + ops->perform_memory_operand(irn, spill, i); } else { return; } @@ -157,7 +157,7 @@ int arch_get_op_estimated_cost(const arch_env_t *env, const ir_node *irn) const arch_irn_ops_t *ops = get_irn_ops(env, irn); if(ops->get_op_estimated_cost) { - return ops->get_op_estimated_cost(ops, irn); + return ops->get_op_estimated_cost(irn); } else { return 1; } @@ -168,7 +168,7 @@ int arch_is_possible_memory_operand(const arch_env_t *env, const ir_node *irn, i const arch_irn_ops_t *ops = get_irn_ops(env, irn); if(ops->possible_memory_operand) { - return ops->possible_memory_operand(ops, irn, i); + return ops->possible_memory_operand(irn, i); } else { return 0; } @@ -177,7 +177,7 @@ int arch_is_possible_memory_operand(const arch_env_t *env, const ir_node *irn, i int arch_get_allocatable_regs(const arch_env_t *env, const ir_node *irn, int pos, bitset_t *bs) { const arch_irn_ops_t *ops = get_irn_ops(env, irn); - const arch_register_req_t *req = ops->get_irn_reg_req(ops, irn, pos); + const arch_register_req_t *req = ops->get_irn_reg_req(irn, pos); if(req->type == arch_register_req_type_none) { bitset_clear_all(bs); @@ -224,7 +224,7 @@ int arch_is_register_operand(const arch_env_t *env, const ir_node *irn, int pos) { const arch_irn_ops_t *ops = get_irn_ops(env, irn); - const arch_register_req_t *req = ops->get_irn_reg_req(ops, irn, pos); + const arch_register_req_t *req = ops->get_irn_reg_req(irn, pos); return req != NULL; } @@ -251,7 +251,7 @@ const arch_register_class_t * arch_get_irn_reg_class(const arch_env_t *env, const ir_node *irn, int pos) { const arch_irn_ops_t *ops = get_irn_ops(env, irn); - const arch_register_req_t *req = ops->get_irn_reg_req(ops, irn, pos); + const arch_register_req_t *req = ops->get_irn_reg_req(irn, pos); assert(req->type != arch_register_req_type_none || req->cls == NULL); @@ -262,26 +262,26 @@ extern const arch_register_t * arch_get_irn_register(const arch_env_t *env, const ir_node *irn) { const arch_irn_ops_t *ops = get_irn_ops(env, irn); - return ops->get_irn_reg(ops, irn); + return ops->get_irn_reg(irn); } extern void arch_set_irn_register(const arch_env_t *env, ir_node *irn, const arch_register_t *reg) { const arch_irn_ops_t *ops = get_irn_ops(env, irn); - ops->set_irn_reg(ops, irn, reg); + ops->set_irn_reg(irn, reg); } extern arch_irn_class_t arch_irn_classify(const arch_env_t *env, const ir_node *irn) { const arch_irn_ops_t *ops = get_irn_ops(env, irn); - return ops->classify(ops, irn); + return ops->classify(irn); } extern arch_irn_flags_t arch_irn_get_flags(const arch_env_t *env, const ir_node *irn) { const arch_irn_ops_t *ops = get_irn_ops(env, irn); - return ops->get_flags(ops, irn); + return ops->get_flags(irn); } extern const char *arch_irn_flag_str(arch_irn_flags_t fl) diff --git a/ir/be/bearch_t.h b/ir/be/bearch_t.h index 0ed5c67e8..bbdd35c5a 100644 --- a/ir/be/bearch_t.h +++ b/ir/be/bearch_t.h @@ -190,8 +190,7 @@ struct arch_irn_ops_t { * @return The register requirements for the selected operand. * The pointer returned is never NULL. */ - const arch_register_req_t *(*get_irn_reg_req)(const void *self, - const ir_node *irn, int pos); + const arch_register_req_t *(*get_irn_reg_req)(const ir_node *irn, int pos); /** * Set the register for an output operand. @@ -200,7 +199,7 @@ struct arch_irn_ops_t { * @note If the operand is not a register operand, * the call is ignored. */ - void (*set_irn_reg)(const void *self, ir_node *irn, const arch_register_t *reg); + void (*set_irn_reg)(ir_node *irn, const arch_register_t *reg); /** * Get the register allocated for an output operand. @@ -210,14 +209,14 @@ struct arch_irn_ops_t { * @c arch_register_invalid, if no register has yet been * allocated for this node. */ - const arch_register_t *(*get_irn_reg)(const void *self, const ir_node *irn); + const arch_register_t *(*get_irn_reg)(const ir_node *irn); /** * Classify the node. * @param irn The node. * @return A classification. */ - arch_irn_class_t (*classify)(const void *self, const ir_node *irn); + arch_irn_class_t (*classify)(const ir_node *irn); /** * Get the flags of a node. @@ -225,7 +224,7 @@ struct arch_irn_ops_t { * @param irn The node. * @return A set of flags. */ - arch_irn_flags_t (*get_flags)(const void *self, const ir_node *irn); + arch_irn_flags_t (*get_flags)(const ir_node *irn); /** * Get the entity on the stack frame this node depends on. @@ -234,7 +233,7 @@ struct arch_irn_ops_t { * @return The entity on the stack frame or NULL, if the node does not have a * stack frame entity. */ - ir_entity *(*get_frame_entity)(const void *self, const ir_node *irn); + ir_entity *(*get_frame_entity)(const ir_node *irn); /** * Set the entity on the stack frame this node depends on. @@ -242,7 +241,7 @@ struct arch_irn_ops_t { * @param irn The node in question. * @param ent The entity to set */ - void (*set_frame_entity)(const void *self, ir_node *irn, ir_entity *ent); + void (*set_frame_entity)(ir_node *irn, ir_entity *ent); /** * Set the offset of a node carrying an entity on the stack frame. @@ -250,7 +249,7 @@ struct arch_irn_ops_t { * @param irn The node. * @param offset The offset of the node's stack frame entity. */ - void (*set_frame_offset)(const void *self, ir_node *irn, int offset); + void (*set_frame_offset)(ir_node *irn, int offset); /** * Returns the delta of the stackpointer for nodes that increment or @@ -264,7 +263,7 @@ struct arch_irn_ops_t { * @return 0 if the stackpointer is not modified with a constant * value, otherwise the increment/decrement value */ - int (*get_sp_bias)(const void *self, const ir_node *irn); + int (*get_sp_bias)(const ir_node *irn); /** * Returns an inverse operation which yields the i-th argument @@ -277,7 +276,7 @@ struct arch_irn_ops_t { * @param obstack The obstack to use for allocation of the returned nodes array * @return The inverse operation or NULL if operation invertible */ - arch_inverse_t *(*get_inverse)(const void *self, const ir_node *irn, int i, arch_inverse_t *inverse, struct obstack *obstack); + arch_inverse_t *(*get_inverse)(const ir_node *irn, int i, arch_inverse_t *inverse, struct obstack *obstack); /** * Get the estimated cycle count for @p irn. @@ -287,7 +286,7 @@ struct arch_irn_ops_t { * * @return The estimated cycle count for this operation */ - int (*get_op_estimated_cost)(const void *self, const ir_node *irn); + int (*get_op_estimated_cost)(const ir_node *irn); /** * Asks the backend whether operand @p i of @p irn can be loaded form memory internally @@ -298,7 +297,7 @@ struct arch_irn_ops_t { * * @return nonzero if argument can be loaded or zero otherwise */ - int (*possible_memory_operand)(const void *self, const ir_node *irn, unsigned int i); + int (*possible_memory_operand)(const ir_node *irn, unsigned int i); /** * Ask the backend to assimilate @p reload of operand @p i into @p irn. @@ -308,7 +307,7 @@ struct arch_irn_ops_t { * @param spill The spill. * @param i The position of the reload. */ - void (*perform_memory_operand)(const void *self, ir_node *irn, ir_node *spill, unsigned int i); + void (*perform_memory_operand)(ir_node *irn, ir_node *spill, unsigned int i); }; /** diff --git a/ir/be/benode.c b/ir/be/benode.c index 4199e8f56..91d021b86 100644 --- a/ir/be/benode.c +++ b/ir/be/benode.c @@ -358,10 +358,9 @@ static be_reg_data_t *retrieve_reg_data(const ir_node *node) } static void -be_node_set_irn_reg(const void *self, ir_node *irn, const arch_register_t *reg) +be_node_set_irn_reg(ir_node *irn, const arch_register_t *reg) { be_reg_data_t *r = retrieve_reg_data(irn); - (void) self; r->reg = reg; } @@ -690,7 +689,7 @@ ir_node *be_new_IncSP(const arch_register_t *sp, ir_graph *irg, ir_node *bl, /* Set output constraint to stack register. */ be_node_set_reg_class(irn, 0, sp->reg_class); be_set_constr_single_reg(irn, BE_OUT_POS(0), sp); - be_node_set_irn_reg(NULL, irn, sp); + be_node_set_irn_reg(irn, sp); return irn; } @@ -1121,11 +1120,10 @@ arch_register_req_t *get_in_reg_req(const ir_node *irn, int pos) } static const arch_register_req_t * -be_node_get_irn_reg_req(const void *self, const ir_node *irn, int pos) +be_node_get_irn_reg_req(const ir_node *irn, int pos) { int out_pos = pos; - (void) self; if (pos < 0) { if (get_irn_mode(irn) == mode_T) return arch_no_register_req; @@ -1149,21 +1147,18 @@ be_node_get_irn_reg_req(const void *self, const ir_node *irn, int pos) } const arch_register_t * -be_node_get_irn_reg(const void *self, const ir_node *irn) +be_node_get_irn_reg(const ir_node *irn) { be_reg_data_t *r; - (void) self; if (get_irn_mode(irn) == mode_T) return NULL; r = retrieve_reg_data(irn); return r->reg; } -static arch_irn_class_t be_node_classify(const void *self, const ir_node *irn) +static arch_irn_class_t be_node_classify(const ir_node *irn) { - (void) self; - restart: switch (get_irn_opcode(irn)) { #define XXX(a,b) case a: return b @@ -1188,11 +1183,10 @@ restart: return 0; } -static arch_irn_flags_t be_node_get_flags(const void *self, const ir_node *node) +static arch_irn_flags_t be_node_get_flags(const ir_node *node) { be_req_t *bereq; int pos = -1; - (void) self; if(is_Proj(node)) { pos = OUT_POS(get_Proj_proj(node)); @@ -1204,16 +1198,14 @@ static arch_irn_flags_t be_node_get_flags(const void *self, const ir_node *node) return bereq->flags; } -static ir_entity *be_node_get_frame_entity(const void *self, const ir_node *irn) +static ir_entity *be_node_get_frame_entity(const ir_node *irn) { - (void) self; return be_get_frame_entity(irn); } -static void be_node_set_frame_entity(const void *self, ir_node *irn, ir_entity *ent) +static void be_node_set_frame_entity(ir_node *irn, ir_entity *ent) { be_frame_attr_t *a; - (void) self; assert(be_has_frame_entity(irn)); @@ -1221,18 +1213,16 @@ static void be_node_set_frame_entity(const void *self, ir_node *irn, ir_entity * a->ent = ent; } -static void be_node_set_frame_offset(const void *self, ir_node *irn, int offset) +static void be_node_set_frame_offset(ir_node *irn, int offset) { - (void) self; if(be_has_frame_entity(irn)) { be_frame_attr_t *a = get_irn_attr(irn); a->offset = offset; } } -static int be_node_get_sp_bias(const void *self, const ir_node *irn) +static int be_node_get_sp_bias(const ir_node *irn) { - (void) self; if(be_is_IncSP(irn)) return be_get_IncSP_offset(irn); if(be_is_Call(irn)) @@ -1346,11 +1336,9 @@ const arch_register_req_t *get_Phi_reg_req_recursive(const ir_node *phi, } static -const arch_register_req_t *phi_get_irn_reg_req(const void *self, - const ir_node *irn, int pos) +const arch_register_req_t *phi_get_irn_reg_req(const ir_node *irn, int pos) { phi_attr_t *attr; - (void) self; (void) pos; if(!mode_is_datab(get_irn_mode(irn))) @@ -1398,68 +1386,52 @@ void be_set_phi_flags(const arch_env_t *arch_env, ir_node *node, attr->flags = flags; } -static -void phi_set_irn_reg(const void *self, ir_node *irn, const arch_register_t *reg) +static void phi_set_irn_reg(ir_node *irn, const arch_register_t *reg) { phi_attr_t *attr = get_Phi_attr(irn); - (void) self; attr->reg = reg; } -static -const arch_register_t *phi_get_irn_reg(const void *self, const ir_node *irn) +static const arch_register_t *phi_get_irn_reg(const ir_node *irn) { phi_attr_t *attr = get_Phi_attr(irn); - (void) self; return attr->reg; } -static -arch_irn_class_t phi_classify(const void *self, const ir_node *irn) +static arch_irn_class_t phi_classify(const ir_node *irn) { - (void) self; (void) irn; return arch_irn_class_normal; } -static -arch_irn_flags_t phi_get_flags(const void *self, const ir_node *irn) +static arch_irn_flags_t phi_get_flags(const ir_node *irn) { phi_attr_t *attr = get_Phi_attr(irn); - (void) self; return attr->flags; } -static -ir_entity *phi_get_frame_entity(const void *self, const ir_node *irn) +static ir_entity *phi_get_frame_entity(const ir_node *irn) { - (void) self; (void) irn; return NULL; } -static -void phi_set_frame_entity(const void *self, ir_node *irn, ir_entity *ent) +static void phi_set_frame_entity(ir_node *irn, ir_entity *ent) { - (void) self; (void) irn; (void) ent; assert(0); } -static -void phi_set_frame_offset(const void *self, ir_node *irn, int bias) +static void phi_set_frame_offset(ir_node *irn, int bias) { - (void) self; (void) irn; (void) bias; assert(0); } -static -int phi_get_sp_bias(const void* self, const ir_node *irn) +static int phi_get_sp_bias(const ir_node *irn) { - (void) self; (void) irn; return 0; } diff --git a/ir/be/ia32/bearch_ia32.c b/ir/be/ia32/bearch_ia32.c index 9a6bc626e..805d1d2ac 100644 --- a/ir/be/ia32/bearch_ia32.c +++ b/ir/be/ia32/bearch_ia32.c @@ -210,14 +210,12 @@ ir_node *ia32_get_admissible_noreg(ia32_code_gen_t *cg, ir_node *irn, int pos) { * If the node returns a tuple (mode_T) then the proj's * will be asked for this information. */ -static const arch_register_req_t *ia32_get_irn_reg_req(const void *self, - const ir_node *node, +static const arch_register_req_t *ia32_get_irn_reg_req(const ir_node *node, int pos) { ir_mode *mode = get_irn_mode(node); long node_pos; - (void)self; if (mode == mode_X || is_Block(node)) { return arch_no_register_req; } @@ -253,11 +251,9 @@ static const arch_register_req_t *ia32_get_irn_reg_req(const void *self, return arch_no_register_req; } -static void ia32_set_irn_reg(const void *self, ir_node *irn, - const arch_register_t *reg) +static void ia32_set_irn_reg(ir_node *irn, const arch_register_t *reg) { int pos = 0; - (void) self; if (get_irn_mode(irn) == mode_X) { return; @@ -278,12 +274,10 @@ static void ia32_set_irn_reg(const void *self, ir_node *irn, } } -static const arch_register_t *ia32_get_irn_reg(const void *self, - const ir_node *irn) +static const arch_register_t *ia32_get_irn_reg(const ir_node *irn) { int pos = 0; const arch_register_t *reg = NULL; - (void) self; if (is_Proj(irn)) { @@ -307,9 +301,8 @@ static const arch_register_t *ia32_get_irn_reg(const void *self, return reg; } -static arch_irn_class_t ia32_classify(const void *self, const ir_node *irn) { +static arch_irn_class_t ia32_classify(const ir_node *irn) { arch_irn_class_t classification = arch_irn_class_normal; - (void) self; irn = skip_Proj_const(irn); @@ -331,9 +324,8 @@ static arch_irn_class_t ia32_classify(const void *self, const ir_node *irn) { return classification; } -static arch_irn_flags_t ia32_get_flags(const void *self, const ir_node *irn) { +static arch_irn_flags_t ia32_get_flags(const ir_node *irn) { arch_irn_flags_t flags = arch_irn_flags_none; - (void) self; if (is_Unknown(irn)) return arch_irn_flags_ignore; @@ -365,20 +357,16 @@ typedef struct { ir_graph *irg; /**< The associated graph. */ } ia32_abi_env_t; -static ir_entity *ia32_get_frame_entity(const void *self, const ir_node *irn) { - (void) self; +static ir_entity *ia32_get_frame_entity(const ir_node *irn) { return is_ia32_irn(irn) ? get_ia32_frame_ent(irn) : NULL; } -static void ia32_set_frame_entity(const void *self, ir_node *irn, ir_entity *ent) { - (void) self; +static void ia32_set_frame_entity(ir_node *irn, ir_entity *ent) { set_ia32_frame_ent(irn, ent); } -static void ia32_set_frame_offset(const void *self, ir_node *irn, int bias) +static void ia32_set_frame_offset(ir_node *irn, int bias) { - (void) self; - if (get_ia32_frame_ent(irn) == NULL) return; @@ -395,10 +383,8 @@ static void ia32_set_frame_offset(const void *self, ir_node *irn, int bias) add_ia32_am_offs_int(irn, bias); } -static int ia32_get_sp_bias(const void *self, const ir_node *node) +static int ia32_get_sp_bias(const ir_node *node) { - (void) self; - if (is_ia32_Push(node)) return 4; @@ -614,11 +600,10 @@ static ir_type *ia32_abi_get_between_type(void *self) * * @return The estimated cycle count for this operation */ -static int ia32_get_op_estimated_cost(const void *self, const ir_node *irn) +static int ia32_get_op_estimated_cost(const ir_node *irn) { int cost; ia32_op_type_t op_tp; - (void) self; if (is_Proj(irn)) return 0; @@ -665,13 +650,12 @@ static int ia32_get_op_estimated_cost(const void *self, const ir_node *irn) * @param obstack The obstack to use for allocation of the returned nodes array * @return The inverse operation or NULL if operation invertible */ -static arch_inverse_t *ia32_get_inverse(const void *self, const ir_node *irn, int i, arch_inverse_t *inverse, struct obstack *obst) { +static arch_inverse_t *ia32_get_inverse(const ir_node *irn, int i, arch_inverse_t *inverse, struct obstack *obst) { ir_graph *irg; ir_mode *mode; ir_mode *irn_mode; ir_node *block, *noreg, *nomem; dbg_info *dbg; - (void) self; /* we cannot invert non-ia32 irns */ if (! is_ia32_irn(irn)) @@ -820,11 +804,10 @@ static int ia32_is_spillmode_compatible(const ir_mode *mode, const ir_mode *spil * @param i The operands position * @return Non-Zero if operand can be loaded */ -static int ia32_possible_memory_operand(const void *self, const ir_node *irn, unsigned int i) { +static int ia32_possible_memory_operand(const ir_node *irn, unsigned int i) { ir_node *op = get_irn_n(irn, i); const ir_mode *mode = get_irn_mode(op); const ir_mode *spillmode = get_spill_mode(op); - (void) self; if ( (i != n_ia32_binary_left && i != n_ia32_binary_right) || /* a "real" operand position must be requested */ @@ -852,13 +835,12 @@ static int ia32_possible_memory_operand(const void *self, const ir_node *irn, un return 1; } -static void ia32_perform_memory_operand(const void *self, ir_node *irn, - ir_node *spill, unsigned int i) +static void ia32_perform_memory_operand(ir_node *irn, ir_node *spill, + unsigned int i) { ia32_code_gen_t *cg = ia32_current_cg; - (void) self; - assert(ia32_possible_memory_operand(self, irn, i) && "Cannot perform memory operand change"); + assert(ia32_possible_memory_operand(irn, i) && "Cannot perform memory operand change"); if (i == n_ia32_binary_left) { ia32_swap_left_right(irn); @@ -1918,8 +1900,8 @@ static const arch_code_generator_if_t *ia32_get_code_generator_if(void *self) * Returns the estimated execution time of an ia32 irn. */ static sched_timestep_t ia32_sched_exectime(void *env, const ir_node *irn) { - const arch_env_t *arch_env = env; - return is_ia32_irn(irn) ? ia32_get_op_estimated_cost(arch_get_irn_ops(arch_env, irn), irn) : 1; + (void) env; + return is_ia32_irn(irn) ? ia32_get_op_estimated_cost(irn) : 1; } list_sched_selector_t ia32_sched_selector; diff --git a/ir/be/mips/bearch_mips.c b/ir/be/mips/bearch_mips.c index e85743cca..249a4f88f 100644 --- a/ir/be/mips/bearch_mips.c +++ b/ir/be/mips/bearch_mips.c @@ -88,12 +88,10 @@ static set *cur_reg_set = NULL; * will be asked for this information. */ static const -arch_register_req_t *mips_get_irn_reg_req(const void *self, - const ir_node *node, int pos) +arch_register_req_t *mips_get_irn_reg_req(const ir_node *node, int pos) { long node_pos = pos == -1 ? 0 : pos; ir_mode *mode = get_irn_mode(node); - (void) self; if (is_Block(node) || mode == mode_X || mode == mode_M) { return arch_no_register_req; @@ -134,11 +132,9 @@ arch_register_req_t *mips_get_irn_reg_req(const void *self, return arch_no_register_req; } -static void mips_set_irn_reg(const void *self, ir_node *irn, - const arch_register_t *reg) +static void mips_set_irn_reg(ir_node *irn, const arch_register_t *reg) { int pos = 0; - (void) self; if (is_Proj(irn)) { @@ -161,12 +157,10 @@ static void mips_set_irn_reg(const void *self, ir_node *irn, } } -static const arch_register_t *mips_get_irn_reg(const void *self, - const ir_node *irn) +static const arch_register_t *mips_get_irn_reg(const ir_node *irn) { int pos = 0; const arch_register_t *reg = NULL; - (void) self; if (is_Proj(irn)) { @@ -190,9 +184,8 @@ static const arch_register_t *mips_get_irn_reg(const void *self, return reg; } -static arch_irn_class_t mips_classify(const void *self, const ir_node *irn) +static arch_irn_class_t mips_classify(const ir_node *irn) { - (void) self; irn = skip_Proj_const(irn); if (is_cfop(irn)) { @@ -204,9 +197,8 @@ static arch_irn_class_t mips_classify(const void *self, const ir_node *irn) return 0; } -static arch_irn_flags_t mips_get_flags(const void *self, const ir_node *irn) +static arch_irn_flags_t mips_get_flags(const ir_node *irn) { - (void) self; irn = skip_Proj_const(irn); if (!is_mips_irn(irn)) @@ -226,10 +218,9 @@ int mips_is_Store(const ir_node *node) return is_mips_sw(node) || is_mips_sh(node) || is_mips_sb(node); } -static ir_entity *mips_get_frame_entity(const void *self, const ir_node *node) +static ir_entity *mips_get_frame_entity(const ir_node *node) { const mips_load_store_attr_t *attr; - (void) self; if(!is_mips_irn(node)) return NULL; @@ -240,11 +231,9 @@ static ir_entity *mips_get_frame_entity(const void *self, const ir_node *node) return attr->stack_entity; } -static void mips_set_frame_entity(const void *self, ir_node *node, - ir_entity *entity) +static void mips_set_frame_entity(ir_node *node, ir_entity *entity) { mips_load_store_attr_t *attr; - (void) self; if(!is_mips_irn(node)) { panic("trying to set frame entity on non load/store node %+F\n", node); @@ -261,10 +250,9 @@ static void mips_set_frame_entity(const void *self, ir_node *node, * This function is called by the generic backend to correct offsets for * nodes accessing the stack. */ -static void mips_set_frame_offset(const void *self, ir_node *node, int offset) +static void mips_set_frame_offset(ir_node *node, int offset) { mips_load_store_attr_t *attr; - (void) self; if(!is_mips_irn(node)) { panic("trying to set frame offset on non load/store node %+F\n", node); @@ -281,9 +269,8 @@ static void mips_set_frame_offset(const void *self, ir_node *node, int offset) } } -static int mips_get_sp_bias(const void *self, const ir_node *irn) +static int mips_get_sp_bias(const ir_node *irn) { - (void) self; (void) irn; return 0; } @@ -730,7 +717,7 @@ static const arch_register_t *mips_abi_prologue(void *self, ir_node** mem, pmap // - setup first part of stackframe sp = new_rd_mips_addu(NULL, irg, block, sp, mips_create_Immediate(initialstackframesize)); - mips_set_irn_reg(NULL, sp, &mips_gp_regs[REG_SP]); + mips_set_irn_reg(sp, &mips_gp_regs[REG_SP]); set_mips_flags(sp, arch_irn_flags_ignore); /* TODO: where to get an edge with a0-a3 @@ -768,7 +755,7 @@ static const arch_register_t *mips_abi_prologue(void *self, ir_node** mem, pmap // save old framepointer sp = new_rd_mips_addu(NULL, irg, block, sp, mips_create_Immediate(-initialstackframesize)); - mips_set_irn_reg(NULL, sp, &mips_gp_regs[REG_SP]); + mips_set_irn_reg(sp, &mips_gp_regs[REG_SP]); set_mips_flags(sp, arch_irn_flags_ignore); reg = be_abi_reg_map_get(reg_map, &mips_gp_regs[REG_FP]); @@ -780,7 +767,7 @@ static const arch_register_t *mips_abi_prologue(void *self, ir_node** mem, pmap // setup framepointer fp = new_rd_mips_addu(NULL, irg, block, sp, mips_create_Immediate(-initialstackframesize)); - mips_set_irn_reg(NULL, fp, &mips_gp_regs[REG_FP]); + mips_set_irn_reg(fp, &mips_gp_regs[REG_FP]); set_mips_flags(fp, arch_irn_flags_ignore); be_abi_reg_map_set(reg_map, &mips_gp_regs[REG_FP], fp); @@ -802,7 +789,7 @@ static void mips_abi_epilogue(void *self, ir_node *block, ir_node **mem, pmap *r // copy fp to sp sp = new_rd_mips_or(NULL, irg, block, fp, mips_create_zero()); - mips_set_irn_reg(NULL, sp, &mips_gp_regs[REG_SP]); + mips_set_irn_reg(sp, &mips_gp_regs[REG_SP]); set_mips_flags(sp, arch_irn_flags_ignore); // 1. restore fp diff --git a/ir/be/ppc32/bearch_ppc32.c b/ir/be/ppc32/bearch_ppc32.c index 6de818c09..573e6f86f 100644 --- a/ir/be/ppc32/bearch_ppc32.c +++ b/ir/be/ppc32/bearch_ppc32.c @@ -86,13 +86,12 @@ static set *cur_reg_set = NULL; * If the node returns a tuple (mode_T) then the proj's * will be asked for this information. */ -static const -arch_register_req_t *ppc32_get_irn_reg_req(const void *self, - const ir_node *irn, int pos) { +static const arch_register_req_t *ppc32_get_irn_reg_req(const ir_node *irn, + int pos) +{ long node_pos = pos == -1 ? 0 : pos; ir_mode *mode = get_irn_mode(irn); FIRM_DBG_REGISTER(firm_dbg_module_t *mod, DEBUG_MODULE); - (void) self; if (is_Block(irn) || mode == mode_X || mode == mode_M) { DBG((mod, LEVEL_1, "ignoring block, mode_X or mode_M node %+F\n", irn)); @@ -140,9 +139,9 @@ arch_register_req_t *ppc32_get_irn_reg_req(const void *self, return arch_no_register_req; } -static void ppc32_set_irn_reg(const void *self, ir_node *irn, const arch_register_t *reg) { +static void ppc32_set_irn_reg(ir_node *irn, const arch_register_t *reg) +{ int pos = 0; - (void) self; if (is_Proj(irn)) { @@ -166,10 +165,10 @@ static void ppc32_set_irn_reg(const void *self, ir_node *irn, const arch_registe } } -static const arch_register_t *ppc32_get_irn_reg(const void *self, const ir_node *irn) { +static const arch_register_t *ppc32_get_irn_reg(const ir_node *irn) +{ int pos = 0; const arch_register_t *reg = NULL; - (void) self; if (is_Proj(irn)) { @@ -193,8 +192,8 @@ static const arch_register_t *ppc32_get_irn_reg(const void *self, const ir_node return reg; } -static arch_irn_class_t ppc32_classify(const void *self, const ir_node *irn) { - (void) self; +static arch_irn_class_t ppc32_classify(const ir_node *irn) +{ irn = skip_Proj_const(irn); if (is_cfop(irn)) { @@ -207,8 +206,8 @@ static arch_irn_class_t ppc32_classify(const void *self, const ir_node *irn) { return 0; } -static arch_irn_flags_t ppc32_get_flags(const void *self, const ir_node *irn) { - (void) self; +static arch_irn_flags_t ppc32_get_flags(const ir_node *irn) +{ irn = skip_Proj_const(irn); if (is_ppc32_irn(irn)) { @@ -221,15 +220,15 @@ static arch_irn_flags_t ppc32_get_flags(const void *self, const ir_node *irn) { return 0; } -static ir_entity *ppc32_get_frame_entity(const void *self, const ir_node *irn) { - (void) self; +static ir_entity *ppc32_get_frame_entity(const ir_node *irn) +{ if(!is_ppc32_irn(irn)) return NULL; if(get_ppc32_type(irn)!=ppc32_ac_FrameEntity) return NULL; return get_ppc32_frame_entity(irn); } -static void ppc32_set_frame_entity(const void *self, ir_node *irn, ir_entity *ent) { - (void) self; +static void ppc32_set_frame_entity(ir_node *irn, ir_entity *ent) +{ if (! is_ppc32_irn(irn) || get_ppc32_type(irn) != ppc32_ac_FrameEntity) return; set_ppc32_frame_entity(irn, ent); @@ -239,13 +238,13 @@ static void ppc32_set_frame_entity(const void *self, ir_node *irn, ir_entity *en * This function is called by the generic backend to correct offsets for * nodes accessing the stack. */ -static void ppc32_set_stack_bias(const void *self, ir_node *irn, int bias) { - (void) self; +static void ppc32_set_stack_bias(ir_node *irn, int bias) +{ set_ppc32_offset(irn, bias); } -static int ppc32_get_sp_bias(const void *self, const ir_node *irn) { - (void) self; +static int ppc32_get_sp_bias(const ir_node *irn) +{ (void) irn; return 0; } -- 2.20.1