fixed DEL_ARR_F
[libfirm] / ir / be / ia32 / ia32_new_nodes.h
1 /**
2  * Function prototypes for the assembler ir node constructors.
3  * @author Christian Wuerdig
4  * $Id$
5  */
6
7 #ifndef _IA32_NEW_NODES_H_
8 #define _IA32_NEW_NODES_H_
9
10 #include "firm_config.h"
11 #include "ia32_nodes_attr.h"
12
13 /***************************************************************************************************
14  *        _   _                   _       __        _                    _   _               _
15  *       | | | |                 | |     / /       | |                  | | | |             | |
16  *   __ _| |_| |_ _ __   ___  ___| |_   / /_ _  ___| |_   _ __ ___   ___| |_| |__   ___   __| |___
17  *  / _` | __| __| '__| / __|/ _ \ __| / / _` |/ _ \ __| | '_ ` _ \ / _ \ __| '_ \ / _ \ / _` / __|
18  * | (_| | |_| |_| |    \__ \  __/ |_ / / (_| |  __/ |_  | | | | | |  __/ |_| | | | (_) | (_| \__ \
19  *  \__,_|\__|\__|_|    |___/\___|\__/_/ \__, |\___|\__| |_| |_| |_|\___|\__|_| |_|\___/ \__,_|___/
20  *                                        __/ |
21  *                                       |___/
22  ***************************************************************************************************/
23
24 /**
25  * returns true if a node has x87 registers
26  */
27 int ia32_has_x87_register(const ir_node *n);
28
29 /**
30  * Returns the attributes of an ia32 node.
31  */
32 ia32_attr_t *get_ia32_attr(const ir_node *node);
33
34 /**
35  * Gets the type of an ia32 node.
36  */
37 ia32_op_type_t get_ia32_op_type(const ir_node *node);
38
39 /**
40  * Sets the type of an ia32 node.
41  */
42 void set_ia32_op_type(ir_node *node, ia32_op_type_t tp);
43
44 /**
45  * Gets the immediate op type of an ia32 node.
46  */
47 ia32_immop_type_t get_ia32_immop_type(const ir_node *node);
48
49 /**
50  * Sets the immediate op type of an ia32 node.
51  */
52 void set_ia32_immop_type(ir_node *node, ia32_immop_type_t tp);
53
54 /**
55  * Gets the supported addrmode of an ia32 node
56  */
57 ia32_am_type_t get_ia32_am_support(const ir_node *node);
58
59 /**
60  * Sets the supported addrmode of an ia32 node
61  */
62 void set_ia32_am_support(ir_node *node, ia32_am_type_t am_tp);
63
64 /**
65  * Gets the addrmode flavour of an ia32 node
66  */
67 ia32_am_flavour_t get_ia32_am_flavour(const ir_node *node);
68
69 /**
70  * Sets the addrmode flavour of an ia32 node
71  */
72 void set_ia32_am_flavour(ir_node *node, ia32_am_flavour_t am_flavour);
73
74 /**
75  * Gets the joined addrmode offset.
76  */
77 char *get_ia32_am_offs(const ir_node *node);
78
79 /**
80  * Gets the addressmode offset as long.
81  */
82 int get_ia32_am_offs_int(const ir_node *node);
83
84 /**
85  * Sets the addressmode offset
86  */
87 void set_ia32_am_offs_int(ir_node *node, int offset);
88
89 #if 0
90 /**
91  * Adds an offset for addrmode.
92  */
93 void add_ia32_am_offs(ir_node *node, const char *offset);
94 #endif
95
96 void add_ia32_am_offs_int(ir_node *node, int offset);
97
98 #if 0
99 /**
100  * Subs an offset for addrmode.
101  */
102 void sub_ia32_am_offs(ir_node *node, const char *offset);
103 #endif
104
105 /**
106  * Returns the symconst ident associated to addrmode.
107  */
108 ident *get_ia32_am_sc(const ir_node *node);
109
110 /**
111  * Sets the symconst ident associated to addrmode.
112  */
113 void set_ia32_am_sc(ir_node *node, ident *sc);
114
115 /**
116  * Sets the sign bit for address mode symconst.
117  */
118 void set_ia32_am_sc_sign(ir_node *node);
119
120 /**
121  * Clears the sign bit for address mode symconst.
122  */
123 void clear_ia32_am_sc_sign(ir_node *node);
124
125 /**
126  * Returns the sign bit for address mode symconst.
127  */
128 int is_ia32_am_sc_sign(const ir_node *node);
129
130 /**
131  * Gets the addr mode const.
132  */
133 int get_ia32_am_scale(const ir_node *node);
134
135 /**
136  * Sets the const for addr mode.
137  */
138 void set_ia32_am_scale(ir_node *node, int scale);
139
140 /**
141  * Return the tarval of an immediate operation or NULL in case of SymConst
142  */
143 tarval *get_ia32_Immop_tarval(const ir_node *node);
144
145 /**
146  * Sets the attributes of an immediate operation to the specified tarval
147  */
148 void set_ia32_Immop_tarval(ir_node *node, tarval *tv);
149
150 /**
151  * Sets a symconsts ident
152  */
153 void set_ia32_Symconst_ident(ir_node *node, ident *ident);
154
155 /**
156  * Gets the string representation of the internal const (tv or symconst)
157  */
158 const char *get_ia32_cnst(const ir_node *node);
159
160 tarval* get_ia32_cnst_tv(const ir_node *node);
161
162 /**
163  * Sets the string representation of the internal const.
164  */
165 void set_ia32_cnst(ir_node *node, const char *cnst);
166
167 /**
168  * Gets the ident representation of the internal const (tv or symconst)
169  */
170 ident *get_ia32_id_cnst(const ir_node *node);
171
172 /**
173  * Sets the ident representation of the internal const.
174  */
175 void set_ia32_id_cnst(ir_node *node, ident *cnst);
176
177 /**
178  * Sets the uses_frame flag.
179  */
180 void set_ia32_use_frame(ir_node *node);
181
182 /**
183  * Clears the uses_frame flag.
184  */
185 void clear_ia32_use_frame(ir_node *node);
186
187 /**
188  * Gets the uses_frame flag.
189  */
190 int is_ia32_use_frame(const ir_node *node);
191
192 /**
193  * Sets node to commutative.
194  */
195 void set_ia32_commutative(ir_node *node);
196
197 /**
198  * Sets node to non-commutative.
199  */
200 void clear_ia32_commutative(ir_node *node);
201
202 /**
203  * Checks if node is commutative.
204  */
205 int is_ia32_commutative(const ir_node *node);
206
207 /**
208  * Sets node emit_cl.
209  */
210 void set_ia32_emit_cl(ir_node *node);
211
212 /**
213  * Clears node emit_cl.
214  */
215 void clear_ia32_emit_cl(ir_node *node);
216
217 /**
218  * Checks if node is commutative.
219  */
220 int is_ia32_emit_cl(const ir_node *node);
221
222 /**
223  * Sets node got_lea.
224  */
225 void set_ia32_got_lea(ir_node *node);
226
227 /**
228  * Clears node got_lea.
229  */
230 void clear_ia32_got_lea(ir_node *node);
231
232 /**
233  * Checks if node got lea.
234  */
235 int is_ia32_got_lea(const ir_node *node);
236
237 /**
238  * Sets node got_reload.
239  */
240 void set_ia32_got_reload(ir_node *node);
241
242 /**
243  * Clears node got_reload.
244  */
245 void clear_ia32_got_reload(ir_node *node);
246
247 /**
248  * Checks if node got reload.
249  */
250 int is_ia32_got_reload(const ir_node *node);
251
252 /**
253  * Gets the mode of the stored/loaded value (only set for Store/Load)
254  */
255 ir_mode *get_ia32_ls_mode(const ir_node *node);
256
257 /**
258  * Sets the mode of the stored/loaded value (only set for Store/Load)
259  */
260 void set_ia32_ls_mode(ir_node *node, ir_mode *mode);
261
262 /**
263  * Gets the frame entity assigned to this node;
264  */
265 ir_entity *get_ia32_frame_ent(const ir_node *node);
266
267 /**
268  * Sets the frame entity for this node;
269  */
270 void set_ia32_frame_ent(ir_node *node, ir_entity *ent);
271
272 /**
273  * Returns the argument register requirements of an ia32 node.
274  */
275 const ia32_register_req_t **get_ia32_in_req_all(const ir_node *node);
276
277 /**
278  * Sets the argument register requirements of an ia32 node.
279  */
280 void set_ia32_in_req_all(ir_node *node, const ia32_register_req_t **reqs);
281
282 /**
283  * Returns the result register requirements of an ia32 node.
284  */
285 const ia32_register_req_t **get_ia32_out_req_all(const ir_node *node);
286
287 /**
288  * Sets the result register requirements of an ia32 node.
289  */
290 void set_ia32_out_req_all(ir_node *node, const ia32_register_req_t **reqs);
291
292 /**
293  * Returns the argument register requirements of an ia32 node.
294  */
295 const ia32_register_req_t *get_ia32_in_req(const ir_node *node, int pos);
296
297 /**
298  * Returns the result register requirements of an ia32 node.
299  */
300 const ia32_register_req_t *get_ia32_out_req(const ir_node *node, int pos);
301
302 /**
303  * Sets the OUT register requirements at position pos.
304  */
305 void set_ia32_req_out(ir_node *node, const ia32_register_req_t *req, int pos);
306
307 /**
308  * Sets the IN register requirements at position pos.
309  */
310 void set_ia32_req_in(ir_node *node, const ia32_register_req_t *req, int pos);
311
312 /**
313  * Returns the register flag of an ia32 node.
314  */
315 arch_irn_flags_t get_ia32_flags(const ir_node *node);
316
317 /**
318  * Sets the register flag of an ia32 node.
319  */
320 void set_ia32_flags(ir_node *node, arch_irn_flags_t flags);
321
322 /**
323  * Returns the result register slots of an ia32 node.
324  */
325 const arch_register_t **get_ia32_slots(const ir_node *node);
326
327 /**
328  * Returns the name of the OUT register at position pos.
329  */
330 const char *get_ia32_out_reg_name(const ir_node *node, int pos);
331
332 /**
333  * Returns the index of the OUT register at position pos within its register class.
334  */
335 int get_ia32_out_regnr(const ir_node *node, int pos);
336
337 /**
338  * Returns the OUT register at position pos.
339  */
340 const arch_register_t *get_ia32_out_reg(const ir_node *node, int pos);
341
342 /**
343  * Sets the number of results.
344  */
345 void set_ia32_n_res(ir_node *node, int n_res);
346
347 /**
348  * Returns the number of results.
349  */
350 int get_ia32_n_res(const ir_node *node);
351
352 /**
353  * Returns the flavour of an ia32 node,
354  */
355 ia32_op_flavour_t get_ia32_flavour(const ir_node *node);
356
357 /**
358  * Sets the flavour of an ia32 node to flavour_Div/Mod/DivMod/Mul/Mulh.
359  */
360 void set_ia32_flavour(ir_node *node, ia32_op_flavour_t op_flav);
361
362 /**
363  * Returns the projnum code.
364  */
365 pn_Cmp get_ia32_pncode(const ir_node *node);
366
367 /**
368  * Sets the projnum code
369  */
370 void set_ia32_pncode(ir_node *node, pn_Cmp code);
371
372 /**
373  * Gets the instruction latency.
374  */
375 unsigned get_ia32_latency(const ir_node *node);
376
377 /**
378  * Sets the instruction latency.
379  */
380 void set_ia32_latency(ir_node *node, unsigned latency);
381
382
383 /**
384  * Sets the flags for the n'th out.
385  */
386 void set_ia32_out_flags(ir_node *node, arch_irn_flags_t flags, int pos);
387
388 /**
389  * Gets the flags for the n'th out.
390  */
391 arch_irn_flags_t get_ia32_out_flags(const ir_node *node, int pos);
392
393 /**
394  * Get the list of available execution units.
395  */
396 const be_execution_unit_t ***get_ia32_exec_units(const ir_node *node);
397
398 #ifndef NDEBUG
399
400 /**
401  * Returns the name of the original ir node.
402  */
403 const char *get_ia32_orig_node(const ir_node *node);
404
405 /**
406  * Sets the name of the original ir node.
407  */
408 void set_ia32_orig_node(ir_node *node, const char *name);
409
410 #endif /* NDEBUG */
411
412 /******************************************************************************************************
413  *                      _       _         _   _           __                  _   _
414  *                     (_)     | |       | | | |         / _|                | | (_)
415  *  ___ _ __   ___  ___ _  __ _| |   __ _| |_| |_ _ __  | |_ _   _ _ __   ___| |_ _  ___  _ __    ___
416  * / __| '_ \ / _ \/ __| |/ _` | |  / _` | __| __| '__| |  _| | | | '_ \ / __| __| |/ _ \| '_ \  / __|
417  * \__ \ |_) |  __/ (__| | (_| | | | (_| | |_| |_| |    | | | |_| | | | | (__| |_| | (_) | | | | \__ \
418  * |___/ .__/ \___|\___|_|\__,_|_|  \__,_|\__|\__|_|    |_|  \__,_|_| |_|\___|\__|_|\___/|_| |_| |___/
419  *     | |
420  *     |_|
421  ******************************************************************************************************/
422
423 /**
424  * Returns the ident of an entity
425  * @param ent The entity
426  * @return The ident of the entity
427  */
428 ident *ia32_get_ent_ident(ir_entity *ent);
429
430 /**
431  * Gets the type of an ia32_Const.
432  */
433 unsigned get_ia32_Const_type(const ir_node *node);
434
435 /**
436  * Sets the type of an ia32_Const.
437  */
438 void set_ia32_Const_type(ir_node *node, int type);
439
440 /**
441  * Copy the attributes from an ia32_Const to an Immop (Add_i, Sub_i, ...) node
442  */
443 void set_ia32_Immop_attr(ir_node *node, ir_node *cnst);
444
445 /**
446  * Copy the attributes from Immop to an Immop
447  */
448 void copy_ia32_Immop_attr(ir_node *node, ir_node *src);
449
450 /**
451  * Returns the proj of the result value for nodes that have the usual
452  * (res, Mem) result tuple
453  */
454 ir_node *get_ia32_result_proj(const ir_node *node);
455
456 /**
457  * Copy the attributes from a Const to an ia32_Const
458  */
459 void set_ia32_Const_attr(ir_node *ia32_cnst, ir_node *cnst);
460
461 void set_ia32_Const_tarval(ir_node *node, tarval *tv);
462
463 /**
464  * Sets the AddrMode attribute
465  * @param direction The "direction" of AM ('S' source or 'D' destination)
466  */
467 void set_ia32_AddrMode(ir_node *node, char direction);
468
469 /**
470  * Returns whether or not the node is an immediate operation with Const.
471  */
472 int is_ia32_ImmConst(const ir_node *node);
473
474 /**
475  * Returns whether or not the node is an immediate operation with SymConst.
476  */
477 int is_ia32_ImmSymConst(const ir_node *node);
478
479 /**
480  * Returns whether or not the node is an AddrModeS node.
481  */
482 int is_ia32_AddrModeS(const ir_node *node);
483
484 /**
485  * Returns whether or not the node is an AddrModeD node.
486  */
487 int is_ia32_AddrModeD(const ir_node *node);
488
489 /**
490  * Checks if node is a Load or fLoad.
491  */
492 int is_ia32_Ld(const ir_node *node);
493
494 /**
495  * Checks if node is a Store or fStore.
496  */
497 int is_ia32_St(const ir_node *node);
498
499 /**
500  * Checks if node is a Const or fConst.
501  */
502 int is_ia32_Cnst(const ir_node *node);
503
504 /**
505  * Initializes the nodes attributes.
506  */
507 void init_ia32_attributes(ir_node *node, arch_irn_flags_t flags, const ia32_register_req_t **in_reqs, \
508         const ia32_register_req_t **out_reqs, const be_execution_unit_t ***execution_units, int n_res, unsigned latency);
509
510 /**
511  * Registers the ia32_copy_attr function for all ia32 opcodes.
512  */
513 void ia32_register_copy_attr_func(void);
514
515 /* Include the generated headers */
516 #include "gen_ia32_new_nodes.h"
517
518 #endif /* _IA32_NEW_NODES_H_ */