X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firnode_t.h;h=9730a58ee60dc16c1e845997894008aac2efdb97;hb=b78bdd4d94de46de4156272e6dbfe44e97933a5b;hp=fa1cf226f4702c85ccfb17ee0ddedf386a92ae14;hpb=f727a093b858da14853a0ec5aa9866ae80066e87;p=libfirm diff --git a/ir/ir/irnode_t.h b/ir/ir/irnode_t.h index fa1cf226f..9730a58ee 100644 --- a/ir/ir/irnode_t.h +++ b/ir/ir/irnode_t.h @@ -240,18 +240,19 @@ struct ir_node { ir_mode *mode; /**< Mode of this node. */ struct ir_node **in; /**< array with predecessors / operands */ unsigned long visited; /**< visited counter for walks of the graph */ + unsigned node_idx; /**< the node index of this node in its graph */ void *link; /**< to attach additional information to the node, e.g. used while construction to link Phi0 nodes and - during optimization to link to nodes that - shall replace a node. */ + during optimization to link to nodes that + shall replace a node. */ /* ------- Fields for optimizations / analysis information ------- */ struct ir_node **out; /**< @deprecated array of out edges. */ struct dbg_info* dbi; /**< A pointer to information for debug support. */ /* ------- For debugging ------- */ #ifdef DEBUG_libfirm - int out_valid; - int node_nr; /**< a unique node number for each node to make output - readable. */ + int out_valid; + long node_nr; /**< a unique node number for each node to make output + readable. */ #endif /* ------- For analyses -------- */ ir_loop *loop; /**< the loop the node is in. Access routines in irloop.h */ @@ -259,17 +260,19 @@ struct ir_node { struct abstval *av; /**< the abstract value of this node */ struct section *sec; #endif -#if FIRM_EDGES_INPLACE irn_edge_info_t edge_info; /**< everlasting out edges */ -#endif /* ------- Opcode depending fields -------- */ attr attr; /**< attribute of this node. Depends on opcode. Must be last field of 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 +354,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 +609,52 @@ _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_Load (const ir_node *node) { + assert(node); + return (node && _get_irn_op(node) == op_Load); +} + +static INLINE int +_is_Sync (const ir_node *node) { + assert(node); + return (node && _get_irn_op(node) == op_Sync); +} + +static INLINE int +_is_Confirm (const ir_node *node) { + assert(node); + return (node && _get_irn_op(node) == op_Confirm); +} + static INLINE int _is_no_Block(const ir_node *node) { assert(node && _is_ir_node(node)); @@ -727,6 +782,22 @@ static INLINE int _is_irn_constlike(const ir_node *node) { return is_op_constlike(_get_irn_op(node)); } +static INLINE int _is_irn_keep(const ir_node *node) { + return is_op_keep(_get_irn_op(node)); +} + +static INLINE int _is_irn_machine_op(const ir_node *node) { + return is_op_machine(_get_irn_op(node)); +} + +static INLINE int _is_irn_machine_operand(const ir_node *node) { + return is_op_machine_operand(_get_irn_op(node)); +} + +static INLINE int _is_irn_machine_user(const ir_node *node, unsigned n) { + return is_op_machine_user(_get_irn_op(node), n); +} + static INLINE cond_jmp_predicate _get_Cond_jmp_pred(ir_node *node) { assert (_get_irn_op(node) == op_Cond); return node->attr.c.pred; @@ -737,6 +808,15 @@ 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; +} + +static INLINE unsigned _get_irn_idx(const ir_node *node) { + return node->node_idx; +} + /* 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) @@ -748,6 +828,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) @@ -762,6 +843,13 @@ 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_Load(node) _is_Load(node) +#define is_Sync(node) _is_Sync(node) +#define is_Confirm(node) _is_Confirm(node) #define is_Bad(node) _is_Bad(node) #define is_no_Block(node) _is_no_Block(node) #define is_Block(node) _is_Block(node) @@ -781,7 +869,13 @@ static INLINE void _set_Cond_jmp_pred(ir_node *node, cond_jmp_predicate pred) { #define get_irn_type_attr(node) _get_irn_type_attr(node) #define get_irn_entity_attr(node) _get_irn_entity_attr(node) #define is_irn_constlike(node) _is_irn_constlike(node) +#define is_irn_keep(node) _is_irn_keep(node) +#define is_irn_machine_op(node) _is_irn_machine_op(node) +#define is_irn_machine_operand(node) _is_irn_machine_operand(node) +#define is_irn_machine_user(node, n) _is_irn_machine_user(node, n) #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) +#define get_irn_idx(node) _get_irn_idx(node) # endif /* _IRNODE_T_H_ */