ia32_new_nodes.h 12.1 KB
Newer Older
1
2
3
4
5
6
/**
 * Function prototypes for the assembler ir node constructors.
 * @author Christian Wuerdig
 * $Id$
 */

Christian Würdig's avatar
Christian Würdig committed
7
8
9
#ifndef _IA32_NEW_NODES_H_
#define _IA32_NEW_NODES_H_

Christian Würdig's avatar
Christian Würdig committed
10
#include "firm_config.h"
11
12
#include "ia32_nodes_attr.h"

13
14
15
16
17
18
19
20
21
22
23
/***************************************************************************************************
 *        _   _                   _       __        _                    _   _               _
 *       | | | |                 | |     / /       | |                  | | | |             | |
 *   __ _| |_| |_ _ __   ___  ___| |_   / /_ _  ___| |_   _ __ ___   ___| |_| |__   ___   __| |___
 *  / _` | __| __| '__| / __|/ _ \ __| / / _` |/ _ \ __| | '_ ` _ \ / _ \ __| '_ \ / _ \ / _` / __|
 * | (_| | |_| |_| |    \__ \  __/ |_ / / (_| |  __/ |_  | | | | | |  __/ |_| | | | (_) | (_| \__ \
 *  \__,_|\__|\__|_|    |___/\___|\__/_/ \__, |\___|\__| |_| |_| |_|\___|\__|_| |_|\___/ \__,_|___/
 *                                        __/ |
 *                                       |___/
 ***************************************************************************************************/

24
25
26
27
28
/**
 * returns true if a node has x87 registers
 */
int ia32_has_x87_register(const ir_node *n);

29
30
31
/**
 * Returns the attributes of an ia32 node.
 */
32
ia32_attr_t *get_ia32_attr(const ir_node *node);
33

34
35
36
/**
 * Gets the type of an ia32 node.
 */
37
ia32_op_type_t get_ia32_op_type(const ir_node *node);
38

39
40
41
/**
 * Sets the type of an ia32 node.
 */
42
void set_ia32_op_type(ir_node *node, ia32_op_type_t tp);
43

44
45
46
47
48
49
50
51
52
53
/**
 * Gets the immediate op type of an ia32 node.
 */
ia32_immop_type_t get_ia32_immop_type(const ir_node *node);

/**
 * Sets the immediate op type of an ia32 node.
 */
void set_ia32_immop_type(ir_node *node, ia32_immop_type_t tp);

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

Christian Würdig's avatar
Christian Würdig committed
59
/**
Christian Würdig's avatar
Christian Würdig committed
60
 * Sets the supported addrmode of an ia32 node
Christian Würdig's avatar
Christian Würdig committed
61
 */
Christian Würdig's avatar
Christian Würdig committed
62
void set_ia32_am_support(ir_node *node, ia32_am_type_t am_tp);
Christian Würdig's avatar
Christian Würdig committed
63
64

/**
Christian Würdig's avatar
Christian Würdig committed
65
 * Gets the addrmode flavour of an ia32 node
Christian Würdig's avatar
Christian Würdig committed
66
 */
Christian Würdig's avatar
Christian Würdig committed
67
ia32_am_flavour_t get_ia32_am_flavour(const ir_node *node);
Christian Würdig's avatar
Christian Würdig committed
68

69
/**
Christian Würdig's avatar
Christian Würdig committed
70
 * Sets the addrmode flavour of an ia32 node
71
 */
Christian Würdig's avatar
Christian Würdig committed
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);
Christian Würdig's avatar
Christian Würdig committed
78

79
80
81
/**
 * Gets the addressmode offset as long.
 */
82
int get_ia32_am_offs_int(const ir_node *node);
83

84
/**
85
 * Adds an offset for addrmode.
86
 */
87
void add_ia32_am_offs(ir_node *node, const char *offset);
88

89
90
void add_ia32_am_offs_int(ir_node *node, int offset);

91
92
93
/**
 * Subs an offset for addrmode.
 */
94
void sub_ia32_am_offs(ir_node *node, const char *offset);
95

96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/**
 * Returns the symconst ident associated to addrmode.
 */
ident *get_ia32_am_sc(const ir_node *node);

/**
 * Sets the symconst ident associated to addrmode.
 */
void set_ia32_am_sc(ir_node *node, ident *sc);

/**
 * Sets the sign bit for address mode symconst.
 */
void set_ia32_am_sc_sign(ir_node *node);

/**
 * Clears the sign bit for address mode symconst.
 */
void clear_ia32_am_sc_sign(ir_node *node);

/**
 * Returns the sign bit for address mode symconst.
 */
int is_ia32_am_sc_sign(const ir_node *node);

121
122
123
/**
 * Gets the addr mode const.
 */
124
int get_ia32_am_scale(const ir_node *node);
125
126
127
128

/**
 * Sets the const for addr mode.
 */
129
void set_ia32_am_scale(ir_node *node, int scale);
130
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
139
/**
 * Sets the attributes of an immediate operation to the specified tarval
 */
void set_ia32_Immop_tarval(ir_node *node, tarval *tv);
140

141
/**
142
 * Gets the string representation of the internal const (tv or symconst)
143
 */
144
const char *get_ia32_cnst(const ir_node *node);
Christian Würdig's avatar
Christian Würdig committed
145

146
147
148
/**
 * Sets the string representation of the internal const.
 */
Matthias Braun's avatar
Matthias Braun committed
149
void set_ia32_cnst(ir_node *node, const char *cnst);
150

151
152
153
154
155
156
157
158
159
160
/**
 * Gets the ident representation of the internal const (tv or symconst)
 */
ident *get_ia32_id_cnst(const ir_node *node);

/**
 * Sets the ident representation of the internal const.
 */
void set_ia32_id_cnst(ir_node *node, ident *cnst);

161
/**
162
 * Sets the uses_frame flag.
163
 */
164
void set_ia32_use_frame(ir_node *node);
165
166

/**
167
 * Clears the uses_frame flag.
168
 */
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
void clear_ia32_use_frame(ir_node *node);

/**
 * Gets the uses_frame flag.
 */
int is_ia32_use_frame(const ir_node *node);

/**
 * Sets node to commutative.
 */
void set_ia32_commutative(ir_node *node);

/**
 * Sets node to non-commutative.
 */
void clear_ia32_commutative(ir_node *node);

/**
 * Checks if node is commutative.
 */
int is_ia32_commutative(const ir_node *node);
190

Christian Würdig's avatar
Christian Würdig committed
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/**
 * Sets node emit_cl.
 */
void set_ia32_emit_cl(ir_node *node);

/**
 * Clears node emit_cl.
 */
void clear_ia32_emit_cl(ir_node *node);

/**
 * Checks if node is commutative.
 */
int is_ia32_emit_cl(const ir_node *node);

206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
/**
 * Sets node got_lea.
 */
void set_ia32_got_lea(ir_node *node);

/**
 * Clears node got_lea.
 */
void clear_ia32_got_lea(ir_node *node);

/**
 * Checks if node got lea.
 */
int is_ia32_got_lea(const ir_node *node);

Christian Würdig's avatar
Christian Würdig committed
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
/**
 * Sets node got_reload.
 */
void set_ia32_got_reload(ir_node *node);

/**
 * Clears node got_reload.
 */
void clear_ia32_got_reload(ir_node *node);

/**
 * Checks if node got reload.
 */
int is_ia32_got_reload(const ir_node *node);

236
237
238
239
240
241
242
243
244
245
/**
 * Gets the mode of the stored/loaded value (only set for Store/Load)
 */
ir_mode *get_ia32_ls_mode(const ir_node *node);

/**
 * Sets the mode of the stored/loaded value (only set for Store/Load)
 */
void set_ia32_ls_mode(ir_node *node, ir_mode *mode);

246
247
248
249
250
251
252
253
254
255
/**
 * Gets the mode of the result.
 */
ir_mode *get_ia32_res_mode(const ir_node *node);

/**
 * Sets the mode of the result.
 */
void set_ia32_res_mode(ir_node *node, ir_mode *mode);

256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
/**
 * Gets the source mode of conversion.
 */
ir_mode *get_ia32_src_mode(const ir_node *node);

/**
 * Sets the source mode of conversion.
 */
void set_ia32_src_mode(ir_node *node, ir_mode *mode);

/**
 * Gets the target mode of conversion.
 */
ir_mode *get_ia32_tgt_mode(const ir_node *node);

/**
 * Sets the target mode of conversion.
 */
void set_ia32_tgt_mode(ir_node *node, ir_mode *mode);

276
277
278
/**
 * Gets the frame entity assigned to this node;
 */
279
ir_entity *get_ia32_frame_ent(const ir_node *node);
280
281
282
283

/**
 * Sets the frame entity for this node;
 */
284
void set_ia32_frame_ent(ir_node *node, ir_entity *ent);
285

286
287
288
/**
 * Returns the argument register requirements of an ia32 node.
 */
Christian Würdig's avatar
Christian Würdig committed
289
const ia32_register_req_t **get_ia32_in_req_all(const ir_node *node);
290

291
292
293
294
295
/**
 * Sets the argument register requirements of an ia32 node.
 */
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.
 */
Christian Würdig's avatar
Christian Würdig committed
299
const ia32_register_req_t **get_ia32_out_req_all(const ir_node *node);
300

301
302
303
304
305
/**
 * Sets the result register requirements of an ia32 node.
 */
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.
 */
Christian Würdig's avatar
Christian Würdig committed
309
const ia32_register_req_t *get_ia32_in_req(const ir_node *node, int pos);
310
311
312
313

/**
 * Returns the result register requirements of an ia32 node.
 */
Christian Würdig's avatar
Christian Würdig committed
314
const ia32_register_req_t *get_ia32_out_req(const ir_node *node, int pos);
315
316
317
318

/**
 * Sets the OUT register requirements at position pos.
 */
Christian Würdig's avatar
Christian Würdig committed
319
void set_ia32_req_out(ir_node *node, const ia32_register_req_t *req, int pos);
320
321
322
323

/**
 * Sets the IN register requirements at position pos.
 */
Christian Würdig's avatar
Christian Würdig committed
324
void set_ia32_req_in(ir_node *node, const ia32_register_req_t *req, int pos);
325
326
327
328
329
330
331
332
333

/**
 * Returns the register flag of an ia32 node.
 */
arch_irn_flags_t get_ia32_flags(const ir_node *node);

/**
 * Sets the register flag of an ia32 node.
 */
334
void set_ia32_flags(ir_node *node, arch_irn_flags_t flags);
335
336
337
338
339

/**
 * Returns the result register slots of an ia32 node.
 */
const arch_register_t **get_ia32_slots(const ir_node *node);
340

341
342
343
344
/**
 * Returns the name of the OUT register at position pos.
 */
const char *get_ia32_out_reg_name(const ir_node *node, int pos);
345

346
347
348
349
/**
 * Returns the index of the OUT register at position pos within its register class.
 */
int get_ia32_out_regnr(const ir_node *node, int pos);
350

351
352
353
/**
 * Returns the OUT register at position pos.
 */
354
const arch_register_t *get_ia32_out_reg(const ir_node *node, int pos);
355

356
357
358
359
360
361
362
363
364
365
366
/**
 * Sets the number of results.
 */
void set_ia32_n_res(ir_node *node, int n_res);

/**
 * Returns the number of results.
 */
int get_ia32_n_res(const ir_node *node);

/**
Christian Würdig's avatar
Christian Würdig committed
367
 * Returns the flavour of an ia32 node,
368
 */
369
ia32_op_flavour_t get_ia32_flavour(const ir_node *node);
370
371

/**
Christian Würdig's avatar
Christian Würdig committed
372
 * Sets the flavour of an ia32 node to flavour_Div/Mod/DivMod/Mul/Mulh.
373
 */
374
void set_ia32_flavour(ir_node *node, ia32_op_flavour_t op_flav);
375
376
377
378
379
380
381
382
383
384
385

/**
 * Returns the projnum code.
 */
long get_ia32_pncode(const ir_node *node);

/**
 * Sets the projnum code
 */
void set_ia32_pncode(ir_node *node, long code);

Christian Würdig's avatar
Christian Würdig committed
386
387
388
389
390
391
392
393
394
395
/**
 * Gets the instruction latency.
 */
unsigned get_ia32_latency(const ir_node *node);

/**
 * Sets the instruction latency.
 */
void set_ia32_latency(ir_node *node, unsigned latency);

396
397
398
399
400
401
402
403
404
405
406

/**
 * Sets the flags for the n'th out.
 */
void set_ia32_out_flags(ir_node *node, arch_irn_flags_t flags, int pos);

/**
 * Gets the flags for the n'th out.
 */
arch_irn_flags_t get_ia32_out_flags(const ir_node *node, int pos);

407
/**
408
 * Get the list of available execution units.
409
 */
410
const be_execution_unit_t ***get_ia32_exec_units(const ir_node *node);
411

Christian Würdig's avatar
Christian Würdig committed
412
413
414
415
416
417
418
419
420
421
422
423
424
#ifndef NDEBUG

/**
 * Returns the name of the original ir node.
 */
const char *get_ia32_orig_node(const ir_node *node);

/**
 * Sets the name of the original ir node.
 */
void set_ia32_orig_node(ir_node *node, const char *name);

#endif /* NDEBUG */
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439

/******************************************************************************************************
 *                      _       _         _   _           __                  _   _
 *                     (_)     | |       | | | |         / _|                | | (_)
 *  ___ _ __   ___  ___ _  __ _| |   __ _| |_| |_ _ __  | |_ _   _ _ __   ___| |_ _  ___  _ __    ___
 * / __| '_ \ / _ \/ __| |/ _` | |  / _` | __| __| '__| |  _| | | | '_ \ / __| __| |/ _ \| '_ \  / __|
 * \__ \ |_) |  __/ (__| | (_| | | | (_| | |_| |_| |    | | | |_| | | | | (__| |_| | (_) | | | | \__ \
 * |___/ .__/ \___|\___|_|\__,_|_|  \__,_|\__|\__|_|    |_|  \__,_|_| |_|\___|\__|_|\___/|_| |_| |___/
 *     | |
 *     |_|
 ******************************************************************************************************/

/**
 * Gets the type of an ia32_Const.
 */
Christian Würdig's avatar
Christian Würdig committed
440
unsigned get_ia32_Const_type(const ir_node *node);
441
442
443
444
445
446
447
448
449
450
451

/**
 * Sets the type of an ia32_Const.
 */
void set_ia32_Const_type(ir_node *node, int type);

/**
 * Copy the attributes from an ia32_Const to an Immop (Add_i, Sub_i, ...) node
 */
void set_ia32_Immop_attr(ir_node *node, ir_node *cnst);

452
453
454
455
456
/**
 * Copy the attributes from Immop to an Immop
 */
void copy_ia32_Immop_attr(ir_node *node, ir_node *src);

457
458
459
460
461
462
463
/**
 * Copy the attributes from a Const to an ia32_Const
 */
void set_ia32_Const_attr(ir_node *ia32_cnst, ir_node *cnst);

/**
 * Sets the AddrMode attribute
464
 * @param direction The "direction" of AM ('S' source or 'D' destination)
465
 */
466
void set_ia32_AddrMode(ir_node *node, char direction);
467

468
469
470
471
472
473
474
475
476
477
/**
 * Returns whether or not the node is an immediate operation with Const.
 */
int is_ia32_ImmConst(const ir_node *node);

/**
 * Returns whether or not the node is an immediate operation with SymConst.
 */
int is_ia32_ImmSymConst(const ir_node *node);

478
/**
479
 * Returns whether or not the node is an AddrModeS node.
480
 */
Christian Würdig's avatar
Christian Würdig committed
481
int is_ia32_AddrModeS(const ir_node *node);
482
483

/**
484
 * Returns whether or not the node is an AddrModeD node.
485
 */
Christian Würdig's avatar
Christian Würdig committed
486
487
488
489
490
491
492
493
494
495
496
int is_ia32_AddrModeD(const ir_node *node);

/**
 * Checks if node is a Load or fLoad.
 */
int is_ia32_Ld(const ir_node *node);

/**
 * Checks if node is a Store or fStore.
 */
int is_ia32_St(const ir_node *node);
497

Christian Würdig's avatar
Christian Würdig committed
498
499
500
501
502
/**
 * Checks if node is a Const or fConst.
 */
int is_ia32_Cnst(const ir_node *node);

503
504
505
/**
 * Initializes the nodes attributes.
 */
Christian Würdig's avatar
Christian Würdig committed
506
void init_ia32_attributes(ir_node *node, arch_irn_flags_t flags, const ia32_register_req_t **in_reqs, \
507
	const ia32_register_req_t **out_reqs, const be_execution_unit_t ***execution_units, int n_res, unsigned latency);
508

509
510
511
512
513
/**
 * Registers the ia32_copy_attr function for all ia32 opcodes.
 */
void ia32_register_copy_attr_func(void);

Christian Würdig's avatar
Christian Würdig committed
514
/* Include the generated headers */
Christian Würdig's avatar
Christian Würdig committed
515
#include "gen_ia32_new_nodes.h"
516
517

#endif /* _IA32_NEW_NODES_H_ */