431c106a3ab0dd4b7b1a20a2cb40150d2f8c0ad4
[libfirm] / ir / be / ia32 / ia32_dbg_stat.h
1 /**
2  * This file contains macros to update ia32 firm statistics
3  * @author Christian Wuerdig
4  * $Id$
5  */
6 #ifndef _IA32_DBG_STAT_H_
7 #define _IA32_DBG_STAT_H_
8
9 #include "irhooks.h"
10 #include "dbginfo_t.h"
11 #include "firmstat.h"
12
13 #define SIZ(x)    sizeof(x)/sizeof((x)[0])
14
15 /**
16  * Merge the debug info due to a LEA creation.
17  *
18  * @param oldn  the node
19  * @param n     the new lea
20  */
21 #define DBG_OPT_LEA1(oldn, n)                                \
22         do {                                                    \
23                 hook_merge_nodes(&n, 1, &oldn, 1, FS_BE_IA32_LEA);  \
24                 __dbg_info_merge_pair(n, oldn, dbg_backend);        \
25         } while(0)
26
27
28 /**
29  * Merge the debug info due to a LEA creation.
30  *
31  * @param oldn1  the old node
32  * @param oldn2  an additional old node
33  * @param n      the new lea
34  */
35 #define DBG_OPT_LEA2(oldn1, oldn2, n)                              \
36         do {                                                           \
37                 ir_node *ons[2];                                           \
38                 ons[0] = oldn1;                                            \
39                 ons[1] = oldn2;                                            \
40                 hook_merge_nodes(&n, 1, ons, SIZ(ons), FS_BE_IA32_LEA);    \
41                 __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_backend);  \
42         } while(0)
43
44 /**
45  * Merge the debug info due to a LEA creation.
46  *
47  * @param oldn1  the old node
48  * @param oldn2  an additional old node
49  * @param oldn3  an additional old node
50  * @param n      the new lea
51  */
52 #define DBG_OPT_LEA3(oldn1, oldn2, oldn3, n)                       \
53         do {                                                           \
54                 ir_node *ons[3];                                           \
55                 ons[0] = oldn1;                                            \
56                 ons[1] = oldn2;                                            \
57                 ons[2] = oldn3;                                            \
58                 hook_merge_nodes(&n, 1, ons, SIZ(ons), FS_BE_IA32_LEA);    \
59                 __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_backend);  \
60         } while(0)
61
62 /**
63  * Merge the debug info due to a LEA creation.
64  *
65  * @param oldn1  the old node
66  * @param oldn2  an additional old node
67  * @param oldn3  an additional old node
68  * @param oldn4  an additional old node
69  * @param n      the new lea
70  */
71 #define DBG_OPT_LEA4(oldn1, oldn2, oldn3, oldn4, n)                \
72         do {                                                           \
73                 ir_node *ons[4];                                           \
74                 ons[0] = oldn1;                                            \
75                 ons[1] = oldn2;                                            \
76                 ons[2] = oldn3;                                            \
77                 ons[3] = oldn4;                                            \
78                 hook_merge_nodes(&n, 1, ons, SIZ(ons), FS_BE_IA32_LEA);    \
79                 __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_backend);  \
80         } while(0)
81
82 /**
83  * Merge the debug info due to a Load with LEA creation.
84  *
85  * @param oldn  the lea
86  * @param n     the new load
87  */
88 #define DBG_OPT_LOAD_LEA(oldn, n)                                \
89         do {                                                         \
90                 hook_merge_nodes(&n, 1, &oldn, 1, FS_BE_IA32_LOAD_LEA);  \
91                 __dbg_info_merge_pair(n, oldn, dbg_backend);             \
92         } while(0)
93
94 /**
95  * Merge the debug info due to a Store with LEA creation.
96  *
97  * @param oldn  the lea
98  * @param n     the new store
99  */
100 #define DBG_OPT_STORE_LEA(oldn, n)                                \
101         do {                                                          \
102                 hook_merge_nodes(&n, 1, &oldn, 1, FS_BE_IA32_STORE_LEA);  \
103                 __dbg_info_merge_pair(n, oldn, dbg_backend);              \
104         } while(0)
105
106 /**
107  * Merge the debug info due to a source address mode creation.
108  *
109  * @param oldn  the old load
110  * @param n     the new op
111  */
112 #define DBG_OPT_AM_S(oldn, n)                                \
113         do {                                                     \
114                 hook_merge_nodes(&n, 1, &oldn, 1, FS_BE_IA32_AM_S);  \
115                 __dbg_info_merge_pair(n, oldn, dbg_backend);         \
116         } while(0)
117
118 /**
119  * Merge the debug info due to a destination address mode creation.
120  *
121  * @param load   the old load
122  * @param store  yhe old store
123  * @param n      the new op
124  */
125 #define DBG_OPT_AM_D(load, store, n)                               \
126         do {                                                           \
127                 ir_node *ons[2];                                           \
128                 ons[0] = load;                                             \
129                 ons[1] = store;                                            \
130                 hook_merge_nodes(&n, 1, ons, SIZ(ons), FS_BE_IA32_AM_D);   \
131                 __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_backend);  \
132         } while(0)
133
134 #endif /* _IA32_DBG_STAT_H_ */