2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
8 * @brief New checker of irnodes for correctness.
11 #ifndef FIRM_IR_IRVERIFY_T_H
12 #define FIRM_IR_IRVERIFY_T_H
20 extern const char *firm_verify_failure_msg;
24 * in RELEASE mode, returns ret if the expression expr evaluates to zero
25 * in ASSERT mode, asserts the expression expr (and the string string).
27 #define ASSERT_AND_RET(expr, string, ret) do { if (!(expr)) return (ret); } while (0)
30 * in RELEASE mode, returns ret if the expression expr evaluates to zero
31 * in ASSERT mode, executes blk if the expression expr evaluates to zero and asserts expr
33 #define ASSERT_AND_RET_DBG(expr, string, ret, blk) do { if (!(expr)) return (ret); } while (0)
35 #define ASSERT_AND_RET(expr, string, ret) \
37 if (opt_do_node_verification == FIRM_VERIFICATION_ON) {\
38 if (!(expr) && current_ir_graph != get_const_code_irg()) \
39 dump_ir_graph(current_ir_graph, "assert"); \
40 assert((expr) && string); } \
42 if (opt_do_node_verification == FIRM_VERIFICATION_REPORT) \
43 fprintf(stderr, #expr " : " string "\n"); \
44 firm_verify_failure_msg = #expr " && " string; \
49 #define ASSERT_AND_RET_DBG(expr, string, ret, blk) \
52 firm_verify_failure_msg = #expr " && " string; \
53 if (opt_do_node_verification != FIRM_VERIFICATION_ERROR_ONLY) { blk } \
54 if (opt_do_node_verification == FIRM_VERIFICATION_REPORT) \
55 fprintf(stderr, #expr " : " string "\n"); \
56 else if (opt_do_node_verification == FIRM_VERIFICATION_ON) { \
57 if (!(expr) && current_ir_graph != get_const_code_irg()) \
58 dump_ir_graph(current_ir_graph, "assert"); \
59 assert((expr) && string); \
68 * Set the default verify_node and verify_proj_node operations.
70 void ir_register_verify_node_ops(void);