X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firnode.c;h=bf07359e0777d8f26cdc04ac9d62bc77a8c84e1a;hb=79b409329e8b6e9f43ac71df6599372fa0dbe497;hp=e104a5cdb0e39d0a2403afb3a06515033f54ee25;hpb=91a19e8e14a08c5bbe9b121e55a67a57ca5cf73e;p=libfirm diff --git a/ir/ir/irnode.c b/ir/ir/irnode.c index e104a5cdb..bf07359e0 100644 --- a/ir/ir/irnode.c +++ b/ir/ir/irnode.c @@ -163,13 +163,10 @@ new_ir_node(dbg_info *db, ir_graph *irg, ir_node *block, ir_op *op, ir_mode *mod memcpy(&res->in[1], in, sizeof(ir_node *) * arity); } - res->in[0] = block; + res->in[0] = block; set_irn_dbg_info(res, db); - res->out = NULL; - -#ifdef DEBUG_libfirm + res->out = NULL; res->node_nr = get_irp_new_node_nr(); -#endif for (i = 0; i < EDGE_KIND_LAST; ++i) INIT_LIST_HEAD(&res->edge_info[i].outs_head); @@ -497,11 +494,7 @@ void set_irn_pinned(ir_node *node, op_pin_state state) { /* Outputs a unique number for this node */ long get_irn_node_nr(const ir_node *node) { assert(node); -#ifdef DEBUG_libfirm return node->node_nr; -#else - return (long)PTR_TO_INT(node); -#endif } const_attr *get_irn_const_attr(ir_node *node) { @@ -532,7 +525,7 @@ symconst_attr *get_irn_symconst_attr(ir_node *node) { ir_type *get_irn_call_attr(ir_node *node) { assert(is_Call(node)); - return node->attr.call.cld_tp = skip_tid(node->attr.call.cld_tp); + return node->attr.call.type = skip_tid(node->attr.call.type); } sel_attr *get_irn_sel_attr(ir_node *node) { @@ -643,20 +636,6 @@ ir_type *is_tls_pointer(const ir_node *n) { return NULL; } -/* Test whether arbitrary node is value arg base, i.e. Proj(pn_Start_P_value_arg_base) - * from Start. If so returns 1, else 0. */ -int is_value_arg_pointer(const ir_node *n) { - if (is_Proj(n) && - (get_Proj_proj(n) == pn_Start_P_value_arg_base) && - is_Start(get_Proj_pred(n))) - return 1; - return 0; -} - -/* Returns an array with the predecessors of the Block. Depending on - the implementation of the graph data structure this can be a copy of - the internal representation of predecessors as well as the internal - array itself. Therefore writing to this array might obstruct the ir. */ ir_node **get_Block_cfgpred_arr(ir_node *node) { assert(is_Block(node)); return (ir_node **)&(get_irn_in(node)[1]); @@ -675,6 +654,16 @@ void set_Block_cfgpred(ir_node *node, int pos, ir_node *pred) { set_irn_n(node, pos, pred); } +int get_Block_cfgpred_pos(const ir_node *block, const ir_node *pred) { + int i; + + for (i = get_Block_n_cfgpreds(block) - 1; i >= 0; --i) { + if (get_Block_cfgpred_block(block, i) == pred) + return i; + } + return -1; +} + ir_node *(get_Block_cfgpred_block)(const ir_node *node, int pos) { return _get_Block_cfgpred_block(node, pos); } @@ -1016,6 +1005,18 @@ I don't want to choose 3) as 2a) seems to have advantages for dataflow analysis and 3) does not allow to convert the representation to 2a). */ + +const char *get_cond_kind_name(cond_kind kind) +{ +#define X(a) case a: return #a; + switch (kind) { + X(dense); + X(fragmentary); + } + return ""; +#undef X +} + ir_node * get_Cond_selector(const ir_node *node) { assert(is_Cond(node)); @@ -1041,11 +1042,16 @@ set_Cond_kind(ir_node *node, cond_kind kind) { } long -get_Cond_defaultProj(const ir_node *node) { +get_Cond_default_proj(const ir_node *node) { assert(is_Cond(node)); return node->attr.cond.default_proj; } +void set_Cond_default_proj(ir_node *node, long defproj) { + assert(is_Cond(node)); + node->attr.cond.default_proj = defproj; +} + ir_node * get_Return_mem(const ir_node *node) { assert(is_Return(node)); @@ -1289,7 +1295,7 @@ set_Sel_index(ir_node *node, int pos, ir_node *index) { ir_entity * get_Sel_entity(const ir_node *node) { assert(is_Sel(node)); - return node->attr.sel.ent; + return node->attr.sel.entity; } /* need a version without const to prevent warning */ @@ -1300,7 +1306,7 @@ static ir_entity *_get_Sel_entity(ir_node *node) { void set_Sel_entity(ir_node *node, ir_entity *ent) { assert(is_Sel(node)); - node->attr.sel.ent = ent; + node->attr.sel.entity = ent; } @@ -1363,14 +1369,14 @@ set_Call_param(ir_node *node, int pos, ir_node *param) { ir_type * get_Call_type(ir_node *node) { assert(is_Call(node)); - return node->attr.call.cld_tp = skip_tid(node->attr.call.cld_tp); + return node->attr.call.type = skip_tid(node->attr.call.type); } void set_Call_type(ir_node *node, ir_type *tp) { assert(is_Call(node)); assert((get_unknown_type() == tp) || is_Method_type(tp)); - node->attr.call.cld_tp = tp; + node->attr.call.type = tp; } ir_node * @@ -1424,23 +1430,24 @@ set_Builtin_param(ir_node *node, int pos, ir_node *param) { ir_type * get_Builtin_type(ir_node *node) { assert(is_Builtin(node)); - return node->attr.builtin.builtin_tp = skip_tid(node->attr.builtin.builtin_tp); + return node->attr.builtin.type = skip_tid(node->attr.builtin.type); } void set_Builtin_type(ir_node *node, ir_type *tp) { assert(is_Builtin(node)); assert((get_unknown_type() == tp) || is_Method_type(tp)); - node->attr.builtin.builtin_tp = tp; + node->attr.builtin.type = tp; } /* Returns a human readable string for the ir_builtin_kind. */ const char *get_builtin_kind_name(ir_builtin_kind kind) { -#define X(a) case a: return #a + 6; +#define X(a) case a: return #a; switch (kind) { X(ir_bk_trap); + X(ir_bk_debugbreak); X(ir_bk_return_address); - X(ir_bk_frame_addess); + X(ir_bk_frame_address); X(ir_bk_prefetch); X(ir_bk_ffs); X(ir_bk_clz); @@ -1448,6 +1455,9 @@ const char *get_builtin_kind_name(ir_builtin_kind kind) { X(ir_bk_popcount); X(ir_bk_parity); X(ir_bk_bswap); + X(ir_bk_inport); + X(ir_bk_outport); + X(ir_bk_inner_trampoline); } return ""; #undef X @@ -1567,16 +1577,17 @@ BINOP_MEM(OP) \ \ ir_mode *get_##OP##_resmode(const ir_node *node) { \ assert(is_##OP(node)); \ - return node->attr.divmod.res_mode; \ + return node->attr.divmod.resmode; \ } \ \ void set_##OP##_resmode(ir_node *node, ir_mode *mode) { \ assert(is_##OP(node)); \ - node->attr.divmod.res_mode = mode; \ + node->attr.divmod.resmode = mode; \ } BINOP(Add) +BINOP(Borrow) BINOP(Carry) BINOP(Sub) UNOP(Minus) @@ -1599,11 +1610,16 @@ BINOP(Cmp) UNOP(Conv) UNOP(Cast) -int is_Div_remainderless(const ir_node *node) { +int get_Div_no_remainder(const ir_node *node) { assert(is_Div(node)); return node->attr.divmod.no_remainder; } +void set_Div_no_remainder(ir_node *node, int no_remainder) { + assert(is_Div(node)); + node->attr.divmod.no_remainder = no_remainder; +} + int get_Conv_strict(const ir_node *node) { assert(is_Conv(node)); return node->attr.conv.strict; @@ -1617,14 +1633,14 @@ void set_Conv_strict(ir_node *node, int strict_flag) { ir_type * get_Cast_type(ir_node *node) { assert(is_Cast(node)); - node->attr.cast.totype = skip_tid(node->attr.cast.totype); - return node->attr.cast.totype; + node->attr.cast.type = skip_tid(node->attr.cast.type); + return node->attr.cast.type; } void set_Cast_type(ir_node *node, ir_type *to_tp) { assert(is_Cast(node)); - node->attr.cast.totype = to_tp; + node->attr.cast.type = to_tp; } @@ -1826,13 +1842,13 @@ set_Load_ptr(ir_node *node, ir_node *ptr) { ir_mode * get_Load_mode(const ir_node *node) { assert(is_Load(node)); - return node->attr.load.load_mode; + return node->attr.load.mode; } void set_Load_mode(ir_node *node, ir_mode *mode) { assert(is_Load(node)); - node->attr.load.load_mode = mode; + node->attr.load.mode = mode; } ir_volatility @@ -2342,12 +2358,12 @@ void set_CopyB_src(ir_node *node, ir_node *src) { ir_type *get_CopyB_type(ir_node *node) { assert(is_CopyB(node)); - return node->attr.copyb.data_type = skip_tid(node->attr.copyb.data_type); + return node->attr.copyb.type = skip_tid(node->attr.copyb.type); } void set_CopyB_type(ir_node *node, ir_type *data_type) { assert(is_CopyB(node) && data_type); - node->attr.copyb.data_type = data_type; + node->attr.copyb.type = data_type; } @@ -2961,6 +2977,12 @@ int return _is_ASM(node); } +/* returns true if a node is an Dummy node. */ +int +(is_Dummy)(const ir_node *node) { + return _is_Dummy(node); +} + int (is_Proj)(const ir_node *node) { return _is_Proj(node); @@ -3089,12 +3111,14 @@ int (is_irn_machine_user)(const ir_node *node, unsigned n) { /* Gets the string representation of the jump prediction .*/ const char *get_cond_jmp_predicate_name(cond_jmp_predicate pred) { +#define X(a) case a: return #a; switch (pred) { - default: - case COND_JMP_PRED_NONE: return "no prediction"; - case COND_JMP_PRED_TRUE: return "true taken"; - case COND_JMP_PRED_FALSE: return "false taken"; + X(COND_JMP_PRED_NONE); + X(COND_JMP_PRED_TRUE); + X(COND_JMP_PRED_FALSE); } + return ""; +#undef X } /* Returns the conditional jump prediction of a Cond node. */ @@ -3202,30 +3226,6 @@ dbg_info *(get_irn_dbg_info)(const ir_node *n) { return _get_irn_dbg_info(n); } -#if 0 /* allow the global pointer */ - -/* checks whether a node represents a global address */ -int is_Global(const ir_node *node) { - ir_node *ptr; - - if (is_SymConst_addr_ent(node)) - return 1; - if (! is_Sel(node)) - return 0; - - ptr = get_Sel_ptr(node); - return is_globals_pointer(ptr) != NULL; -} - -/* returns the entity of a global address */ -ir_entity *get_Global_entity(const ir_node *node) { - if (is_SymConst(node)) - return get_SymConst_entity(node); - else - return get_Sel_entity(node); -} -#else - /* checks whether a node represents a global address */ int is_Global(const ir_node *node) { return is_SymConst_addr_ent(node); @@ -3235,7 +3235,6 @@ int is_Global(const ir_node *node) { ir_entity *get_Global_entity(const ir_node *node) { return get_SymConst_entity(node); } -#endif /* * Calculate a hash value of a node.