ia32_new_nodes.h 8.41 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
#ifndef _IA32_NEW_NODES_H_
#define _IA32_NEW_NODES_H_

/**
 * Function prototypes for the assembler ir node constructors.
 * @author Christian Wuerdig
 * $Id$
 */

#include "ia32_nodes_attr.h"

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
 * Returns the name of a firm symconst.
 */
const char *get_sc_name(ir_node *symc);



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

/**
 * Returns the attributes of an ia32 node.
 */
33
ia32_attr_t *get_ia32_attr(const ir_node *node);
34

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

40
41
42
/**
 * Sets the type of an ia32 node.
 */
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

Christian Würdig's avatar
Christian Würdig committed
50
/**
Christian Würdig's avatar
Christian Würdig committed
51
 * Sets the supported addrmode of an ia32 node
Christian Würdig's avatar
Christian Würdig committed
52
 */
Christian Würdig's avatar
Christian Würdig committed
53
void set_ia32_am_support(ir_node *node, ia32_am_type_t am_tp);
Christian Würdig's avatar
Christian Würdig committed
54
55

/**
Christian Würdig's avatar
Christian Würdig committed
56
 * Gets the addrmode flavour of an ia32 node
Christian Würdig's avatar
Christian Würdig committed
57
 */
Christian Würdig's avatar
Christian Würdig committed
58
ia32_am_flavour_t get_ia32_am_flavour(const ir_node *node);
Christian Würdig's avatar
Christian Würdig committed
59

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

70
/**
71
 * Adds an offset for addrmode.
72
 */
73
74
75
76
77
78
void add_ia32_am_offs(ir_node *node, char *offset);

/**
 * Subs an offset for addrmode.
 */
void sub_ia32_am_offs(ir_node *node, char *offset);
79
80
81
82

/**
 * Gets the addr mode const.
 */
83
int get_ia32_am_scale(const ir_node *node);
84
85
86
87

/**
 * Sets the const for addr mode.
 */
88
void set_ia32_am_scale(ir_node *node, int scale);
89
90
91
92

/**
 * Return the tarval of an immediate operation or NULL in case of SymConst
 */
93
94
tarval *get_ia32_Immop_tarval(const ir_node *node);

95
96
97
98
/**
 * Sets the attributes of an immediate operation to the specified tarval
 */
void set_ia32_Immop_tarval(ir_node *node, tarval *tv);
99

100
/**
101
102
103
104
105
106
 * Return the sc attribute.
 */
char *get_ia32_sc(const ir_node *node);

/**
 * Sets the sc attribute.
107
 */
108
void set_ia32_sc(ir_node *node, char *sc);
Christian Würdig's avatar
Christian Würdig committed
109

110
/**
111
 * Gets the string representation of the internal const (tv or symconst)
112
 */
Christian Würdig's avatar
Christian Würdig committed
113
char *get_ia32_cnst(const ir_node *node);
Christian Würdig's avatar
Christian Würdig committed
114

115
/**
116
 * Sets the uses_frame flag.
117
 */
118
void set_ia32_use_frame(ir_node *node);
119
120

/**
121
 * Clears the uses_frame flag.
122
 */
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
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);
144

145
146
147
148
149
150
151
152
153
154
/**
 * 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);

155
156
157
158
159
160
161
162
163
164
/**
 * Gets the frame entity assigned to this node;
 */
entity *get_ia32_frame_ent(const ir_node *node);

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

165
166
167
/**
 * Returns the argument register requirements of an ia32 node.
 */
Christian Würdig's avatar
Christian Würdig committed
168
const ia32_register_req_t **get_ia32_in_req_all(const ir_node *node);
169

170
171
172
173
174
/**
 * Sets the argument register requirements of an ia32 node.
 */
void set_ia32_in_req_all(ir_node *node, const ia32_register_req_t **reqs);

175
176
177
/**
 * Returns the result register requirements of an ia32 node.
 */
Christian Würdig's avatar
Christian Würdig committed
178
const ia32_register_req_t **get_ia32_out_req_all(const ir_node *node);
179

180
181
182
183
184
/**
 * Sets the result register requirements of an ia32 node.
 */
void set_ia32_out_req_all(ir_node *node, const ia32_register_req_t **reqs);

185
186
187
/**
 * Returns the argument register requirements of an ia32 node.
 */
Christian Würdig's avatar
Christian Würdig committed
188
const ia32_register_req_t *get_ia32_in_req(const ir_node *node, int pos);
189
190
191
192

/**
 * Returns the result register requirements of an ia32 node.
 */
Christian Würdig's avatar
Christian Würdig committed
193
const ia32_register_req_t *get_ia32_out_req(const ir_node *node, int pos);
194
195
196
197

/**
 * Sets the OUT register requirements at position pos.
 */
Christian Würdig's avatar
Christian Würdig committed
198
void set_ia32_req_out(ir_node *node, const ia32_register_req_t *req, int pos);
199
200
201
202

/**
 * Sets the IN register requirements at position pos.
 */
Christian Würdig's avatar
Christian Würdig committed
203
void set_ia32_req_in(ir_node *node, const ia32_register_req_t *req, int pos);
204
205
206
207
208
209
210
211
212

/**
 * 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.
 */
213
void set_ia32_flags(ir_node *node, arch_irn_flags_t flags);
214
215
216
217
218

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

220
221
222
223
/**
 * Returns the name of the OUT register at position pos.
 */
const char *get_ia32_out_reg_name(const ir_node *node, int pos);
224

225
226
227
228
/**
 * 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);
229

230
231
232
/**
 * Returns the OUT register at position pos.
 */
233
const arch_register_t *get_ia32_out_reg(const ir_node *node, int pos);
234

235
236
237
238
239
240
241
242
243
244
245
/**
 * 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
246
 * Returns the flavour of an ia32 node,
247
 */
248
ia32_op_flavour_t get_ia32_flavour(const ir_node *node);
249
250

/**
Christian Würdig's avatar
Christian Würdig committed
251
 * Sets the flavour of an ia32 node to flavour_Div/Mod/DivMod/Mul/Mulh.
252
 */
253
void set_ia32_flavour(ir_node *node, ia32_op_flavour_t op_flav);
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279

/**
 * 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);


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

/**
 * Gets the type of an ia32_Const.
 */
Christian Würdig's avatar
Christian Würdig committed
280
unsigned get_ia32_Const_type(const ir_node *node);
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298

/**
 * 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);

/**
 * 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
299
 * @param direction The "direction" of AM ('S' source or 'D' destination)
300
 */
301
void set_ia32_AddrMode(ir_node *node, char direction);
302
303

/**
304
 * Returns whether or not the node is an AddrModeS node.
305
 */
Christian Würdig's avatar
Christian Würdig committed
306
int is_ia32_AddrModeS(const ir_node *node);
307
308

/**
309
 * Returns whether or not the node is an AddrModeD node.
310
 */
Christian Würdig's avatar
Christian Würdig committed
311
312
313
314
315
316
317
318
319
320
321
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);
322

323
324
325
326
327
328
329
330
/**
 * Allocates num register slots for node.
 */
void alloc_ia32_reg_slots(ir_node *node, int num);

/**
 * Initializes the nodes attributes.
 */
Christian Würdig's avatar
Christian Würdig committed
331
332
void init_ia32_attributes(ir_node *node, int flags, const ia32_register_req_t **in_reqs, \
	const ia32_register_req_t **out_reqs, int n_res);
333

Christian Würdig's avatar
Christian Würdig committed
334
/* Include the generated headers */
Christian Würdig's avatar
Christian Würdig committed
335
#include "gen_ia32_new_nodes.h"
336
337

#endif /* _IA32_NEW_NODES_H_ */