becopyheur4: Clean up co_mst_irn_init().
[libfirm] / ir / be / ia32 / ia32_new_nodes.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5
6 /**
7  * @file
8  * @brief       Handling of ia32 specific firm opcodes.
9  * @author      Christian Wuerdig
10  *
11  * This file implements the creation of the achitecture specific firm opcodes
12  * and the coresponding node constructors for the ia32 assembler irg.
13  */
14 #ifndef FIRM_BE_IA32_IA32_NEW_NODES_H
15 #define FIRM_BE_IA32_IA32_NEW_NODES_H
16
17 #include "ia32_nodes_attr.h"
18
19 /** indices for AM inputs */
20 enum {
21         n_ia32_base         = 0,
22         n_ia32_index        = 1,
23         n_ia32_mem          = 2,
24         n_ia32_unary_op     = 3,
25         n_ia32_binary_left  = 3,
26         n_ia32_binary_right = 4
27 };
28
29 /** proj numbers for "normal" one-result nodes (for the complicated cases where we not only
30  * need the result) */
31 enum {
32         pn_ia32_res   = 0,
33         pn_ia32_flags = 1,
34         pn_ia32_mem   = 2
35 };
36
37 extern struct obstack opcodes_obst;
38
39 /**
40  * Returns the attributes of an ia32 node.
41  */
42 ia32_attr_t *get_ia32_attr(ir_node *node);
43 const ia32_attr_t *get_ia32_attr_const(const ir_node *node);
44
45 ia32_x87_attr_t *get_ia32_x87_attr(ir_node *node);
46 const ia32_x87_attr_t *get_ia32_x87_attr_const(const ir_node *node);
47
48 ia32_immediate_attr_t *get_ia32_immediate_attr(ir_node *node);
49 const ia32_immediate_attr_t *get_ia32_immediate_attr_const(const ir_node *node);
50
51 const ia32_asm_attr_t *get_ia32_asm_attr_const(const ir_node *node);
52
53 /**
54  * Gets the condcode attributes of a node.
55  */
56 ia32_condcode_attr_t *get_ia32_condcode_attr(ir_node *node);
57 const ia32_condcode_attr_t *get_ia32_condcode_attr_const(const ir_node *node);
58
59 /**
60  * Gets the Call node attributes.
61  */
62 ia32_call_attr_t *get_ia32_call_attr(ir_node *node);
63 const ia32_call_attr_t *get_ia32_call_attr_const(const ir_node *node);
64
65 /**
66  * Gets the CopyB node attributes.
67  */
68 ia32_copyb_attr_t *get_ia32_copyb_attr(ir_node *node);
69 const ia32_copyb_attr_t *get_ia32_copyb_attr_const(const ir_node *node);
70
71 /**
72  * Gets the ClimbFrame node attributes.
73  */
74 ia32_climbframe_attr_t *get_ia32_climbframe_attr(ir_node *node);
75 const ia32_climbframe_attr_t *get_ia32_climbframe_attr_const(const ir_node *node);
76
77 ia32_switch_attr_t *get_ia32_switch_attr(ir_node *node);
78 const ia32_switch_attr_t *get_ia32_switch_attr_const(const ir_node *node);
79
80 /**
81  * Gets the type of an ia32 node.
82  */
83 ia32_op_type_t get_ia32_op_type(const ir_node *node);
84
85 /**
86  * Sets the type of an ia32 node.
87  */
88 void set_ia32_op_type(ir_node *node, ia32_op_type_t tp);
89
90 /**
91  * Gets the supported address mode of an ia32 node
92  */
93 ia32_am_type_t get_ia32_am_support(const ir_node *node);
94
95 /**
96  * Sets the supported addrmode of an ia32 node
97  */
98 void set_ia32_am_support(ir_node *node, ia32_am_type_t am_arity);
99
100 /**
101  * Gets the addressmode offset as long.
102  */
103 int get_ia32_am_offs_int(const ir_node *node);
104
105 /**
106  * Sets the addressmode offset
107  */
108 void set_ia32_am_offs_int(ir_node *node, int offset);
109
110 void add_ia32_am_offs_int(ir_node *node, int offset);
111
112 /**
113  * Returns the symconst entity associated to addrmode.
114  */
115 ir_entity *get_ia32_am_sc(const ir_node *node);
116
117 /**
118  * Sets the symconst entity associated to addrmode.
119  */
120 void set_ia32_am_sc(ir_node *node, ir_entity *sc);
121
122 /**
123  * Sets the sign bit for address mode symconst.
124  */
125 void set_ia32_am_sc_sign(ir_node *node);
126
127 /**
128  * Clears the sign bit for address mode symconst.
129  */
130 void clear_ia32_am_sc_sign(ir_node *node);
131
132 /**
133  * Returns the sign bit for address mode symconst.
134  */
135 int is_ia32_am_sc_sign(const ir_node *node);
136
137 void set_ia32_am_tls_segment(ir_node *node, bool value);
138
139 bool get_ia32_am_tls_segment(const ir_node *node);
140
141 /**
142  * Gets the addr mode const.
143  */
144 unsigned get_ia32_am_scale(const ir_node *node);
145
146 /**
147  * Sets the const for addr mode.
148  */
149 void set_ia32_am_scale(ir_node *node, unsigned scale);
150
151 /**
152  * Sets the uses_frame flag.
153  */
154 void set_ia32_use_frame(ir_node *node);
155
156 /**
157  * Clears the uses_frame flag.
158  */
159 void clear_ia32_use_frame(ir_node *node);
160
161 /**
162  * Gets the uses_frame flag.
163  */
164 int is_ia32_use_frame(const ir_node *node);
165
166 /**
167  * copies all address-mode attributes from one node to the other
168  */
169 void ia32_copy_am_attrs(ir_node *to, const ir_node *from);
170
171 /**
172  * Sets node to commutative.
173  */
174 void set_ia32_commutative(ir_node *node);
175
176 /**
177  * Sets node to non-commutative.
178  */
179 void clear_ia32_commutative(ir_node *node);
180
181 /**
182  * Checks if node is commutative.
183  */
184 int is_ia32_commutative(const ir_node *node);
185
186 /**
187  * Sets node needs_stackent
188  */
189 void set_ia32_need_stackent(ir_node *node);
190
191 /**
192  * Clears node needs_stackent
193  */
194 void clear_ia32_need_stackent(ir_node *node);
195
196 /**
197  * Checks if node needs a stack entity assigned
198  */
199 int is_ia32_need_stackent(const ir_node *node);
200
201 void set_ia32_is_reload(ir_node *node);
202 int is_ia32_is_reload(const ir_node *node);
203
204 void set_ia32_is_spill(ir_node *node);
205 int is_ia32_is_spill(const ir_node *node);
206
207 void set_ia32_is_remat(ir_node *node);
208 int is_ia32_is_remat(const ir_node *node);
209
210 /**
211  * Gets the mode of the stored/loaded value (only set for Store/Load)
212  */
213 ir_mode *get_ia32_ls_mode(const ir_node *node);
214
215 /**
216  * Sets the mode of the stored/loaded value (only set for Store/Load)
217  */
218 void set_ia32_ls_mode(ir_node *node, ir_mode *mode);
219
220 /**
221  * Gets the frame entity assigned to this node;
222  */
223 ir_entity *get_ia32_frame_ent(const ir_node *node);
224
225 /**
226  * Sets the frame entity for this node;
227  */
228 void set_ia32_frame_ent(ir_node *node, ir_entity *ent);
229
230 /**
231  * Returns the condition code of a node.
232  */
233 ia32_condition_code_t get_ia32_condcode(const ir_node *node);
234
235 /**
236  * Sets the condition code of a node
237  */
238 void set_ia32_condcode(ir_node *node, ia32_condition_code_t code);
239
240 const ir_switch_table *get_ia32_switch_table(const ir_node *node);
241
242 unsigned get_ia32_copyb_size(const ir_node *node);
243
244 /**
245  * Gets the instruction latency.
246  */
247 unsigned get_ia32_latency(const ir_node *node);
248
249 /**
250  * Get the exception label attribute.
251  */
252 unsigned get_ia32_exc_label(const ir_node *node);
253
254 /**
255  * Set the exception label attribute.
256  */
257 void set_ia32_exc_label(ir_node *node, unsigned flag);
258
259 /**
260  * Return the exception label id.
261  */
262 ir_label_t get_ia32_exc_label_id(const ir_node *node);
263
264 /**
265  * Assign the exception label id.
266  */
267 void set_ia32_exc_label_id(ir_node *node, ir_label_t id);
268
269 #ifndef NDEBUG
270
271 /**
272  * Sets the name of the original ir node.
273  */
274 void set_ia32_orig_node(ir_node *node, const ir_node *old);
275
276 #endif /* NDEBUG */
277
278 /**
279  * Swaps left/right input of a node (and sets ins_permuted accordingly)
280  */
281 void ia32_swap_left_right(ir_node *node);
282
283 /* Include the generated headers */
284 #include "gen_ia32_new_nodes.h"
285
286 #endif