# 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 */
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;
*/
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)
{
op = get_irn_op(pred);
- if (op->verify_proj_node)
- return op->verify_proj_node(pred, p);
+ if (op->ops.verify_proj_node)
+ return op->ops.verify_proj_node(pred, p);
/* all went ok */
return 1;
);
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;
}
int i;
ir_op *op;
- if (!opt_do_node_verification)
- return 1;
+ if (!get_node_verification_mode())
+ return 1;
if (!get_interprocedural_view()) {
/*
return 1;
}
- if (op->verify_node)
- return op->verify_node(n, irg);
+ if (op->ops.verify_node)
+ return op->ops.verify_node(n, irg);
/* All went ok */
return 1;
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)
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;
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");
}
}
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");
}
}
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");
}
}
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");
}
}
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");
}
}
}
/*
- * verify occurance of bad nodes
+ * verify occurrence of bad nodes
*/
int irg_vrfy_bads(ir_graph *irg, int flags)
{
/*
* set the default verify operation
*/
-void firm_set_default_verifyer(ir_op *op)
+void firm_set_default_verifyer(opcode code, ir_op_ops *ops)
{
-#define CASE(a) \
- case iro_##a: \
- op->verify_node = verify_node_##a; \
+#define CASE(a) \
+ case iro_##a: \
+ ops->verify_node = verify_node_##a; \
break
- switch (op->code) {
+ switch (code) {
CASE(Proj);
CASE(Block);
CASE(Start);
CASE(Mux);
CASE(CopyB);
default:
- op->verify_node = NULL;
+ /* leave NULL */;
}
#undef CASE
#define CASE(a) \
case iro_##a: \
- op->verify_proj_node = verify_node_Proj_##a; \
+ ops->verify_proj_node = verify_node_Proj_##a; \
break
- switch (op->code) {
+ switch (code) {
CASE(Start);
CASE(Cond);
CASE(Raise);
CASE(EndReg);
CASE(EndExcept);
default:
- op->verify_proj_node = NULL;
+ /* leave NULL */;
}
#undef CASE
}