- simplified
[libfirm] / ir / ir / irnode.c
index 8f0d2ab..228b148 100644 (file)
@@ -525,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) {
@@ -636,10 +636,6 @@ ir_type *is_tls_pointer(const ir_node *n) {
        return NULL;
 }
 
-/* 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]);
@@ -658,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);
 }
@@ -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,14 +1430,14 @@ 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. */
@@ -1571,12 +1577,12 @@ 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;                     \
 }
 
 
@@ -1603,7 +1609,7 @@ 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;
 }
@@ -1621,14 +1627,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;
 }
 
 
@@ -1830,13 +1836,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
@@ -2346,12 +2352,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;
 }