2 * This file contains macros to update ia32 firm statistics
3 * @author Christian Wuerdig
6 #ifndef _IA32_DBG_STAT_H_
7 #define _IA32_DBG_STAT_H_
10 #include "dbginfo_t.h"
13 #define SIZ(x) sizeof(x)/sizeof((x)[0])
16 * Merge the debug info due to a LEA creation.
18 * @param oldn the node
19 * @param n the new lea
21 #define DBG_OPT_LEA1(oldn, n) \
23 hook_merge_nodes(&n, 1, &oldn, 1, FS_BE_IA32_LEA); \
24 __dbg_info_merge_pair(n, oldn, dbg_backend); \
28 * Merge the debug info due to a LEA creation.
30 * @param oldn the node
31 * @param n the new lea
33 #define DBG_OPT_LEA1(oldn, n) \
35 hook_merge_nodes(&n, 1, &oldn, 1, FS_BE_IA32_LEA); \
36 __dbg_info_merge_pair(n, oldn, dbg_backend); \
40 * Merge the debug info due to a LEA creation.
42 * @param oldn1 the old node
43 * @param oldn2 an additional old node
44 * @param n the new lea
46 #define DBG_OPT_LEA2(oldn1, oldn2, n) \
51 hook_merge_nodes(&n, 1, ons, SIZ(ons), FS_BE_IA32_LEA); \
52 __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_backend); \
56 * Merge the debug info due to a LEA creation.
58 * @param oldn1 the old node
59 * @param oldn2 an additional old node
60 * @param oldn3 an additional old node
61 * @param n the new lea
63 #define DBG_OPT_LEA3(oldn1, oldn2, oldn3, n) \
69 hook_merge_nodes(&n, 1, ons, SIZ(ons), FS_BE_IA32_LEA); \
70 __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_backend); \
74 * Merge the debug info due to a LEA creation.
76 * @param oldn1 the old node
77 * @param oldn2 an additional old node
78 * @param oldn3 an additional old node
79 * @param oldn4 an additional old node
80 * @param n the new lea
82 #define DBG_OPT_LEA4(oldn1, oldn2, oldn3, oldn4, n) \
89 hook_merge_nodes(&n, 1, ons, SIZ(ons), FS_BE_IA32_LEA); \
90 __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_backend); \
94 * Merge the debug info due to a Load with LEA creation.
97 * @param n the new load
99 #define DBG_OPT_LOAD_LEA(oldn, n) \
101 hook_merge_nodes(&n, 1, &oldn, 1, FS_BE_IA32_LOAD_LEA); \
102 __dbg_info_merge_pair(n, oldn, dbg_backend); \
106 * Merge the debug info due to a Store with LEA creation.
108 * @param oldn the lea
109 * @param n the new store
111 #define DBG_OPT_STORE_LEA(oldn, n) \
113 hook_merge_nodes(&n, 1, &oldn, 1, FS_BE_IA32_STORE_LEA); \
114 __dbg_info_merge_pair(n, oldn, dbg_backend); \
118 * Merge the debug info due to a source address mode creation.
120 * @param oldn the old load
121 * @param n the new op
123 #define DBG_OPT_AM_S(oldn, n) \
125 hook_merge_nodes(&n, 1, &oldn, 1, FS_BE_IA32_AM_S); \
126 __dbg_info_merge_pair(n, oldn, dbg_backend); \
130 * Merge the debug info due to a destination address mode creation.
132 * @param load the old load
133 * @param store yhe old store
134 * @param n the new op
136 #define DBG_OPT_AM_D(load, store, n) \
141 hook_merge_nodes(&n, 1, ons, SIZ(ons), FS_BE_IA32_AM_D); \
142 __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_backend); \
146 * A CJmp was created to save a cmp
148 * @param oldn the old node
150 #define DBG_OPT_CJMP(oldn) \
152 hook_merge_nodes(NULL, 0, &oldn, 1, FS_BE_IA32_CJMP); \
156 * A Copy was created to fullfill two address code constraints
158 * @param cpy the copy
160 #define DBG_OPT_2ADDRCPY(cpy) \
162 hook_merge_nodes(NULL, 0, &cpy, 1, FS_BE_IA32_2ADDRCPY); \
166 * A Store was created for a Spill
168 * @param spill the Spill
169 * @param store the Store
171 #define DBG_OPT_SPILL2ST(spill, store) \
173 hook_merge_nodes(&store, 1, &spill, 1, FS_BE_IA32_SPILL2ST); \
174 __dbg_info_merge_pair(store, spill, dbg_backend); \
178 * A Load was created for a Reload
180 * @param rload the Reload
181 * @param load the Load
183 #define DBG_OPT_RELOAD2LD(rload, load) \
185 hook_merge_nodes(&load, 1, &rload, 1, FS_BE_IA32_RELOAD2LD); \
186 __dbg_info_merge_pair(load, rload, dbg_backend); \
190 * A Sub was transformed into Neg-Add due to 2 address code limitations
192 * @param sub the old Sub
193 * @param nadd the new Add
195 #define DBG_OPT_SUB2NEGADD(sub, nadd) \
197 hook_merge_nodes(&nadd, 1, &sub, 1, FS_BE_IA32_SUB2NEGADD); \
198 __dbg_info_merge_pair(nadd, sub, dbg_backend); \
202 * A Lea was transformed back into an Add
204 * @param lea the old Lea
205 * @param nadd the new Add
207 #define DBG_OPT_LEA2ADD(lea, nadd) \
209 hook_merge_nodes(&nadd, 1, &lea, 1, FS_BE_IA32_LEA2ADD); \
210 __dbg_info_merge_pair(nadd, lea, dbg_backend); \
213 #endif /* _IA32_DBG_STAT_H_ */