moved verification flags from irvrfy to irflag
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Sat, 31 Dec 2005 15:57:03 +0000 (15:57 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Sat, 31 Dec 2005 15:57:03 +0000 (15:57 +0000)
verifications flags are now used by irvrfy and trvrfy
removed binary Cond test, failed in some optimizations

[r7173]

ir/ir/irvrfy.c
ir/ir/irvrfy.h
ir/ir/irvrfy_t.h

index 5874d62..f5a6e95 100644 (file)
 # include "config.h"
 #endif
 
-# include "irprog.h"
-# include "irop_t.h"
-# include "irgraph_t.h"
-# include "ircgcons.h"
-# include "irvrfy_t.h"
-# include "irgwalk.h"
-# include "irdump.h"
-# include "irdom_t.h"
-# include "irprintf.h"
-# include "irouts.h"
+#include "irprog.h"
+#include "irop_t.h"
+#include "irgraph_t.h"
+#include "ircgcons.h"
+#include "irvrfy_t.h"
+#include "irgwalk.h"
+#include "irdump.h"
+#include "irdom_t.h"
+#include "irprintf.h"
+#include "irouts.h"
+#include "irflag_t.h"
 
 /** if this flag is set, verify entity types in Load & Store nodes */
 static int vrfy_entities = 0;
 
-node_verification_t opt_do_node_verification = NODE_VERIFICATION_ON;
 const char *firm_vrfy_failure_msg;
 
 /* enable verification of Load/Store entities */
@@ -45,10 +45,6 @@ static const char *get_mode_name_ex(ir_mode *mode) {
   return get_mode_name(mode);
 }
 
-void do_node_verification(node_verification_t mode) {
-  opt_do_node_verification = mode;
-}
-
 /** the last IRG, on which a verify error was found */
 static ir_graph *last_irg_error = NULL;
 
@@ -207,20 +203,11 @@ static void show_proj_failure_ent(ir_node *n, entity *ent)
  */
 static void show_node_on_graph(ir_graph *irg, ir_node *n)
 {
-  entity *ent = get_irg_entity(irg);
-
-  if (ent)
-    fprintf(stderr, "\nFIRM: irn_vrfy_irg() of entity %s, node %ld %s%s\n",
-      get_entity_name(ent),
-      get_irn_node_nr(n), get_irn_opname(n), get_irn_modename(n));
-  else
-    fprintf(stderr, "\nFIRM: irn_vrfy_irg() of graph %p, node %ld %s%s\n",
-      (void *)irg,
-      get_irn_node_nr(n), get_irn_opname(n), get_irn_modename(n));
+  ir_fprintf(stderr, "\nFIRM: irn_vrfy_irg() of %+F, node %+F\n", irg, n);
 }
 
 /**
- * Show call params
+ * Show call parameters
  */
 static void show_call_param(ir_node *n, type *mt)
 {
@@ -830,13 +817,6 @@ static int verify_node_Cond(ir_node *n, ir_graph *irg) {
   );
   ASSERT_AND_RET(mymode == mode_T, "Cond mode is not a tuple", 0);
 
-  if (op1mode == mode_b && get_irg_outs_state(irg) == outs_consistent &&
-      !is_Block_dead(get_nodes_block(n))) {
-    /* we have consistent outs, check for the right number of Proj's */
-    ASSERT_AND_RET(
-    get_irn_n_outs(n) == 2,
-   "Live binary Cond node must have 2 successors", 0);
-  }
   return 1;
 }
 
@@ -1649,8 +1629,8 @@ int irn_vrfy_irg(ir_node *n, ir_graph *irg)
   int i;
   ir_op *op;
 
-  if (!opt_do_node_verification)
-               return 1;
+  if (!get_node_verification_mode())
+    return 1;
 
   if (!get_interprocedural_view()) {
     /*
@@ -1749,7 +1729,7 @@ int irg_verify(ir_graph *irg, unsigned flags)
 
   current_ir_graph = rem;
 
-  if (opt_do_node_verification == NODE_VERIFICATION_REPORT && ! res) {
+  if (get_node_verification_mode() == FIRM_VERIFICATION_REPORT && ! res) {
     entity *ent = get_irg_entity(current_ir_graph);
 
     if (ent)
@@ -1765,15 +1745,15 @@ int irg_verify(ir_graph *irg, unsigned flags)
 int irn_vrfy_irg_dump(ir_node *n, ir_graph *irg, const char **bad_string)
 {
   int res;
-  node_verification_t old = opt_do_node_verification;
+  firm_verification_t old = get_node_verification_mode();
 
   firm_vrfy_failure_msg = NULL;
-  opt_do_node_verification = NODE_VERIFICATION_ERROR_ONLY;
+  do_node_verification(FIRM_VERIFICATION_ERROR_ONLY);
   res = irn_vrfy_irg(n, irg);
   if (! res && get_irg_dom_state(irg) == dom_consistent &&
       get_irg_pinned(irg) == op_pin_state_pinned)
     res = check_dominance_for_node(n);
-  opt_do_node_verification = old;
+  do_node_verification(old);
   *bad_string = firm_vrfy_failure_msg;
 
   return res;
@@ -1803,10 +1783,10 @@ static void check_bads(ir_node *node, void *env)
         if (is_Bad(pred)) {
           venv->res |= BAD_CF;
 
-          if (opt_do_node_verification == NODE_VERIFICATION_REPORT) {
+          if (get_node_verification_mode() == FIRM_VERIFICATION_REPORT) {
             fprintf(stderr, "irg_vrfy_bads: Block %ld has Bad predecessor\n", get_irn_node_nr(node));
           }
-          if (opt_do_node_verification == NODE_VERIFICATION_ON) {
+          if (get_node_verification_mode() == FIRM_VERIFICATION_ON) {
             assert(0 && "Bad CF detected");
           }
         }
@@ -1820,10 +1800,10 @@ static void check_bads(ir_node *node, void *env)
       if (is_Bad(get_nodes_block(node))) {
         venv->res |= BAD_BLOCK;
 
-        if (opt_do_node_verification == NODE_VERIFICATION_REPORT) {
+        if (get_node_verification_mode() == FIRM_VERIFICATION_REPORT) {
           fprintf(stderr, "irg_vrfy_bads: node %ld has Bad Block\n", get_irn_node_nr(node));
         }
-        if (opt_do_node_verification == NODE_VERIFICATION_ON) {
+        if (get_node_verification_mode() == FIRM_VERIFICATION_ON) {
           assert(0 && "Bad CF detected");
         }
       }
@@ -1833,10 +1813,10 @@ static void check_bads(ir_node *node, void *env)
       if (get_irn_op(node) == op_Tuple) {
         venv->res |= TUPLE;
 
-        if (opt_do_node_verification == NODE_VERIFICATION_REPORT) {
+        if (get_node_verification_mode() == FIRM_VERIFICATION_REPORT) {
           fprintf(stderr, "irg_vrfy_bads: node %ld is a Tuple\n", get_irn_node_nr(node));
         }
-        if (opt_do_node_verification == NODE_VERIFICATION_ON) {
+        if (get_node_verification_mode() == FIRM_VERIFICATION_ON) {
           assert(0 && "Tuple detected");
         }
       }
@@ -1853,10 +1833,10 @@ static void check_bads(ir_node *node, void *env)
           else {
             venv->res |= BAD_CF;
 
-            if (opt_do_node_verification == NODE_VERIFICATION_REPORT) {
+            if (get_node_verification_mode() == FIRM_VERIFICATION_REPORT) {
               fprintf(stderr, "irg_vrfy_bads: Phi %ld has Bad Input\n", get_irn_node_nr(node));
             }
-            if (opt_do_node_verification == NODE_VERIFICATION_ON) {
+            if (get_node_verification_mode() == FIRM_VERIFICATION_ON) {
               assert(0 && "Bad CF detected");
             }
           }
@@ -1866,10 +1846,10 @@ static void check_bads(ir_node *node, void *env)
         if ((venv->flags & BAD_DF) == 0) {
           venv->res |= BAD_DF;
 
-          if (opt_do_node_verification == NODE_VERIFICATION_REPORT) {
+          if (get_node_verification_mode() == FIRM_VERIFICATION_REPORT) {
             fprintf(stderr, "irg_vrfy_bads: node %ld has Bad Input\n", get_irn_node_nr(node));
           }
-          if (opt_do_node_verification == NODE_VERIFICATION_ON) {
+          if (get_node_verification_mode() == FIRM_VERIFICATION_ON) {
             assert(0 && "Bad NON-CF detected");
           }
         }
@@ -1879,7 +1859,7 @@ static void check_bads(ir_node *node, void *env)
 }
 
 /*
- * verify occurance of bad nodes
+ * verify occurrence of bad nodes
  */
 int irg_vrfy_bads(ir_graph *irg, int flags)
 {
index 4597daa..1999955 100644 (file)
  */
 
 /**
-* @file irvrfy.h
-*
-* ir graph verification.
-*
-* @author Christian Schaefer
-*/
-
-# ifndef _IRVRFY_H_
-# define _IRVRFY_H_
-
-# include "irnode.h"
-# include "irgraph.h"
-
-typedef enum _node_verification_t {
-  NODE_VERIFICATION_OFF        = 0,    /**< do not verify nodes at all */
-  NODE_VERIFICATION_ON         = 1,    /**< do node verification and assert on error in debug version */
-  NODE_VERIFICATION_REPORT     = 2,    /**< do node verification, but report to stderr only */
-  NODE_VERIFICATION_ERROR_ONLY = 3     /**< do node verification, but NEVER do assert nor report */
-} node_verification_t;
-
-/** Select verification of nodes.
+ * @file irvrfy.h
+ *
+ * ir graph verification.
  *
- *  Per default the  verification is in mode NODE_VERIFICATION_ASSERT.
- *  Turn the verification off during development to check partial implementations.
+ * @author Christian Schaefer
  */
-void do_node_verification(node_verification_t mode);
+#ifndef _IRVRFY_H_
+#define _IRVRFY_H_
+
+#include "firm_types.h"
 
 /**
  * Tests the modes of checknode and its predecessors.
- * Checknode must be in current_ir_graph.
+ * checknode must be in current_ir_graph.
  *
  * \return
  *     NON-zero on success
  */
-int irn_vrfy(struct ir_node *checknode);
+int irn_vrfy(ir_node *checknode);
 
 /**
  * Tests the modes of checknode and its predecessors.
- * Checknode must be in given ir_graph.
+ * checknode must be in given ir_graph.
  *
  * \return
  *     NON-zero on success
  */
-int irn_vrfy_irg(struct ir_node *checknode, ir_graph *irg);
+int irn_vrfy_irg(ir_node *checknode, ir_graph *irg);
 
 /**
  * Same as irn_vrfy_irg, but temporary sets verification mode to
@@ -62,7 +46,7 @@ int irn_vrfy_irg(struct ir_node *checknode, ir_graph *irg);
  * \return
  *     NON-zero on success
  */
-int irn_vrfy_irg_dump(struct ir_node *checknode, ir_graph *irg, const char **bad_string);
+int irn_vrfy_irg_dump(ir_node *checknode, ir_graph *irg, const char **bad_string);
 
 /**
  * Flags for irg_verify().
@@ -97,7 +81,7 @@ enum verify_bad_flags_t {
 };
 
 /**
- * Verify occurance of bad nodes in a graph.
+ * Verify occurrence of bad nodes in a graph.
  *
  * @param irg    The graph to verify
  * @param flags  combination of verify_bad_flags_t flags describing
index e3531f6..0c5fd63 100644 (file)
 #ifndef _IRVRFY_T_H_
 #define _IRVRFY_T_H_
 
+#include "irflag_t.h"
 #include "irvrfy.h"
 #include "irdump.h"
 
-extern node_verification_t opt_do_node_verification;
 extern const char *firm_vrfy_failure_msg;
 
 #ifdef NDEBUG
@@ -33,12 +33,12 @@ extern const char *firm_vrfy_failure_msg;
 #else
 #define ASSERT_AND_RET(expr, string, ret) \
 do { \
-  if (opt_do_node_verification == NODE_VERIFICATION_ON) {\
+  if (opt_do_node_verification == FIRM_VERIFICATION_ON) {\
     if (!(expr) && current_ir_graph != get_const_code_irg()) \
       dump_ir_block_graph(current_ir_graph, "-assert"); \
     assert((expr) && string); } \
   if (!(expr)) { \
-    if (opt_do_node_verification == NODE_VERIFICATION_REPORT) \
+    if (opt_do_node_verification == FIRM_VERIFICATION_REPORT) \
       fprintf(stderr, #expr " : " string "\n"); \
     firm_vrfy_failure_msg = #expr " && " string; \
     return (ret); \
@@ -49,10 +49,10 @@ do { \
 do { \
   if (!(expr)) { \
     firm_vrfy_failure_msg = #expr " && " string; \
-    if (opt_do_node_verification != NODE_VERIFICATION_ERROR_ONLY) { blk; } \
-    if (opt_do_node_verification == NODE_VERIFICATION_REPORT) \
+    if (opt_do_node_verification != FIRM_VERIFICATION_ERROR_ONLY) { blk; } \
+    if (opt_do_node_verification == FIRM_VERIFICATION_REPORT) \
       fprintf(stderr, #expr " : " string "\n"); \
-    else if (opt_do_node_verification == NODE_VERIFICATION_ON) { \
+    else if (opt_do_node_verification == FIRM_VERIFICATION_ON) { \
       if (!(expr) && current_ir_graph != get_const_code_irg()) \
         dump_ir_block_graph(current_ir_graph, "-assert"); \
       assert((expr) && string); \