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

we don't need no stinking selfs

[r19739]
parent be8b3b02
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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)
......
......@@ -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);
};
/**
......
......@@ -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)