X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firnode_t.h;h=bc2e5266badbd4b43b0f536fe2fc751b870d7a52;hb=8c2ff434c07cfcf327664a474661db20a0cdbfb9;hp=5acbc7154c33e58dab8977edb1422a663a942aae;hpb=e0090662d79cd31c3dd35b8d4ee0f35530f75bc5;p=libfirm diff --git a/ir/ir/irnode_t.h b/ir/ir/irnode_t.h index 5acbc7154..bc2e5266b 100644 --- a/ir/ir/irnode_t.h +++ b/ir/ir/irnode_t.h @@ -268,8 +268,12 @@ struct ir_node { }; -/** Returns the array with the ins. The content of the array may not be - changed. */ +/** + * Returns the array with the ins. The content of the array may not be + * changed. + * Note that this function returns the whole in array including the + * block predecessor. So, it is NOT symmetric with set_irn_in(). + */ ir_node **get_irn_in (const ir_node *node); /** @{ */ @@ -351,6 +355,12 @@ _get_irn_op (const ir_node *node) { return node->op; } +static INLINE void +_set_irn_op (ir_node *node, ir_op *op) { + assert (node); + node->op = op; +} + /** Copies all attributes stored in the old node to the new node. Assumes both have the same opcode and sufficient size. */ static INLINE void @@ -600,6 +610,34 @@ _is_Unknown (const ir_node *node) { return (node && _get_irn_op(node) == op_Unknown); } +static INLINE int +_is_Return (const ir_node *node) { + assert(node); + return (node && _get_irn_op(node) == op_Return); +} + +static INLINE int +_is_Call (const ir_node *node) { + assert(node); + return (node && _get_irn_op(node) == op_Call); +} + +static INLINE int +_is_Sel (const ir_node *node) { + assert(node); + return (node && _get_irn_op(node) == op_Sel); +} + +static INLINE int +_is_Mux (const ir_node *node) { + assert(node); + if (node) { + ir_op *op = _get_irn_op(node); + return (op == op_Mux || ((op == op_Psi) && _get_irn_arity(node) == 3)); + } + return 0; +} + static INLINE int _is_no_Block(const ir_node *node) { assert(node && _is_ir_node(node)); @@ -741,6 +779,11 @@ static INLINE void _set_Cond_jmp_pred(ir_node *node, cond_jmp_predicate pred) { node->attr.c.pred = pred; } +static INLINE int _get_Psi_n_conds(ir_node *node) { + assert(_get_irn_op(node) == op_Psi); + return _get_irn_arity(node) >> 1; +} + /* this section MUST contain all inline functions */ #define is_ir_node(thing) _is_ir_node(thing) #define get_irn_intra_arity(node) _get_irn_intra_arity(node) @@ -752,6 +795,7 @@ static INLINE void _set_Cond_jmp_pred(ir_node *node, cond_jmp_predicate pred) { #define get_irn_mode(node) _get_irn_mode(node) #define set_irn_mode(node, mode) _set_irn_mode(node, mode) #define get_irn_op(node) _get_irn_op(node) +#define set_irn_op(node, op) _set_irn_op(node, op) #define get_irn_opcode(node) _get_irn_opcode(node) #define get_irn_visited(node) _get_irn_visited(node) #define set_irn_visited(node, v) _set_irn_visited(node, v) @@ -766,6 +810,10 @@ static INLINE void _set_Cond_jmp_pred(ir_node *node, cond_jmp_predicate pred) { #define is_binop(node) _is_binop(node) #define is_Const(node) _is_Const(node) #define is_Unknown(node) _is_Unknown(node) +#define is_Return(node) _is_Return(node) +#define is_Call(node) _is_Call(node) +#define is_Sel(node) _is_Sel(node) +#define is_Mux(node) _is_Mux(node) #define is_Bad(node) _is_Bad(node) #define is_no_Block(node) _is_no_Block(node) #define is_Block(node) _is_Block(node) @@ -788,5 +836,6 @@ static INLINE void _set_Cond_jmp_pred(ir_node *node, cond_jmp_predicate pred) { #define is_irn_keep(node) _is_irn_keep(node) #define get_Cond_jmp_pred(node) _get_Cond_jmp_pred(node) #define set_Cond_jmp_pred(node, pred) _set_Cond_jmp_pred(node, pred) +#define get_Psi_n_conds(node) _get_Psi_n_conds(node) # endif /* _IRNODE_T_H_ */