2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
8 * @brief Check irnodes for correctness.
9 * @author Christian Schaefer, Goetz Lindenmaier, Till Riedel
11 #ifndef FIRM_IR_IRVERIFY_H
12 #define FIRM_IR_IRVERIFY_H
14 #include "firm_types.h"
18 * @defgroup irverify Correctness Tests
23 * Tests the modes of checknode and its predecessors.
25 * @return NON-zero on success
27 FIRM_API int irn_verify(const ir_node *checknode);
30 * Tests the modes of checknode and its predecessors.
31 * checknode must be in given ir_graph.
33 * @return NON-zero on success
35 FIRM_API int irn_verify_irg(const ir_node *checknode, ir_graph *irg);
38 * Same as irn_verify_irg, but temporary sets verification mode to
39 * NODE_VERIFICATION_ERROR_ONLY.
40 * @return NON-zero on success
42 FIRM_API int irn_verify_irg_dump(const ir_node *checknode, ir_graph *irg,
43 const char **bad_string);
46 * Flags for irg_verify().
48 typedef enum irg_verify_flags_t {
49 VERIFY_NORMAL = 0, /**< check SSA property only if dominance information is available */
50 VERIFY_ENFORCE_SSA = 1 /**< check SSA property by enforcing the dominance information recalculation */
54 * Calls irn_verify() for each node in irg.
55 * Graph must be in state "op_pin_state_pinned".
57 * @param irg the IR-graph t check
58 * @param flags one of irg_verify_flags_t
60 * @return NON-zero on success.
62 FIRM_API int irg_verify(ir_graph *irg, unsigned flags);
65 * Creates an ir_graph pass for irg_verify().
67 * @param name the name of this pass or NULL
68 * @param flags one of irg_verify_flags_t
70 * @return the newly created ir_graph pass
72 FIRM_API ir_graph_pass_t *irg_verify_pass(const char *name, unsigned flags);
75 * Possible flags for irg_verify_bads().
77 enum verify_bad_flags_t {
78 BAD_CF = 1, /**< Bad nodes are allowed as predecessors of Blocks and Phis. */
79 BAD_DF = 2, /**< Bad nodes are allowed as dataflow predecessors. */
80 BAD_BLOCK = 4, /**< Bad nodes are allowed as Block input. */
81 TUPLE = 8 /**< Tuple nodes are allowed. */
85 * Verify occurrence of bad nodes in a graph.
87 * @param irg The graph to verify
88 * @param flags combination of verify_bad_flags_t flags describing
89 * which Bads are allowed
90 * @returns a value combined of verify_bad_flags_t indicating the problems found.
92 FIRM_API int irg_verify_bads(ir_graph *irg, int flags);