becopyheur2: Remove unnecessary indirection.
[libfirm] / include / libfirm / irverify.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5
6 /**
7  * @file
8  * @brief    Check irnodes for correctness.
9  * @author   Christian Schaefer, Goetz Lindenmaier, Till Riedel
10  */
11 #ifndef FIRM_IR_IRVERIFY_H
12 #define FIRM_IR_IRVERIFY_H
13
14 #include "firm_types.h"
15 #include "begin.h"
16
17 /**
18  * @defgroup irverify  Correctness Tests
19  * @{
20  */
21
22 /**
23  * Tests the modes of checknode and its predecessors.
24  *
25  * @return NON-zero on success
26  */
27 FIRM_API int irn_verify(const ir_node *checknode);
28
29 /**
30  * Tests the modes of checknode and its predecessors.
31  * checknode must be in given ir_graph.
32  *
33  * @return NON-zero on success
34  */
35 FIRM_API int irn_verify_irg(const ir_node *checknode, ir_graph *irg);
36
37 /**
38  * Same as irn_verify_irg, but temporary sets verification mode to
39  * NODE_VERIFICATION_ERROR_ONLY.
40  * @return NON-zero on success
41  */
42 FIRM_API int irn_verify_irg_dump(const ir_node *checknode, ir_graph *irg,
43                                  const char **bad_string);
44
45 /**
46  * Flags for irg_verify().
47  */
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 */
51 } irg_verify_flags_t;
52
53 /**
54  * Calls irn_verify() for each node in irg.
55  * Graph must be in state "op_pin_state_pinned".
56  *
57  * @param irg    the IR-graph t check
58  * @param flags  one of irg_verify_flags_t
59  *
60  * @return NON-zero on success.
61  */
62 FIRM_API int irg_verify(ir_graph *irg, unsigned flags);
63
64 /**
65  * Creates an ir_graph pass for irg_verify().
66  *
67  * @param name   the name of this pass or NULL
68  * @param flags  one of irg_verify_flags_t
69  *
70  * @return  the newly created ir_graph pass
71  */
72 FIRM_API ir_graph_pass_t *irg_verify_pass(const char *name, unsigned flags);
73
74 /**
75  * Possible flags for irg_verify_bads().
76  */
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. */
82 };
83
84 /**
85  * Verify occurrence of bad nodes in a graph.
86  *
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.
91  */
92 FIRM_API int irg_verify_bads(ir_graph *irg, int flags);
93
94 /** @} */
95
96 #include "end.h"
97
98 #endif