Commit 69bc79c7 authored by Michael Beck's avatar Michael Beck
Browse files

get_*_attr() functions now return a pointer

do "manual" cse

[r14659]
parent 95d3605c
......@@ -552,10 +552,10 @@ long get_irn_node_nr(const ir_node *node) {
#endif
}
const_attr
const_attr *
get_irn_const_attr(ir_node *node) {
assert(node->op == op_Const);
return node->attr.con;
return &node->attr.con;
}
long
......@@ -564,22 +564,22 @@ get_irn_proj_attr(ir_node *node) {
return node->attr.proj;
}
alloc_attr
alloc_attr *
get_irn_alloc_attr(ir_node *node) {
assert(node->op == op_Alloc);
return node->attr.alloc;
return &node->attr.alloc;
}
free_attr
free_attr *
get_irn_free_attr(ir_node *node) {
assert(node->op == op_Free);
return node->attr.free;
return &node->attr.free;
}
symconst_attr
symconst_attr *
get_irn_symconst_attr(ir_node *node) {
assert(node->op == op_SymConst);
return node->attr.symc;
return &node->attr.symc;
}
ir_type *
......@@ -588,10 +588,10 @@ get_irn_call_attr(ir_node *node) {
return node->attr.call.cld_tp = skip_tid(node->attr.call.cld_tp);
}
sel_attr
sel_attr *
get_irn_sel_attr(ir_node *node) {
assert(node->op == op_Sel);
return node->attr.sel;
return &node->attr.sel;
}
int
......@@ -600,29 +600,29 @@ get_irn_phi0_attr(ir_node *node) {
return node->attr.phi0.pos;
}
block_attr
block_attr *
get_irn_block_attr(ir_node *node) {
assert(node->op == op_Block);
return node->attr.block;
return &node->attr.block;
}
load_attr
load_attr *
get_irn_load_attr(ir_node *node) {
assert(node->op == op_Load);
return node->attr.load;
return &node->attr.load;
}
store_attr
store_attr *
get_irn_store_attr(ir_node *node) {
assert(node->op == op_Store);
return node->attr.store;
return &node->attr.store;
}
except_attr
except_attr *
get_irn_except_attr(ir_node *node) {
assert(node->op == op_Div || node->op == op_Quot ||
node->op == op_DivMod || node->op == op_Mod || node->op == op_Call || node->op == op_Alloc);
return node->attr.except;
return &node->attr.except;
}
void *(get_irn_generic_attr)(ir_node *node) {
......
......@@ -180,10 +180,9 @@ typedef struct {
therefore the name. */
} phi0_attr;
/**< Confirm attribute. */
typedef struct {
pn_Cmp cmp; /**< The compare operation. */
pn_Cmp cmp; /**< The compare operation. */
} confirm_attr;
/** CopyB attribute. */
......@@ -226,7 +225,7 @@ typedef union {
symconst_attr symc; /**< For SymConst. */
sel_attr sel; /**< For Sel. */
call_attr call; /**< For Call: pointer to the type of the method to call */
callbegin_attr callbegin; /**< For CallBegin */
callbegin_attr callbegin; /**< For CallBegin. */
alloc_attr alloc; /**< For Alloc. */
free_attr free; /**< For Free. */
io_attr instof; /**< For InstOf */
......@@ -307,19 +306,19 @@ ir_node **get_irn_in (const ir_node *node);
/** @{ */
/** access attributes directly */
const_attr get_irn_const_attr (ir_node *node);
const_attr *get_irn_const_attr (ir_node *node);
long get_irn_proj_attr (ir_node *node);
alloc_attr get_irn_alloc_attr (ir_node *node);
free_attr get_irn_free_attr (ir_node *node);
symconst_attr get_irn_symconst_attr (ir_node *node);
ir_type *get_irn_call_attr (ir_node *node);
ir_type *get_irn_funccall_attr (ir_node *node);
sel_attr get_irn_sel_attr (ir_node *node);
alloc_attr *get_irn_alloc_attr (ir_node *node);
free_attr *get_irn_free_attr (ir_node *node);
symconst_attr *get_irn_symconst_attr (ir_node *node);
ir_type *get_irn_call_attr (ir_node *node);
ir_type *get_irn_funccall_attr (ir_node *node);
sel_attr *get_irn_sel_attr (ir_node *node);
int get_irn_phi0_attr (ir_node *node);
block_attr get_irn_block_attr (ir_node *node);
load_attr get_irn_load_attr (ir_node *node);
store_attr get_irn_store_attr (ir_node *node);
except_attr get_irn_except_attr (ir_node *node);
block_attr *get_irn_block_attr (ir_node *node);
load_attr *get_irn_load_attr (ir_node *node);
store_attr *get_irn_store_attr (ir_node *node);
except_attr *get_irn_except_attr (ir_node *node);
/** @} */
/**
......
......@@ -3495,7 +3495,7 @@ static int node_cmp_attr_Const(ir_node *a, ir_node *b) {
/** Compares the attributes of two Proj nodes. */
static int node_cmp_attr_Proj(ir_node *a, ir_node *b) {
return get_irn_proj_attr (a) != get_irn_proj_attr (b);
return get_irn_proj_attr(a) != get_irn_proj_attr(b);
} /* node_cmp_attr_Proj */
/** Compares the attributes of two Filter nodes. */
......@@ -3505,21 +3505,25 @@ static int node_cmp_attr_Filter(ir_node *a, ir_node *b) {
/** Compares the attributes of two Alloc nodes. */
static int node_cmp_attr_Alloc(ir_node *a, ir_node *b) {
return (get_irn_alloc_attr(a).where != get_irn_alloc_attr(b).where)
|| (get_irn_alloc_attr(a).type != get_irn_alloc_attr(b).type);
const alloc_attr *pa = get_irn_alloc_attr(a);
const alloc_attr *pb = get_irn_alloc_attr(b);
return (pa->where != pb->where) || (pa->type != pb->type);
} /* node_cmp_attr_Alloc */
/** Compares the attributes of two Free nodes. */
static int node_cmp_attr_Free(ir_node *a, ir_node *b) {
return (get_irn_free_attr(a).where != get_irn_free_attr(b).where)
|| (get_irn_free_attr(a).type != get_irn_free_attr(b).type);
const free_attr *pa = get_irn_free_attr(a);
const free_attr *pb = get_irn_free_attr(b);
return (pa->where != pb->where) || (pa->type != pb->type);
} /* node_cmp_attr_Free */
/** Compares the attributes of two SymConst nodes. */
static int node_cmp_attr_SymConst(ir_node *a, ir_node *b) {
return (get_irn_symconst_attr(a).num != get_irn_symconst_attr(b).num)
|| (get_irn_symconst_attr(a).sym.type_p != get_irn_symconst_attr(b).sym.type_p)
|| (get_irn_symconst_attr(a).tp != get_irn_symconst_attr(b).tp);
const symconst_attr *pa = get_irn_symconst_attr(a);
const symconst_attr *pb = get_irn_symconst_attr(b);
return (pa->num != pb->num)
|| (pa->sym.type_p != pb->sym.type_p)
|| (pa->tp != pb->tp);
} /* node_cmp_attr_SymConst */
/** Compares the attributes of two Call nodes. */
......@@ -3529,8 +3533,8 @@ static int node_cmp_attr_Call(ir_node *a, ir_node *b) {
/** Compares the attributes of two Sel nodes. */
static int node_cmp_attr_Sel(ir_node *a, ir_node *b) {
const ir_entity *a_ent = get_irn_sel_attr(a).ent;
const ir_entity *b_ent = get_irn_sel_attr(b).ent;
const ir_entity *a_ent = get_Sel_entity(a);
const ir_entity *b_ent = get_Sel_entity(b);
return
(a_ent->kind != b_ent->kind) ||
(a_ent->name != b_ent->name) ||
......
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