get_irn_n_edges: out_count still broken, switched back to recalculation
[libfirm] / ir / ir / irvrfy.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/ir/irvrfy.h
4  * Purpose:     Check irnodes for correctness.
5  * Author:      Christian Schaefer
6  * Modified by: Goetz Lindenmaier. Till Riedel
7  * Created:
8  * CVS-ID:      $Id$
9  * Copyright:   (c) 1998-2003 Universität Karlsruhe
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12
13 /**
14  * @file irvrfy.h
15  *
16  * ir graph verification.
17  *
18  * @author Christian Schaefer
19  */
20 #ifndef _FIRM_IR_IRVRFY_H_
21 #define _FIRM_IR_IRVRFY_H_
22
23 #include "firm_types.h"
24
25 /**
26  * Tests the modes of checknode and its predecessors.
27  * checknode must be in current_ir_graph.
28  *
29  * @return
30  *      NON-zero on success
31  */
32 int irn_vrfy(ir_node *checknode);
33
34 /**
35  * Tests the modes of checknode and its predecessors.
36  * checknode must be in given ir_graph.
37  *
38  * @return
39  *      NON-zero on success
40  */
41 int irn_vrfy_irg(ir_node *checknode, ir_graph *irg);
42
43 /**
44  * Same as irn_vrfy_irg, but temporary sets verification mode to
45  * NODE_VERIFICATION_ERROR_ONLY.
46  * @return
47  *      NON-zero on success
48  */
49 int irn_vrfy_irg_dump(ir_node *checknode, ir_graph *irg, const char **bad_string);
50
51 /**
52  * Flags for irg_verify().
53  */
54 typedef enum _irg_verify_flags_t {
55   VRFY_NORMAL      = 0,      /**< check SSA property only if dominance information is available */
56   VRFY_ENFORCE_SSA = 1       /**< check SSA property by enforcing the dominance information recalculation */
57 } irg_verify_flags_t;
58
59 /**
60  * Calls irn_vrfy() for each node in irg.
61  * Graph must be in state "op_pin_state_pinned".
62  *
63  * @return
64  *      NON-zero on success.
65  */
66 int irg_verify(ir_graph *irg, unsigned flags);
67
68 /**
69  * Compatibility macro. Deprecated soon.
70  */
71 #define irg_vrfy(irg) irg_verify(irg, 0)
72
73 /**
74  * Possible flags for irg_vrfy_bads().
75  */
76 enum verify_bad_flags_t {
77   BAD_CF      = 1,      /**< Bad nodes are allowed as predecessors of Blocks and Phis. */
78   BAD_DF      = 2,      /**< Bad nodes are allowed as dataflow predecessors. */
79   BAD_BLOCK   = 4,      /**< Bad nodes are allowed as Block input. */
80   TUPLE       = 8       /**< Tuple nodes are allowed. */
81 };
82
83 /**
84  * Verify occurrence of bad nodes in a graph.
85  *
86  * @param irg    The graph to verify
87  * @param flags  combination of verify_bad_flags_t flags describing
88  *               which Bads are allowed
89  * @returns      a value combined of verify_bad_flags_t indicating the problems found.
90  */
91 int irg_vrfy_bads(ir_graph *irg, int flags);
92
93 /**
94  *  Enable/disable verification of Load/Store nodes with
95  *  its entities. If disabled, Store(SymConst(array)) will be allowed
96  *  (C-frontend builds this :-)
97  */
98 void vrfy_enable_entity_tests(int enable);
99
100 #endif /* _FIRM_IR_IRVRFY_H_ */