3 * File name: ir/ir/irvrfy.h
4 * Purpose: Check irnodes for correctness.
5 * Author: Christian Schaefer
6 * Modified by: Goetz Lindenmaier. Till Riedel
9 * Copyright: (c) 1998-2003 Universität Karlsruhe
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
16 * ir graph verification.
18 * @author Christian Schaefer
27 typedef enum _node_verification_t {
28 NODE_VERIFICATION_OFF = 0, /**< do not verify nodes at all */
29 NODE_VERIFICATION_ON = 1, /**< do node verification and assert on error in debug version */
30 NODE_VERIFICATION_REPORT = 2, /**< do node verification, but report to stderr only */
31 NODE_VERIFICATION_ERROR_ONLY = 3 /**< do node verification, but NEVER do assert nor report */
32 } node_verification_t;
34 /** Select verification of nodes.
36 * Per default the verification is in mode NODE_VERIFICATION_ASSERT.
37 * Turn the verification off during development to check partial implementations.
39 void do_node_verification(node_verification_t mode);
42 * Tests the modes of checknode and its predecessors.
43 * Checknode must be in current_ir_graph.
48 int irn_vrfy(struct ir_node *checknode);
51 * Tests the modes of checknode and its predecessors.
52 * Checknode must be in given ir_graph.
57 int irn_vrfy_irg(struct ir_node *checknode, ir_graph *irg);
60 * Same as irn_vrfy_irg, but temporary sets verification mode to
61 * NODE_VERIFICATION_ERROR_ONLY.
65 int irn_vrfy_irg_dump(struct ir_node *checknode, ir_graph *irg, const char **bad_string);
68 * Flags for irg_verify().
70 typedef enum _irg_verify_flags_t {
71 VRFY_NORMAL = 0, /**< check SSA property only if dominance information is available */
72 VRFY_ENFORCE_SSA = 1 /**< check SSA property by enforcing the dominance information recalculation */
76 * Calls irn_vrfy() for each node in irg.
77 * Graph must be in state "op_pin_state_pinned".
80 * NON-zero on success.
82 int irg_verify(ir_graph *irg, unsigned flags);
85 * Compatibility macro. Deprecated soon.
87 #define irg_vrfy(irg) irg_verify(irg, 0)
90 * Possible flags for irg_vrfy_bads().
92 enum verify_bad_flags_t {
93 BAD_CF = 1, /**< Bad nodes are allowed as predecessors of Blocks and Phis. */
94 BAD_DF = 2, /**< Bad nodes are allowed as dataflow predecessors. */
95 BAD_BLOCK = 4, /**< Bad nodes are allowed as Block input. */
96 TUPLE = 8 /**< Tuple nodes are allowed. */
100 * Verify occurance of bad nodes in a graph.
102 * @param irg The graph to verify
103 * @param flags combination of verify_bad_flags_t flags describing
104 * which Bads are allowed
105 * @returns a value combined of verify_bad_flags_t indicating the problems found.
107 int irg_vrfy_bads(ir_graph *irg, int flags);
110 * Enable/disable verification of Load/Store nodes with
111 * its entities. If disabled, Store(SymConst(array)) will be allowed
112 * (C-frontend builds this :-)
114 void vrfy_enable_entity_tests(int enable);
116 # endif /* _IRVRFY_H_ */