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