2 * Copyright (C) 1995-2007 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
21 * This file contains macros to update ia32 firm statistics
22 * @author Christian Wuerdig
25 #ifndef _IA32_DBG_STAT_H_
26 #define _IA32_DBG_STAT_H_
29 #include "dbginfo_t.h"
32 #define SIZ(x) sizeof(x)/sizeof((x)[0])
35 * Merge the debug info due to a LEA creation.
37 * @param oldn the node
38 * @param n the new lea
40 #define DBG_OPT_LEA1(oldn, n) \
42 hook_merge_nodes(&n, 1, &oldn, 1, FS_BE_IA32_LEA); \
43 __dbg_info_merge_pair(n, oldn, dbg_backend); \
47 * Merge the debug info due to a LEA creation.
49 * @param oldn the node
50 * @param n the new lea
52 #define DBG_OPT_LEA1(oldn, n) \
54 hook_merge_nodes(&n, 1, &oldn, 1, FS_BE_IA32_LEA); \
55 __dbg_info_merge_pair(n, oldn, dbg_backend); \
59 * Merge the debug info due to a LEA creation.
61 * @param oldn1 the old node
62 * @param oldn2 an additional old node
63 * @param n the new lea
65 #define DBG_OPT_LEA2(oldn1, oldn2, n) \
70 hook_merge_nodes(&n, 1, ons, SIZ(ons), FS_BE_IA32_LEA); \
71 __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_backend); \
75 * Merge the debug info due to a LEA creation.
77 * @param oldn1 the old node
78 * @param oldn2 an additional old node
79 * @param oldn3 an additional old node
80 * @param n the new lea
82 #define DBG_OPT_LEA3(oldn1, oldn2, oldn3, n) \
88 hook_merge_nodes(&n, 1, ons, SIZ(ons), FS_BE_IA32_LEA); \
89 __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_backend); \
93 * Merge the debug info due to a LEA creation.
95 * @param oldn1 the old node
96 * @param oldn2 an additional old node
97 * @param oldn3 an additional old node
98 * @param oldn4 an additional old node
99 * @param n the new lea
101 #define DBG_OPT_LEA4(oldn1, oldn2, oldn3, oldn4, n) \
108 hook_merge_nodes(&n, 1, ons, SIZ(ons), FS_BE_IA32_LEA); \
109 __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_backend); \
113 * Merge the debug info due to a Load with LEA creation.
115 * @param oldn the lea
116 * @param n the new load
118 #define DBG_OPT_LOAD_LEA(oldn, n) \
120 hook_merge_nodes(&n, 1, &oldn, 1, FS_BE_IA32_LOAD_LEA); \
121 __dbg_info_merge_pair(n, oldn, dbg_backend); \
125 * Merge the debug info due to a Store with LEA creation.
127 * @param oldn the lea
128 * @param n the new store
130 #define DBG_OPT_STORE_LEA(oldn, n) \
132 hook_merge_nodes(&n, 1, &oldn, 1, FS_BE_IA32_STORE_LEA); \
133 __dbg_info_merge_pair(n, oldn, dbg_backend); \
137 * Merge the debug info due to a source address mode creation.
139 * @param oldn the old load
140 * @param n the new op
142 #define DBG_OPT_AM_S(oldn, n) \
144 hook_merge_nodes(&n, 1, &oldn, 1, FS_BE_IA32_AM_S); \
145 __dbg_info_merge_pair(n, oldn, dbg_backend); \
149 * Merge the debug info due to a destination address mode creation.
151 * @param load the old load
152 * @param store yhe old store
153 * @param n the new op
155 #define DBG_OPT_AM_D(load, store, n) \
160 hook_merge_nodes(&n, 1, ons, SIZ(ons), FS_BE_IA32_AM_D); \
161 __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_backend); \
165 * A CJmp was created to save a cmp
167 * @param oldn the old node
169 #define DBG_OPT_CJMP(oldn) \
171 hook_merge_nodes(NULL, 0, &oldn, 1, FS_BE_IA32_CJMP); \
175 * A Copy was created to fullfill two address code constraints
177 * @param cpy the copy
179 #define DBG_OPT_2ADDRCPY(cpy) \
181 hook_merge_nodes(NULL, 0, &cpy, 1, FS_BE_IA32_2ADDRCPY); \
185 * A Store was created for a Spill
187 * @param spill the Spill
188 * @param store the Store
190 #define DBG_OPT_SPILL2ST(spill, store) \
192 hook_merge_nodes(&store, 1, &spill, 1, FS_BE_IA32_SPILL2ST); \
193 __dbg_info_merge_pair(store, spill, dbg_backend); \
197 * A Load was created for a Reload
199 * @param rload the Reload
200 * @param load the Load
202 #define DBG_OPT_RELOAD2LD(rload, load) \
204 hook_merge_nodes(&load, 1, &rload, 1, FS_BE_IA32_RELOAD2LD); \
205 __dbg_info_merge_pair(load, rload, dbg_backend); \
209 * A Sub was transformed into Neg-Add due to 2 address code limitations
211 * @param sub the old Sub
212 * @param nadd the new Add
214 #define DBG_OPT_SUB2NEGADD(sub, nadd) \
216 hook_merge_nodes(&nadd, 1, &sub, 1, FS_BE_IA32_SUB2NEGADD); \
217 __dbg_info_merge_pair(nadd, sub, dbg_backend); \
221 * A Lea was transformed back into an Add
223 * @param lea the old Lea
224 * @param nadd the new Add
226 #define DBG_OPT_LEA2ADD(lea, nadd) \
228 hook_merge_nodes(&nadd, 1, &lea, 1, FS_BE_IA32_LEA2ADD); \
229 __dbg_info_merge_pair(nadd, lea, dbg_backend); \
232 #endif /* _IA32_DBG_STAT_H_ */