2 * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * @brief New checker of irnodes for correctness.
23 * @author Michael Beck
25 #ifndef FIRM_IR_IRVERIFY_T_H
26 #define FIRM_IR_IRVERIFY_T_H
34 extern const char *firm_verify_failure_msg;
38 * in RELEASE mode, returns ret if the expression expr evaluates to zero
39 * in ASSERT mode, asserts the expression expr (and the string string).
41 #define ASSERT_AND_RET(expr, string, ret) do { if (!(expr)) return (ret); } while (0)
44 * in RELEASE mode, returns ret if the expression expr evaluates to zero
45 * in ASSERT mode, executes blk if the expression expr evaluates to zero and asserts expr
47 #define ASSERT_AND_RET_DBG(expr, string, ret, blk) do { if (!(expr)) return (ret); } while (0)
49 #define ASSERT_AND_RET(expr, string, ret) \
51 if (opt_do_node_verification == FIRM_VERIFICATION_ON) {\
52 if (!(expr) && current_ir_graph != get_const_code_irg()) \
53 dump_ir_graph(current_ir_graph, "assert"); \
54 assert((expr) && string); } \
56 if (opt_do_node_verification == FIRM_VERIFICATION_REPORT) \
57 fprintf(stderr, #expr " : " string "\n"); \
58 firm_verify_failure_msg = #expr " && " string; \
63 #define ASSERT_AND_RET_DBG(expr, string, ret, blk) \
66 firm_verify_failure_msg = #expr " && " string; \
67 if (opt_do_node_verification != FIRM_VERIFICATION_ERROR_ONLY) { blk } \
68 if (opt_do_node_verification == FIRM_VERIFICATION_REPORT) \
69 fprintf(stderr, #expr " : " string "\n"); \
70 else if (opt_do_node_verification == FIRM_VERIFICATION_ON) { \
71 if (!(expr) && current_ir_graph != get_const_code_irg()) \
72 dump_ir_graph(current_ir_graph, "assert"); \
73 assert((expr) && string); \
82 * Set the default verify_node and verify_proj_node operation for an ir_op_ops.
84 void firm_set_default_verifier(unsigned code, ir_op_ops *ops);