projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add an get_irg_idx
[libfirm]
/
ir
/
ir
/
irnode.c
diff --git
a/ir/ir/irnode.c
b/ir/ir/irnode.c
index
aa16588
..
e81e212
100644
(file)
--- a/
ir/ir/irnode.c
+++ b/
ir/ir/irnode.c
@@
-664,6
+664,13
@@
set_nodes_block(ir_node *node, ir_node *block) {
set_irn_n(node, -1, block);
}
set_irn_n(node, -1, block);
}
+/* this works for all except Block */
+ir_node *
+get_nodes_MacroBlock(const ir_node *node) {
+ assert(node->op != op_Block);
+ return get_Block_MacroBlock(get_irn_n(node, -1));
+}
+
/* Test whether arbitrary node is frame pointer, i.e. Proj(pn_Start_P_frame_base)
* from Start. If so returns frame type, else Null. */
ir_type *is_frame_pointer(ir_node *n) {
/* Test whether arbitrary node is frame pointer, i.e. Proj(pn_Start_P_frame_base)
* from Start. If so returns frame type, else Null. */
ir_type *is_frame_pointer(ir_node *n) {
@@
-726,7
+733,7
@@
int
}
ir_node *
}
ir_node *
-(get_Block_cfgpred)(ir_node *node, int pos) {
+(get_Block_cfgpred)(
const
ir_node *node, int pos) {
return _get_Block_cfgpred(node, pos);
}
return _get_Block_cfgpred(node, pos);
}
@@
-737,12
+744,12
@@
set_Block_cfgpred(ir_node *node, int pos, ir_node *pred) {
}
ir_node *
}
ir_node *
-(get_Block_cfgpred_block)(ir_node *node, int pos) {
+(get_Block_cfgpred_block)(
const
ir_node *node, int pos) {
return _get_Block_cfgpred_block(node, pos);
}
int
return _get_Block_cfgpred_block(node, pos);
}
int
-get_Block_matured(ir_node *node) {
+get_Block_matured(
const
ir_node *node) {
assert(node->op == op_Block);
return (int)node->attr.block.is_matured;
}
assert(node->op == op_Block);
return (int)node->attr.block.is_matured;
}
@@
-791,6
+798,7
@@
set_Block_graph_arr (ir_node *node, int pos, ir_node *value) {
node->attr.block.graph_arr[pos+1] = value;
}
node->attr.block.graph_arr[pos+1] = value;
}
+#ifdef INTERPROCEDURAL_VIEW
void set_Block_cg_cfgpred_arr(ir_node *node, int arity, ir_node *in[]) {
assert(node->op == op_Block);
if (node->attr.block.in_cg == NULL || arity != ARR_LEN(node->attr.block.in_cg) - 1) {
void set_Block_cg_cfgpred_arr(ir_node *node, int arity, ir_node *in[]) {
assert(node->op == op_Block);
if (node->attr.block.in_cg == NULL || arity != ARR_LEN(node->attr.block.in_cg) - 1) {
@@
-835,6
+843,7
@@
void remove_Block_cg_cfgpred_arr(ir_node *node) {
assert(node->op == op_Block);
node->attr.block.in_cg = NULL;
}
assert(node->op == op_Block);
node->attr.block.in_cg = NULL;
}
+#endif
ir_node *(set_Block_dead)(ir_node *block) {
return _set_Block_dead(block);
ir_node *(set_Block_dead)(ir_node *block) {
return _set_Block_dead(block);
@@
-860,8
+869,13
@@
void set_Block_extbb(ir_node *block, ir_extblk *extblk) {
/* returns the macro block header of a block. */
ir_node *get_Block_MacroBlock(const ir_node *block) {
/* returns the macro block header of a block. */
ir_node *get_Block_MacroBlock(const ir_node *block) {
+ ir_node *mbh;
assert(is_Block(block));
assert(is_Block(block));
- return get_irn_n(block, -1);
+ mbh = get_irn_n(block, -1);
+ /* once macro block header is respected by all optimizations,
+ this assert can be removed */
+ assert(mbh != NULL);
+ return mbh;
}
/* returns the graph of a Block. */
}
/* returns the graph of a Block. */
@@
-1087,8
+1101,16
@@
set_Const_tarval(ir_node *node, tarval *con) {
node->attr.con.tv = con;
}
node->attr.con.tv = con;
}
-cnst_classify_t (classify_Const)(ir_node *node) {
- return _classify_Const(node);
+int (is_Const_null)(const ir_node *node) {
+ return _is_Const_null(node);
+}
+
+int (is_Const_one)(const ir_node *node) {
+ return _is_Const_one(node);
+}
+
+int (is_Const_all_one)(const ir_node *node) {
+ return _is_Const_all_one(node);
}
}
@@
-1098,6
+1120,7
@@
cnst_classify_t (classify_Const)(ir_node *node) {
ir_type *
get_Const_type(ir_node *node) {
assert(node->op == op_Const);
ir_type *
get_Const_type(ir_node *node) {
assert(node->op == op_Const);
+ node->attr.con.tp = skip_tid(node->attr.con.tp);
return node->attr.con.tp;
}
return node->attr.con.tp;
}
@@
-1463,6
+1486,7
@@
BINOP(Add)
BINOP(Sub)
UNOP(Minus)
BINOP(Mul)
BINOP(Sub)
UNOP(Minus)
BINOP(Mul)
+BINOP(Mulh)
DIVOP(Quot)
DIVOP(DivMod)
DIVOP(Div)
DIVOP(Quot)
DIVOP(DivMod)
DIVOP(Div)
@@
-1480,7
+1504,7
@@
BINOP(Cmp)
UNOP(Conv)
UNOP(Cast)
UNOP(Conv)
UNOP(Cast)
-int get_Conv_strict(ir_node *node) {
+int get_Conv_strict(
const
ir_node *node) {
assert(node->op == op_Conv);
return node->attr.conv.strict;
}
assert(node->op == op_Conv);
return node->attr.conv.strict;
}
@@
-1493,6
+1517,7
@@
void set_Conv_strict(ir_node *node, int strict_flag) {
ir_type *
get_Cast_type(ir_node *node) {
assert(node->op == op_Cast);
ir_type *
get_Cast_type(ir_node *node) {
assert(node->op == op_Cast);
+ node->attr.cast.totype = skip_tid(node->attr.cast.totype);
return node->attr.cast.totype;
}
return node->attr.cast.totype;
}
@@
-1510,9
+1535,8
@@
set_Cast_type(ir_node *node, ir_type *to_tp) {
int is_Cast_upcast(ir_node *node) {
ir_type *totype = get_Cast_type(node);
ir_type *fromtype = get_irn_typeinfo_type(get_Cast_op(node));
int is_Cast_upcast(ir_node *node) {
ir_type *totype = get_Cast_type(node);
ir_type *fromtype = get_irn_typeinfo_type(get_Cast_op(node));
- ir_graph *myirg = get_irn_irg(node);
- assert(get_irg_typeinfo_state(
myirg
) == ir_typeinfo_consistent);
+ assert(get_irg_typeinfo_state(
get_irn_irg(node)
) == ir_typeinfo_consistent);
assert(fromtype);
while (is_Pointer_type(totype) && is_Pointer_type(fromtype)) {
assert(fromtype);
while (is_Pointer_type(totype) && is_Pointer_type(fromtype)) {
@@
-1599,19
+1623,9
@@
set_binop_right(ir_node *node, ir_node *right) {
set_irn_n(node, node->op->op_index + 1, right);
}
set_irn_n(node, node->op->op_index + 1, right);
}
-int is_Phi(const ir_node *n) {
- ir_op *op;
-
- assert(n);
- op = get_irn_op(n);
-
- if (op == op_Filter) return get_interprocedural_view();
-
- if (op == op_Phi)
- return ((get_irg_phase_state(get_irn_irg(n)) != phase_building) ||
- (get_irn_arity(n) > 0));
-
- return 0;
+int
+(is_Phi)(const ir_node *n) {
+ return _is_Phi(n);
}
int is_Phi0(const ir_node *n) {
}
int is_Phi0(const ir_node *n) {
@@
-1725,6
+1739,18
@@
set_Load_volatility(ir_node *node, ir_volatility volatility) {
node->attr.load.volatility = volatility;
}
node->attr.load.volatility = volatility;
}
+ir_align
+get_Load_align(ir_node *node) {
+ assert(node->op == op_Load);
+ return node->attr.load.aligned;
+}
+
+void
+set_Load_align(ir_node *node, ir_align align) {
+ assert(node->op == op_Load);
+ node->attr.load.aligned = align;
+}
+
ir_node *
get_Store_mem(ir_node *node) {
ir_node *
get_Store_mem(ir_node *node) {
@@
-1774,6
+1800,18
@@
set_Store_volatility(ir_node *node, ir_volatility volatility) {
node->attr.store.volatility = volatility;
}
node->attr.store.volatility = volatility;
}
+ir_align
+get_Store_align(ir_node *node) {
+ assert(node->op == op_Store);
+ return node->attr.store.aligned;
+}
+
+void
+set_Store_align(ir_node *node, ir_align align) {
+ assert(node->op == op_Store);
+ node->attr.store.aligned = align;
+}
+
ir_node *
get_Alloc_mem(ir_node *node) {
ir_node *
get_Alloc_mem(ir_node *node) {
@@
-2167,30
+2205,26
@@
void set_Mux_true(ir_node *node, ir_node *ir_true) {
/* Psi support */
ir_node *get_Psi_cond(ir_node *node, int pos) {
/* Psi support */
ir_node *get_Psi_cond(ir_node *node, int pos) {
- int num_conds = get_Psi_n_conds(node);
assert(node->op == op_Psi);
assert(node->op == op_Psi);
- assert(pos <
num_conds
);
+ assert(pos <
get_Psi_n_conds(node)
);
return get_irn_n(node, 2 * pos);
}
void set_Psi_cond(ir_node *node, int pos, ir_node *cond) {
return get_irn_n(node, 2 * pos);
}
void set_Psi_cond(ir_node *node, int pos, ir_node *cond) {
- int num_conds = get_Psi_n_conds(node);
assert(node->op == op_Psi);
assert(node->op == op_Psi);
- assert(pos <
num_conds
);
+ assert(pos <
get_Psi_n_conds(node)
);
set_irn_n(node, 2 * pos, cond);
}
ir_node *get_Psi_val(ir_node *node, int pos) {
set_irn_n(node, 2 * pos, cond);
}
ir_node *get_Psi_val(ir_node *node, int pos) {
- int num_vals = get_Psi_n_conds(node);
assert(node->op == op_Psi);
assert(node->op == op_Psi);
- assert(pos <
num_vals
);
+ assert(pos <
get_Psi_n_conds(node)
);
return get_irn_n(node, 2 * pos + 1);
}
void set_Psi_val(ir_node *node, int pos, ir_node *val) {
return get_irn_n(node, 2 * pos + 1);
}
void set_Psi_val(ir_node *node, int pos, ir_node *val) {
- int num_vals = get_Psi_n_conds(node);
assert(node->op == op_Psi);
assert(node->op == op_Psi);
- assert(pos <
num_vals
);
+ assert(pos <
get_Psi_n_conds(node)
);
set_irn_n(node, 2 * pos + 1, val);
}
set_irn_n(node, 2 * pos + 1, val);
}
@@
-2623,6
+2657,26
@@
int
return _is_Sub(node);
}
return _is_Sub(node);
}
+int
+(is_Shl)(const ir_node *node) {
+ return _is_Shl(node);
+}
+
+int
+(is_Shr)(const ir_node *node) {
+ return _is_Shr(node);
+}
+
+int
+(is_Shrs)(const ir_node *node) {
+ return _is_Shrs(node);
+}
+
+int
+(is_Rot)(const ir_node *node) {
+ return _is_Rot(node);
+}
+
int
(is_Not)(const ir_node *node) {
return _is_Not(node);
int
(is_Not)(const ir_node *node) {
return _is_Not(node);
@@
-2658,6
+2712,16
@@
int
return _is_Conv(node);
}
return _is_Conv(node);
}
+int
+(is_strictConv)(const ir_node *node) {
+ return _is_strictConv(node);
+}
+
+int
+(is_Cast)(const ir_node *node) {
+ return _is_Cast(node);
+}
+
int
(is_no_Block)(const ir_node *node) {
return _is_no_Block(node);
int
(is_no_Block)(const ir_node *node) {
return _is_no_Block(node);
@@
-2776,7
+2840,7
@@
int
}
int
}
int
-
is_Proj
(const ir_node *node) {
+
(is_Proj)
(const ir_node *node) {
assert(node);
return node->op == op_Proj ||
(!get_interprocedural_view() && node->op == op_Filter);
assert(node);
return node->op == op_Proj ||
(!get_interprocedural_view() && node->op == op_Filter);
@@
-2815,7
+2879,8
@@
ir_node *get_fragile_op_mem(ir_node *node) {
case iro_Store :
case iro_Alloc :
case iro_Bound :
case iro_Store :
case iro_Alloc :
case iro_Bound :
- return get_irn_n(node, 0);
+ case iro_CopyB :
+ return get_irn_n(node, pn_Generic_M_regular);
case iro_Bad :
case iro_Unknown:
return node;
case iro_Bad :
case iro_Unknown:
return node;
@@
-3032,5
+3097,5
@@
void dump_irn(ir_node *n) {
}
#else /* DEBUG_libfirm */
}
#else /* DEBUG_libfirm */
-void dump_irn(ir_node *n) {}
+void dump_irn(ir_node *n) {
(void) n;
}
#endif /* DEBUG_libfirm */
#endif /* DEBUG_libfirm */