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 This file contains macros to update ia32 firm statistics.
23 * @author Christian Wuerdig
26 #ifndef FIRM_BE_IA32_IA32_DBG_STAT_H
27 #define FIRM_BE_IA32_IA32_DBG_STAT_H
30 #include "dbginfo_t.h"
33 #define SIZ(x) sizeof(x)/sizeof((x)[0])
36 * Merge the debug info due to a LEA creation.
38 * @param oldn the node
39 * @param n the new lea
41 #define DBG_OPT_LEA1(oldn, n) \
43 hook_merge_nodes(&n, 1, &oldn, 1, FS_BE_IA32_LEA); \
44 __dbg_info_merge_pair(n, oldn, dbg_backend); \
48 * Merge the debug info due to a LEA creation.
50 * @param oldn the node
51 * @param n the new lea
53 #define DBG_OPT_LEA1(oldn, n) \
55 hook_merge_nodes(&n, 1, &oldn, 1, FS_BE_IA32_LEA); \
56 __dbg_info_merge_pair(n, oldn, 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 n the new lea
66 #define DBG_OPT_LEA2(oldn1, oldn2, n) \
71 hook_merge_nodes(&n, 1, ons, SIZ(ons), FS_BE_IA32_LEA); \
72 __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_backend); \
76 * Merge the debug info due to a LEA creation.
78 * @param oldn1 the old node
79 * @param oldn2 an additional old node
80 * @param oldn3 an additional old node
81 * @param n the new lea
83 #define DBG_OPT_LEA3(oldn1, oldn2, oldn3, 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 LEA creation.
96 * @param oldn1 the old node
97 * @param oldn2 an additional old node
98 * @param oldn3 an additional old node
99 * @param oldn4 an additional old node
100 * @param n the new lea
102 #define DBG_OPT_LEA4(oldn1, oldn2, oldn3, oldn4, n) \
109 hook_merge_nodes(&n, 1, ons, SIZ(ons), FS_BE_IA32_LEA); \
110 __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_backend); \
114 * Merge the debug info due to a Load with LEA creation.
116 * @param oldn the lea
117 * @param n the new load
119 #define DBG_OPT_LOAD_LEA(oldn, n) \
121 hook_merge_nodes(&n, 1, &oldn, 1, FS_BE_IA32_LOAD_LEA); \
122 __dbg_info_merge_pair(n, oldn, dbg_backend); \
126 * Merge the debug info due to a Store with LEA creation.
128 * @param oldn the lea
129 * @param n the new store
131 #define DBG_OPT_STORE_LEA(oldn, n) \
133 hook_merge_nodes(&n, 1, &oldn, 1, FS_BE_IA32_STORE_LEA); \
134 __dbg_info_merge_pair(n, oldn, dbg_backend); \
138 * Merge the debug info due to a source address mode creation.
140 * @param oldn the old load
141 * @param n the new op
143 #define DBG_OPT_AM_S(oldn, n) \
145 hook_merge_nodes(&n, 1, &oldn, 1, FS_BE_IA32_AM_S); \
146 __dbg_info_merge_pair(n, oldn, dbg_backend); \
150 * Merge the debug info due to a destination address mode creation.
152 * @param load the old load
153 * @param store the old store
154 * @param n the new op
156 #define DBG_OPT_AM_D(load, store, n) \
161 hook_merge_nodes(&n, 1, ons, SIZ(ons), FS_BE_IA32_AM_D); \
162 __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_backend); \
166 * A CJmp was created to save a cmp
168 * @param oldn the old node
170 #define DBG_OPT_CJMP(oldn) \
172 hook_merge_nodes(NULL, 0, &oldn, 1, FS_BE_IA32_CJMP); \
176 * A Copy was created to fulfill two address code constraints
178 * @param cpy the copy
180 #define DBG_OPT_2ADDRCPY(cpy) \
182 hook_merge_nodes(NULL, 0, &cpy, 1, FS_BE_IA32_2ADDRCPY); \
186 * A Store was created for a Spill
188 * @param spill the Spill
189 * @param store the Store
191 #define DBG_OPT_SPILL2ST(spill, store) \
193 hook_merge_nodes(&store, 1, &spill, 1, FS_BE_IA32_SPILL2ST); \
194 __dbg_info_merge_pair(store, spill, dbg_backend); \
198 * A Load was created for a Reload
200 * @param rload the Reload
201 * @param load the Load
203 #define DBG_OPT_RELOAD2LD(rload, load) \
205 hook_merge_nodes(&load, 1, &rload, 1, FS_BE_IA32_RELOAD2LD); \
206 __dbg_info_merge_pair(load, rload, dbg_backend); \
210 * A Sub was transformed into Neg-Add due to 2 address code limitations
212 * @param sub the old Sub
213 * @param nadd the new Add
215 #define DBG_OPT_SUB2NEGADD(sub, nadd) \
217 hook_merge_nodes(&nadd, 1, &sub, 1, FS_BE_IA32_SUB2NEGADD); \
218 __dbg_info_merge_pair(nadd, sub, dbg_backend); \
222 * A Lea was transformed back into an Add
224 * @param lea the old Lea
225 * @param nadd the new Add
227 #define DBG_OPT_LEA2ADD(lea, nadd) \
229 hook_merge_nodes(&nadd, 1, &lea, 1, FS_BE_IA32_LEA2ADD); \
230 __dbg_info_merge_pair(nadd, lea, dbg_backend); \
233 #endif /* FIRM_BE_IA32_IA32_DBG_STAT_H */