2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
8 * @brief This file contains macros to update ia32 firm statistics.
9 * @author Christian Wuerdig
11 #ifndef FIRM_BE_IA32_IA32_DBG_STAT_H
12 #define FIRM_BE_IA32_IA32_DBG_STAT_H
15 #include "dbginfo_t.h"
20 * Merge the debug info due to a LEA creation.
22 * @param oldn the node
23 * @param n the new lea
25 #define DBG_OPT_LEA1(oldn, n) \
27 hook_merge_nodes(&n, 1, &oldn, 1, FS_BE_IA32_LEA); \
28 __dbg_info_merge_pair(n, oldn, dbg_backend); \
32 * Merge the debug info due to a LEA creation.
34 * @param oldn the node
35 * @param n the new lea
37 #define DBG_OPT_LEA1(oldn, n) \
39 hook_merge_nodes(&n, 1, &oldn, 1, FS_BE_IA32_LEA); \
40 __dbg_info_merge_pair(n, oldn, dbg_backend); \
44 * Merge the debug info due to a LEA creation.
46 * @param oldn1 the old node
47 * @param oldn2 an additional old node
48 * @param n the new lea
50 #define DBG_OPT_LEA2(oldn1, oldn2, n) \
55 hook_merge_nodes(&n, 1, ons, ARRAY_SIZE(ons), FS_BE_IA32_LEA); \
56 __dbg_info_merge_sets(&n, 1, ons, ARRAY_SIZE(ons), dbg_backend); \
60 * Merge the debug info due to a LEA creation.
62 * @param oldn1 the old node
63 * @param oldn2 an additional old node
64 * @param oldn3 an additional old node
65 * @param n the new lea
67 #define DBG_OPT_LEA3(oldn1, oldn2, oldn3, n) \
73 hook_merge_nodes(&n, 1, ons, ARRAY_SIZE(ons), FS_BE_IA32_LEA); \
74 __dbg_info_merge_sets(&n, 1, ons, ARRAY_SIZE(ons), dbg_backend); \
78 * Merge the debug info due to a LEA creation.
80 * @param oldn1 the old node
81 * @param oldn2 an additional old node
82 * @param oldn3 an additional old node
83 * @param oldn4 an additional old node
84 * @param n the new lea
86 #define DBG_OPT_LEA4(oldn1, oldn2, oldn3, oldn4, n) \
93 hook_merge_nodes(&n, 1, ons, ARRAY_SIZE(ons), FS_BE_IA32_LEA); \
94 __dbg_info_merge_sets(&n, 1, ons, ARRAY_SIZE(ons), dbg_backend); \
98 * Merge the debug info due to a Load with LEA creation.
100 * @param oldn the lea
101 * @param n the new load
103 #define DBG_OPT_LOAD_LEA(oldn, n) \
105 hook_merge_nodes(&n, 1, &oldn, 1, (hook_opt_kind)FS_BE_IA32_LOAD_LEA); \
106 __dbg_info_merge_pair(n, oldn, dbg_backend); \
110 * Merge the debug info due to a Store with LEA creation.
112 * @param oldn the lea
113 * @param n the new store
115 #define DBG_OPT_STORE_LEA(oldn, n) \
117 hook_merge_nodes(&n, 1, &oldn, 1, (hook_opt_kind)FS_BE_IA32_STORE_LEA); \
118 __dbg_info_merge_pair(n, oldn, dbg_backend); \
122 * Merge the debug info due to a source address mode creation.
124 * @param oldn the old load
125 * @param n the new op
127 #define DBG_OPT_AM_S(oldn, n) \
129 hook_merge_nodes(&n, 1, &oldn, 1, (hook_opt_kind)FS_BE_IA32_AM_S); \
130 __dbg_info_merge_pair(n, oldn, dbg_backend); \
134 * Merge the debug info due to a destination address mode creation.
136 * @param load the old load
137 * @param store the old store
138 * @param n the new op
140 #define DBG_OPT_AM_D(load, store, n) \
145 hook_merge_nodes(&n, 1, ons, ARRAY_SIZE(ons), FS_BE_IA32_AM_D); \
146 __dbg_info_merge_sets(&n, 1, ons, ARRAY_SIZE(ons), dbg_backend); \
150 * A CJmp was created to save a cmp
152 * @param oldn the old node
154 #define DBG_OPT_CJMP(oldn) \
156 hook_merge_nodes(NULL, 0, &oldn, 1, FS_BE_IA32_CJMP); \
160 * A Copy was created to fulfill two address code constraints
162 * @param cpy the copy
164 #define DBG_OPT_2ADDRCPY(cpy) \
166 hook_merge_nodes(NULL, 0, &cpy, 1, (hook_opt_kind)FS_BE_IA32_2ADDRCPY); \
170 * A Store was created for a Spill
172 * @param spill the Spill
173 * @param store the Store
175 #define DBG_OPT_SPILL2ST(spill, store) \
177 hook_merge_nodes(&store, 1, &spill, 1, (hook_opt_kind)FS_BE_IA32_SPILL2ST); \
178 __dbg_info_merge_pair(store, spill, dbg_backend); \
182 * A Load was created for a Reload
184 * @param rload the Reload
185 * @param load the Load
187 #define DBG_OPT_RELOAD2LD(rload, load) \
189 hook_merge_nodes(&load, 1, &rload, 1, (hook_opt_kind)FS_BE_IA32_RELOAD2LD); \
190 __dbg_info_merge_pair(load, rload, dbg_backend); \
194 * A Sub was transformed into Neg-Add due to 2 address code limitations
196 * @param sub the old Sub
197 * @param nadd the new Add
199 #define DBG_OPT_SUB2NEGADD(sub, nadd) \
201 hook_merge_nodes(&nadd, 1, &sub, 1, (hook_opt_kind)FS_BE_IA32_SUB2NEGADD); \
202 __dbg_info_merge_pair(nadd, sub, dbg_backend); \
206 * A Lea was transformed back into an Add
208 * @param lea the old Lea
209 * @param nadd the new Add
211 #define DBG_OPT_LEA2ADD(lea, nadd) \
213 hook_merge_nodes(&nadd, 1, &lea, 1, (hook_opt_kind)FS_BE_IA32_LEA2ADD); \
214 __dbg_info_merge_pair(nadd, lea, dbg_backend); \
217 #endif /* FIRM_BE_IA32_IA32_DBG_STAT_H */