X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firnode_t.h;h=474fd5524f88b70315367209aa9d4f9aebabc796;hb=357886575cb0becb5bd9be376fde49b57edd5385;hp=aad7621f3f11fb0ea81d73f482a5bd5588742703;hpb=8cb8730614f09dc3a9966839b0d936f15e9a3412;p=libfirm diff --git a/ir/ir/irnode_t.h b/ir/ir/irnode_t.h index aad7621f3..474fd5524 100644 --- a/ir/ir/irnode_t.h +++ b/ir/ir/irnode_t.h @@ -47,17 +47,6 @@ ir_node **get_irn_in (const ir_node *node); */ extern unsigned firm_add_node_size; -/** - * Sets the get_type operation for an ir_op_ops. - * - * @param code the opcode for the default operation - * @param ops the operations initialized - * - * @return - * The operations. - */ -ir_op_ops *firm_set_default_get_type(ir_opcode code, ir_op_ops *ops); - /** * Sets the get_type_attr operation for an ir_op_ops. * @@ -67,7 +56,7 @@ ir_op_ops *firm_set_default_get_type(ir_opcode code, ir_op_ops *ops); * @return * The operations. */ -ir_op_ops *firm_set_default_get_type_attr(ir_opcode code, ir_op_ops *ops); +ir_op_ops *firm_set_default_get_type_attr(unsigned code, ir_op_ops *ops); /** * Sets the get_entity_attr operation for an ir_op_ops. @@ -78,7 +67,7 @@ ir_op_ops *firm_set_default_get_type_attr(ir_opcode code, ir_op_ops *ops); * @return * The operations. */ -ir_op_ops *firm_set_default_get_entity_attr(ir_opcode code, ir_op_ops *ops); +ir_op_ops *firm_set_default_get_entity_attr(unsigned code, ir_op_ops *ops); /** * Returns an array with the predecessors of the Block. Depending on @@ -146,7 +135,7 @@ static inline unsigned _get_irn_opcode(const ir_node *node) */ static inline int _get_irn_arity(const ir_node *node) { - return ARR_LEN(node->in) - 1; + return (int)(ARR_LEN(node->in) - 1); } /** @@ -178,12 +167,12 @@ static inline unsigned hash_irn(const ir_node *node) } static inline int _get_irn_deps(const ir_node *node) { - return node->deps ? ARR_LEN(node->deps) : 0; + return node->deps ? (int)ARR_LEN(node->deps) : 0; } static inline ir_node *_get_irn_dep(const ir_node *node, int pos) { assert(node->deps && "dependency array node yet allocated. use add_irn_dep()"); - assert(pos >= 0 && pos < ARR_LEN(node->deps) && "dependency index out of range"); + assert(pos >= 0 && pos < (int)ARR_LEN(node->deps) && "dependency index out of range"); return node->deps[pos]; } @@ -195,7 +184,7 @@ static inline void _set_irn_dep(ir_node *node, int pos, ir_node *dep) ir_node *old; assert(node->deps && "dependency array node yet allocated. use add_irn_dep()"); - assert(pos >= 0 && pos < ARR_LEN(node->deps) && "dependency index out of range"); + assert(pos >= 0 && pos < (int)ARR_LEN(node->deps) && "dependency index out of range"); old = node->deps[pos]; node->deps[pos] = dep; edges_notify_edge_kind(node, pos, dep, old, EDGE_KIND_DEP, get_irn_irg(node)); @@ -401,10 +390,14 @@ static inline ir_node *_get_Block_cfgpred(const ir_node *node, int pos) */ static inline ir_node *_get_Block_cfgpred_block(const ir_node *node, int pos) { - ir_node *res = skip_Proj(get_Block_cfgpred(node, pos)); - if (!is_Bad(res)) - res = get_nodes_block(res); - return res; + ir_node *res = get_Block_cfgpred(node, pos); + if (is_Bad(res)) { + /* must return a Bad with mode_BB! */ + ir_graph *irg = get_irn_irg(node); + return new_r_Bad(irg, mode_BB); + } else { + return get_nodes_block(skip_Proj(res)); + } } static inline ir_visited_t _get_Block_block_visited(const ir_node *node) @@ -431,33 +424,13 @@ static inline int _Block_block_visited(const ir_node *node) return node->attr.block.block_visited >= get_irg_block_visited(irg); } -static inline ir_node *_set_Block_dead(ir_node *block) -{ - assert(_get_irn_op(block) == op_Block); - block->attr.block.dom.dom_depth = -1; - block->attr.block.is_dead = 1; - return block; -} - -static inline int _is_Block_dead(const ir_node *block) -{ - ir_op *op = _get_irn_op(block); - - if (op == op_Bad) - return 1; - else { - assert(op == op_Block); - return block->attr.block.is_dead; - } -} - static inline ir_graph *_get_Block_irg(const ir_node *block) { assert(is_Block(block)); return block->attr.irg.irg; } -static inline tarval *_get_Const_tarval(const ir_node *node) { +static inline ir_tarval *_get_Const_tarval(const ir_node *node) { assert(_get_irn_op(node) == op_Const); return node->attr.con.tarval; } @@ -478,10 +451,6 @@ static inline int _is_irn_forking(const ir_node *node) { return is_op_forking(_get_irn_op(node)); } -static inline ir_type *_get_irn_type(ir_node *node) { - return _get_irn_op(node)->ops.get_type(node); -} - static inline ir_type *_get_irn_type_attr(ir_node *node) { return _get_irn_op(node)->ops.get_type_attr(node); } @@ -587,6 +556,7 @@ static inline ir_node *_get_Phi_next(const ir_node *phi) /** Add a Phi node to the list of Block Phi's. */ static inline void _add_Block_phi(ir_node *block, ir_node *phi) { + assert(_is_Block(block)); _set_Phi_next(phi, _get_Block_phis(block)); _set_Block_phis(block, phi); } @@ -652,8 +622,6 @@ void init_irnode(void); #define set_Block_block_visited(node, visit) _set_Block_block_visited(node, visit) #define mark_Block_block_visited(node) _mark_Block_block_visited(node) #define Block_block_visited(node) _Block_block_visited(node) -#define set_Block_dead(block) _set_Block_dead(block) -#define is_Block_dead(block) _is_Block_dead(block) #define get_Block_irg(block) _get_Block_irg(block) #define get_Const_tarval(node) _get_Const_tarval(node) #define is_Const_null(node) _is_Const_null(node)