add an get_irg_idx
[libfirm] / ir / ir / irnode.c
index ea44848..e81e212 100644 (file)
@@ -733,7 +733,7 @@ int
 }
 
 ir_node *
-(get_Block_cfgpred)(ir_node *node, int pos) {
+(get_Block_cfgpred)(const ir_node *node, int pos) {
        return _get_Block_cfgpred(node, pos);
 }
 
@@ -744,12 +744,12 @@ set_Block_cfgpred(ir_node *node, int pos, ir_node *pred) {
 }
 
 ir_node  *
-(get_Block_cfgpred_block)(ir_node *node, int pos) {
+(get_Block_cfgpred_block)(const ir_node *node, int pos) {
        return _get_Block_cfgpred_block(node, pos);
 }
 
 int
-get_Block_matured(ir_node *node) {
+get_Block_matured(const ir_node *node) {
        assert(node->op == op_Block);
        return (int)node->attr.block.is_matured;
 }
@@ -1120,6 +1120,7 @@ int (is_Const_all_one)(const ir_node *node) {
 ir_type *
 get_Const_type(ir_node *node) {
        assert(node->op == op_Const);
+       node->attr.con.tp = skip_tid(node->attr.con.tp);
        return node->attr.con.tp;
 }
 
@@ -1503,7 +1504,7 @@ BINOP(Cmp)
 UNOP(Conv)
 UNOP(Cast)
 
-int get_Conv_strict(ir_node *node) {
+int get_Conv_strict(const ir_node *node) {
        assert(node->op == op_Conv);
        return node->attr.conv.strict;
 }
@@ -1516,6 +1517,7 @@ void set_Conv_strict(ir_node *node, int strict_flag) {
 ir_type *
 get_Cast_type(ir_node *node) {
        assert(node->op == op_Cast);
+       node->attr.cast.totype = skip_tid(node->attr.cast.totype);
        return node->attr.cast.totype;
 }
 
@@ -1533,9 +1535,8 @@ set_Cast_type(ir_node *node, ir_type *to_tp) {
 int is_Cast_upcast(ir_node *node) {
        ir_type *totype   = get_Cast_type(node);
        ir_type *fromtype = get_irn_typeinfo_type(get_Cast_op(node));
-       ir_graph *myirg = get_irn_irg(node);
 
-       assert(get_irg_typeinfo_state(myirg) == ir_typeinfo_consistent);
+       assert(get_irg_typeinfo_state(get_irn_irg(node)) == ir_typeinfo_consistent);
        assert(fromtype);
 
        while (is_Pointer_type(totype) && is_Pointer_type(fromtype)) {
@@ -2204,30 +2205,26 @@ void set_Mux_true(ir_node *node, ir_node *ir_true) {
 
 /* Psi support */
 ir_node *get_Psi_cond(ir_node *node, int pos) {
-       int num_conds = get_Psi_n_conds(node);
        assert(node->op == op_Psi);
-       assert(pos < num_conds);
+       assert(pos < get_Psi_n_conds(node));
        return get_irn_n(node, 2 * pos);
 }
 
 void set_Psi_cond(ir_node *node, int pos, ir_node *cond) {
-       int num_conds = get_Psi_n_conds(node);
        assert(node->op == op_Psi);
-       assert(pos < num_conds);
+       assert(pos < get_Psi_n_conds(node));
        set_irn_n(node, 2 * pos, cond);
 }
 
 ir_node *get_Psi_val(ir_node *node, int pos) {
-       int num_vals = get_Psi_n_conds(node);
        assert(node->op == op_Psi);
-       assert(pos < num_vals);
+       assert(pos < get_Psi_n_conds(node));
        return get_irn_n(node, 2 * pos + 1);
 }
 
 void set_Psi_val(ir_node *node, int pos, ir_node *val) {
-       int num_vals = get_Psi_n_conds(node);
        assert(node->op == op_Psi);
-       assert(pos < num_vals);
+       assert(pos < get_Psi_n_conds(node));
        set_irn_n(node, 2 * pos + 1, val);
 }
 
@@ -2715,6 +2712,11 @@ int
        return _is_Conv(node);
 }
 
+int
+(is_strictConv)(const ir_node *node) {
+       return _is_strictConv(node);
+}
+
 int
 (is_Cast)(const ir_node *node) {
        return _is_Cast(node);
@@ -3095,5 +3097,5 @@ void dump_irn(ir_node *n) {
 }
 
 #else  /* DEBUG_libfirm */
-void dump_irn(ir_node *n) {}
+void dump_irn(ir_node *n) { (void) n; }
 #endif /* DEBUG_libfirm */