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