fixed some bugs
[libfirm] / ir / be / ia32 / ia32_new_nodes.h
1 #ifndef _IA32_NEW_NODES_H_
2 #define _IA32_NEW_NODES_H_
3
4 /**
5  * Function prototypes for the assembler ir node constructors.
6  * @author Christian Wuerdig
7  * $Id$
8  */
9
10 #include "ia32_nodes_attr.h"
11
12 /**
13  * Returns the name of a firm symconst.
14  */
15 const char *get_sc_name(ir_node *symc);
16
17
18
19 /***************************************************************************************************
20  *        _   _                   _       __        _                    _   _               _
21  *       | | | |                 | |     / /       | |                  | | | |             | |
22  *   __ _| |_| |_ _ __   ___  ___| |_   / /_ _  ___| |_   _ __ ___   ___| |_| |__   ___   __| |___
23  *  / _` | __| __| '__| / __|/ _ \ __| / / _` |/ _ \ __| | '_ ` _ \ / _ \ __| '_ \ / _ \ / _` / __|
24  * | (_| | |_| |_| |    \__ \  __/ |_ / / (_| |  __/ |_  | | | | | |  __/ |_| | | | (_) | (_| \__ \
25  *  \__,_|\__|\__|_|    |___/\___|\__/_/ \__, |\___|\__| |_| |_| |_|\___|\__|_| |_|\___/ \__,_|___/
26  *                                        __/ |
27  *                                       |___/
28  ***************************************************************************************************/
29
30 /**
31  * Returns the attributes of an ia32 node.
32  */
33 ia32_attr_t *get_ia32_attr(const ir_node *node);
34
35 /**
36  * Gets the type of an ia32 node.
37  */
38 ia32_op_type_t get_ia32_op_type(const ir_node *node);
39
40 /**
41  * Sets the type of an ia32 node.
42  */
43 void set_ia32_op_type(ir_node *node, ia32_op_type_t tp);
44
45 /**
46  * Gets the supported addrmode of an ia32 node
47  */
48 ia32_am_type_t get_ia32_am_support(const ir_node *node);
49
50 /**
51  * Sets the supported addrmode of an ia32 node
52  */
53 void set_ia32_am_support(ir_node *node, ia32_am_type_t am_tp);
54
55 /**
56  * Gets the addrmode flavour of an ia32 node
57  */
58 ia32_am_flavour_t get_ia32_am_flavour(const ir_node *node);
59
60 /**
61  * Sets the addrmode flavour of an ia32 node
62  */
63 void set_ia32_am_flavour(ir_node *node, ia32_am_flavour_t am_flavour);
64
65 /**
66  * Gets the joined addrmode offset.
67  */
68 char *get_ia32_am_offs(const ir_node *node);
69
70 /**
71  * Adds an offset for addrmode.
72  */
73 void add_ia32_am_offs(ir_node *node, char *offset);
74
75 /**
76  * Subs an offset for addrmode.
77  */
78 void sub_ia32_am_offs(ir_node *node, char *offset);
79
80 /**
81  * Gets the addr mode const.
82  */
83 int get_ia32_am_scale(const ir_node *node);
84
85 /**
86  * Sets the const for addr mode.
87  */
88 void set_ia32_am_scale(ir_node *node, int scale);
89
90 /**
91  * Return the tarval of an immediate operation or NULL in case of SymConst
92  */
93 tarval *get_ia32_Immop_tarval(const ir_node *node);
94
95 /**
96  * Sets the attributes of an immediate operation to the specified tarval
97  */
98 void set_ia32_Immop_tarval(ir_node *node, tarval *tv);
99
100 /**
101  * Return the sc attribute.
102  */
103 char *get_ia32_sc(const ir_node *node);
104
105 /**
106  * Sets the sc attribute.
107  */
108 void set_ia32_sc(ir_node *node, char *sc);
109
110 /**
111  * Gets the string representation of the internal const (tv or symconst)
112  */
113 char *get_ia32_cnst(const ir_node *node);
114
115 /**
116  * Gets the mode of the stored/loaded value (only set for Store/Load)
117  */
118 ir_mode *get_ia32_ls_mode(const ir_node *node);
119
120 /**
121  * Sets the mode of the stored/loaded value (only set for Store/Load)
122  */
123 void set_ia32_ls_mode(ir_node *node, ir_mode *mode);
124
125 /**
126  * Returns the argument register requirements of an ia32 node.
127  */
128 const ia32_register_req_t **get_ia32_in_req_all(const ir_node *node);
129
130 /**
131  * Returns the result register requirements of an ia32 node.
132  */
133 const ia32_register_req_t **get_ia32_out_req_all(const ir_node *node);
134
135 /**
136  * Returns the argument register requirements of an ia32 node.
137  */
138 const ia32_register_req_t *get_ia32_in_req(const ir_node *node, int pos);
139
140 /**
141  * Returns the result register requirements of an ia32 node.
142  */
143 const ia32_register_req_t *get_ia32_out_req(const ir_node *node, int pos);
144
145 /**
146  * Sets the OUT register requirements at position pos.
147  */
148 void set_ia32_req_out(ir_node *node, const ia32_register_req_t *req, int pos);
149
150 /**
151  * Sets the IN register requirements at position pos.
152  */
153 void set_ia32_req_in(ir_node *node, const ia32_register_req_t *req, int pos);
154
155 /**
156  * Returns the register flag of an ia32 node.
157  */
158 arch_irn_flags_t get_ia32_flags(const ir_node *node);
159
160 /**
161  * Sets the register flag of an ia32 node.
162  */
163 void set_ia32_flags(const ir_node *node, arch_irn_flags_t flags);
164
165 /**
166  * Returns the result register slots of an ia32 node.
167  */
168 const arch_register_t **get_ia32_slots(const ir_node *node);
169
170 /**
171  * Returns the name of the OUT register at position pos.
172  */
173 const char *get_ia32_out_reg_name(const ir_node *node, int pos);
174
175 /**
176  * Returns the index of the OUT register at position pos within its register class.
177  */
178 int get_ia32_out_regnr(const ir_node *node, int pos);
179
180 /**
181  * Returns the OUT register at position pos.
182  */
183 const arch_register_t *get_ia32_out_reg(const ir_node *node, int pos);
184
185 /**
186  * Sets the number of results.
187  */
188 void set_ia32_n_res(ir_node *node, int n_res);
189
190 /**
191  * Returns the number of results.
192  */
193 int get_ia32_n_res(const ir_node *node);
194
195 /**
196  * Returns the flavour of an ia32 node,
197  */
198 ia32_op_flavour_t get_ia32_flavour(const ir_node *node);
199
200 /**
201  * Sets the flavour of an ia32 node to flavour_Div/Mod/DivMod/Mul/Mulh.
202  */
203 void set_ia32_flavour(ir_node *node, ia32_op_flavour_t op_flav);
204
205 /**
206  * Returns the projnum code.
207  */
208 long get_ia32_pncode(const ir_node *node);
209
210 /**
211  * Sets the projnum code
212  */
213 void set_ia32_pncode(ir_node *node, long code);
214
215
216
217 /******************************************************************************************************
218  *                      _       _         _   _           __                  _   _
219  *                     (_)     | |       | | | |         / _|                | | (_)
220  *  ___ _ __   ___  ___ _  __ _| |   __ _| |_| |_ _ __  | |_ _   _ _ __   ___| |_ _  ___  _ __    ___
221  * / __| '_ \ / _ \/ __| |/ _` | |  / _` | __| __| '__| |  _| | | | '_ \ / __| __| |/ _ \| '_ \  / __|
222  * \__ \ |_) |  __/ (__| | (_| | | | (_| | |_| |_| |    | | | |_| | | | | (__| |_| | (_) | | | | \__ \
223  * |___/ .__/ \___|\___|_|\__,_|_|  \__,_|\__|\__|_|    |_|  \__,_|_| |_|\___|\__|_|\___/|_| |_| |___/
224  *     | |
225  *     |_|
226  ******************************************************************************************************/
227
228 /**
229  * Gets the type of an ia32_Const.
230  */
231 unsigned get_ia32_Const_type(const ir_node *node);
232
233 /**
234  * Sets the type of an ia32_Const.
235  */
236 void set_ia32_Const_type(ir_node *node, int type);
237
238 /**
239  * Copy the attributes from an ia32_Const to an Immop (Add_i, Sub_i, ...) node
240  */
241 void set_ia32_Immop_attr(ir_node *node, ir_node *cnst);
242
243 /**
244  * Copy the attributes from a Const to an ia32_Const
245  */
246 void set_ia32_Const_attr(ir_node *ia32_cnst, ir_node *cnst);
247
248 /**
249  * Sets the AddrMode attribute
250  * @param direction The "direction" of AM ('S' source or 'D' destination)
251  */
252 void set_ia32_AddrMode(ir_node *node, char direction);
253
254 /**
255  * Returns whether or not the node is an AddrModeS node.
256  */
257 int is_ia32_AddrModeS(const ir_node *node);
258
259 /**
260  * Returns whether or not the node is an AddrModeD node.
261  */
262 int is_ia32_AddrModeD(const ir_node *node);
263
264 /**
265  * Checks if node is a Load or fLoad.
266  */
267 int is_ia32_Ld(const ir_node *node);
268
269 /**
270  * Checks if node is a Store or fStore.
271  */
272 int is_ia32_St(const ir_node *node);
273
274 /* Include the generated headers */
275 #include "gen_ia32_new_nodes.h"
276
277 #endif /* _IA32_NEW_NODES_H_ */