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
25 #ifndef FIRM_BE_IA32_IA32_DBG_STAT_H
26 #define FIRM_BE_IA32_IA32_DBG_STAT_H
29 #include "dbginfo_t.h"
34 * Merge the debug info due to a LEA creation.
36 * @param oldn the node
37 * @param n the new lea
39 #define DBG_OPT_LEA1(oldn, n) \
41 hook_merge_nodes(&n, 1, &oldn, 1, FS_BE_IA32_LEA); \
42 __dbg_info_merge_pair(n, oldn, dbg_backend); \
46 * Merge the debug info due to a LEA creation.
48 * @param oldn the node
49 * @param n the new lea
51 #define DBG_OPT_LEA1(oldn, n) \
53 hook_merge_nodes(&n, 1, &oldn, 1, FS_BE_IA32_LEA); \
54 __dbg_info_merge_pair(n, oldn, dbg_backend); \
58 * Merge the debug info due to a LEA creation.
60 * @param oldn1 the old node
61 * @param oldn2 an additional old node
62 * @param n the new lea
64 #define DBG_OPT_LEA2(oldn1, oldn2, n) \
69 hook_merge_nodes(&n, 1, ons, ARRAY_SIZE(ons), FS_BE_IA32_LEA); \
70 __dbg_info_merge_sets(&n, 1, ons, ARRAY_SIZE(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 n the new lea
81 #define DBG_OPT_LEA3(oldn1, oldn2, oldn3, n) \
87 hook_merge_nodes(&n, 1, ons, ARRAY_SIZE(ons), FS_BE_IA32_LEA); \
88 __dbg_info_merge_sets(&n, 1, ons, ARRAY_SIZE(ons), dbg_backend); \
92 * Merge the debug info due to a LEA creation.
94 * @param oldn1 the old node
95 * @param oldn2 an additional old node
96 * @param oldn3 an additional old node
97 * @param oldn4 an additional old node
98 * @param n the new lea
100 #define DBG_OPT_LEA4(oldn1, oldn2, oldn3, oldn4, n) \
107 hook_merge_nodes(&n, 1, ons, ARRAY_SIZE(ons), FS_BE_IA32_LEA); \
108 __dbg_info_merge_sets(&n, 1, ons, ARRAY_SIZE(ons), dbg_backend); \
112 * Merge the debug info due to a Load with LEA creation.
114 * @param oldn the lea
115 * @param n the new load
117 #define DBG_OPT_LOAD_LEA(oldn, n) \
119 hook_merge_nodes(&n, 1, &oldn, 1, (hook_opt_kind)FS_BE_IA32_LOAD_LEA); \
120 __dbg_info_merge_pair(n, oldn, dbg_backend); \
124 * Merge the debug info due to a Store with LEA creation.
126 * @param oldn the lea
127 * @param n the new store
129 #define DBG_OPT_STORE_LEA(oldn, n) \
131 hook_merge_nodes(&n, 1, &oldn, 1, (hook_opt_kind)FS_BE_IA32_STORE_LEA); \
132 __dbg_info_merge_pair(n, oldn, dbg_backend); \
136 * Merge the debug info due to a source address mode creation.
138 * @param oldn the old load
139 * @param n the new op
141 #define DBG_OPT_AM_S(oldn, n) \
143 hook_merge_nodes(&n, 1, &oldn, 1, (hook_opt_kind)FS_BE_IA32_AM_S); \
144 __dbg_info_merge_pair(n, oldn, dbg_backend); \
148 * Merge the debug info due to a destination address mode creation.
150 * @param load the old load
151 * @param store the old store
152 * @param n the new op
154 #define DBG_OPT_AM_D(load, store, n) \
159 hook_merge_nodes(&n, 1, ons, ARRAY_SIZE(ons), FS_BE_IA32_AM_D); \
160 __dbg_info_merge_sets(&n, 1, ons, ARRAY_SIZE(ons), dbg_backend); \
164 * A CJmp was created to save a cmp
166 * @param oldn the old node
168 #define DBG_OPT_CJMP(oldn) \
170 hook_merge_nodes(NULL, 0, &oldn, 1, FS_BE_IA32_CJMP); \
174 * A Copy was created to fulfill two address code constraints
176 * @param cpy the copy
178 #define DBG_OPT_2ADDRCPY(cpy) \
180 hook_merge_nodes(NULL, 0, &cpy, 1, (hook_opt_kind)FS_BE_IA32_2ADDRCPY); \
184 * A Store was created for a Spill
186 * @param spill the Spill
187 * @param store the Store
189 #define DBG_OPT_SPILL2ST(spill, store) \
191 hook_merge_nodes(&store, 1, &spill, 1, (hook_opt_kind)FS_BE_IA32_SPILL2ST); \
192 __dbg_info_merge_pair(store, spill, dbg_backend); \
196 * A Load was created for a Reload
198 * @param rload the Reload
199 * @param load the Load
201 #define DBG_OPT_RELOAD2LD(rload, load) \
203 hook_merge_nodes(&load, 1, &rload, 1, (hook_opt_kind)FS_BE_IA32_RELOAD2LD); \
204 __dbg_info_merge_pair(load, rload, dbg_backend); \
208 * A Sub was transformed into Neg-Add due to 2 address code limitations
210 * @param sub the old Sub
211 * @param nadd the new Add
213 #define DBG_OPT_SUB2NEGADD(sub, nadd) \
215 hook_merge_nodes(&nadd, 1, &sub, 1, (hook_opt_kind)FS_BE_IA32_SUB2NEGADD); \
216 __dbg_info_merge_pair(nadd, sub, dbg_backend); \
220 * A Lea was transformed back into an Add
222 * @param lea the old Lea
223 * @param nadd the new Add
225 #define DBG_OPT_LEA2ADD(lea, nadd) \
227 hook_merge_nodes(&nadd, 1, &lea, 1, (hook_opt_kind)FS_BE_IA32_LEA2ADD); \
228 __dbg_info_merge_pair(nadd, lea, dbg_backend); \
231 #endif /* FIRM_BE_IA32_IA32_DBG_STAT_H */