some simple optimizations for execution speed
[libfirm] / ir / ir / iropt_dbg.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/ir/iropt_dbg.h
4  * Purpose:     Debug makros used in iropt.
5  * Author:      Goetz Lindenmaier
6  * Modified by:
7  * Created:
8  * CVS-ID:      $Id$
9  * Copyright:   (c) 2001-2003 Universität Karlsruhe
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12
13
14 /* This file contains makros that generate the calls to
15    update the debug information after a transformation. */
16
17 #define SIZ(x)    sizeof(x)/sizeof((x)[0])
18
19 /**
20  * Merge the debug info due to a straightening optimization
21  */
22 #define DBG_OPT_STG                                                \
23   do {                                                       \
24           ir_node *ons[2];                                         \
25           ons[0] = oldn;                                           \
26           ons[1] = get_Block_cfgpred(oldn, 0);                     \
27           __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_straightening); \
28         } while(0)
29
30 /**
31  * Merge the debug info due to an if simplification
32  */
33 #define DBG_OPT_IFSIM                                                 \
34   do {                                                          \
35           ir_node *ons[4];                                            \
36           ons[0] = oldn;                                                 \
37           ons[1] = a;                                                 \
38           ons[2] = b;                                                 \
39           ons[3] = get_Proj_pred(a);                                  \
40           __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_if_simplification); \
41         } while(0)
42
43 /**
44  * Merge the debug info due to an algebraic_simplification
45  */
46 #define DBG_OPT_ALGSIM1                                               \
47   do {                                                          \
48           ir_node *ons[3];                                            \
49           ons[0] = oldn;                                              \
50           ons[1] = a;                                                 \
51           ons[2] = b;                                                 \
52           __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_algebraic_simplification); \
53         } while(0)
54
55 #define DBG_OPT_ALGSIM2                                               \
56   do {                                                          \
57           ir_node *ons[3];                                            \
58           ons[0] = oldn;                                              \
59           ons[1] = get_unop_op(n);                                    \
60           ons[2] = n;                                                 \
61           __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_algebraic_simplification); \
62         } while(0)
63
64 #define DBG_OPT_ALGSIM3                                               \
65   do {                                                          \
66           ir_node *ons[2];                                            \
67           ons[0] = oldn;                                              \
68           ons[1] = a;                                                 \
69           __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_algebraic_simplification); \
70         } while(0)
71
72 #define DBG_OPT_PHI                                                   \
73   do {                                                          \
74           ir_node *ons[2];                                            \
75           ons[0] = oldn;                                              \
76           ons[1] = first_val;                                         \
77           __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_opt_ssa);          \
78         } while(0)
79
80
81 #define DBG_OPT_WAW                                                   \
82   do {                                                          \
83           ir_node *ons[2];                                            \
84           ons[0] = oldn;                                              \
85           ons[1] = n;                                                 \
86           __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_write_after_write);\
87         } while(0)
88
89 #define DBG_OPT_WAR                                                   \
90   do {                                                          \
91           ir_node *ons[2];                                            \
92           ons[0] = oldn;                                              \
93           ons[1] = c;                                                 \
94           __dbg_info_merge_sets(&c, 1, ons, SIZ(ons), dbg_write_after_read); \
95         } while(0)
96
97 #define DBG_OPT_TUPLE                                                 \
98   do {                                                          \
99           ir_node *ons[3];                                            \
100           ons[0] = oldn;                                              \
101           ons[1] = a;                                                 \
102           ons[2] = n;                                                 \
103           __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_opt_auxnode);      \
104         } while(0)
105
106 #define DBG_OPT_ID                                                \
107   do {                                                          \
108           ir_node *ons[2];                                            \
109           ons[0] = oldn;                                              \
110           ons[1] = n;                                                 \
111           __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_opt_auxnode);      \
112         } while(0)