fixed some warnings
[libfirm] / ir / ir / irvrfy.c
index 31da296..3e98cbb 100644 (file)
@@ -1096,6 +1096,22 @@ static int verify_node_InstOf(ir_node *n, ir_graph *irg) {
        return 1;
 }
 
+/**
+ * Check if the pinned state is right.
+ */
+static int verify_right_pinned(ir_node *n) {
+       ir_node *mem;
+
+       if (get_irn_pinned(n) == op_pin_state_pinned)
+               return 1;
+       mem = get_Call_mem(n);
+
+       /* if it's not pinned, its memory predecessor must be NoMem or Pin */
+       if (is_NoMem(mem) || is_Pin(mem))
+               return 1;
+       return 0;
+}
+
 /**
  * verify a Call node
  */
@@ -1112,10 +1128,7 @@ static int verify_node_Call(ir_node *n, ir_graph *irg) {
        ASSERT_AND_RET( op1mode == mode_M && mode_is_reference(op2mode), "Call node", 0 );  /* operand M x ref */
 
        /* NoMem nodes are only allowed as memory input if the Call is NOT pinned */
-       ASSERT_AND_RET(
-               (get_irn_op(get_Call_mem(n)) == op_NoMem) ||
-               (get_irn_op(get_Call_mem(n)) != op_NoMem && get_irn_pinned(n) == op_pin_state_pinned),
-               "Call node with wrong memory input", 0 );
+       ASSERT_AND_RET(verify_right_pinned(n),"Call node with wrong memory input", 0 );
 
        mt = get_Call_type(n);
        if(get_unknown_type() == mt) {
@@ -1185,7 +1198,7 @@ static int verify_node_Add(ir_node *n, ir_graph *irg) {
        ASSERT_AND_RET_DBG(
                (
                        /* common Add: BB x numP x numP --> numP */
-                       (op1mode == mymode && op2mode == op1mode && mode_is_numP(mymode)) ||
+                       (op1mode == mymode && op2mode == op1mode && mode_is_data(mymode)) ||
                        /* Pointer Add: BB x ref x int --> ref */
                        (mode_is_reference(op1mode) && mode_is_int(op2mode) && op1mode == mymode) ||
                        /* Pointer Add: BB x int x ref --> ref */
@@ -1211,7 +1224,7 @@ static int verify_node_Sub(ir_node *n, ir_graph *irg) {
        ASSERT_AND_RET_DBG(
                (
                        /* common Sub: BB x numP x numP --> numP */
-                       (mymode ==op1mode && mymode == op2mode && mode_is_numP(op1mode)) ||
+                       (mymode ==op1mode && mymode == op2mode && mode_is_data(op1mode)) ||
                        /* Pointer Sub: BB x ref x int --> ref */
                        (op1mode == mymode && mode_is_int(op2mode) && mode_is_reference(mymode)) ||
                        /* Pointer Sub: BB x int x ref --> ref */
@@ -1422,7 +1435,7 @@ static int verify_node_Cmp(ir_node *n, ir_graph *irg) {
 
        ASSERT_AND_RET_DBG(
                /* Cmp: BB x datab x datab --> b16 */
-               mode_is_data (op1mode) &&
+               mode_is_datab(op1mode) &&
                op2mode == op1mode &&
                mymode == mode_T,
                "Cmp node", 0,
@@ -1627,7 +1640,7 @@ static int verify_node_Store(ir_node *n, ir_graph *irg) {
        ir_mode *op2mode = get_irn_mode(get_Store_ptr(n));
        ir_mode *op3mode = get_irn_mode(get_Store_value(n));
 
-       ASSERT_AND_RET(op1mode == mode_M && mode_is_data(op3mode), "Store node", 0 );
+       ASSERT_AND_RET(op1mode == mode_M && mode_is_datab(op3mode), "Store node", 0 );
        if (get_irg_phase_state(irg) != phase_backend) {
                ASSERT_AND_RET(mode_is_reference(op2mode), "Store node", 0 );
        } else {
@@ -1743,7 +1756,7 @@ static int verify_node_Mux(ir_node *n, ir_graph *irg) {
                op1mode == mode_b &&
                op2mode == mymode &&
                op3mode == mymode &&
-               mode_is_numP(mymode),
+               mode_is_data(mymode),
                "Mux node", 0
                );
        return 1;
@@ -1777,10 +1790,7 @@ static int verify_node_CopyB(ir_node *n, ir_graph *irg) {
 
        /* NoMem nodes are only allowed as memory input if the CopyB is NOT pinned.
           This should happen RARELY, as CopyB COPIES MEMORY */
-       ASSERT_AND_RET(
-               (get_irn_op(get_CopyB_mem(n)) == op_NoMem) ||
-               (get_irn_op(get_CopyB_mem(n)) != op_NoMem && get_irn_pinned(n) == op_pin_state_pinned),
-               "CopyB node with wrong memory input", 0 );
+       ASSERT_AND_RET(verify_right_pinned(n), "CopyB node with wrong memory input", 0 );
        return 1;
 }