2 * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
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.
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.
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
22 * @brief Handling of ia32 specific firm opcodes.
23 * @author Christian Wuerdig
26 * This file implements the creation of the achitecture specific firm opcodes
27 * and the coresponding node constructors for the ia32 assembler irg.
29 #ifndef FIRM_BE_IA32_IA32_NEW_NODES_H
30 #define FIRM_BE_IA32_IA32_NEW_NODES_H
32 #include "ia32_nodes_attr.h"
34 /** indices for AM inputs */
40 n_ia32_binary_left = 3,
41 n_ia32_binary_right = 4
44 /** proj numbers for "normal" one-result nodes (for the complicated cases where we not only
54 /***************************************************************************************************
56 * | | | | | | / / | | | | | | | |
57 * __ _| |_| |_ _ __ ___ ___| |_ / /_ _ ___| |_ _ __ ___ ___| |_| |__ ___ __| |___
58 * / _` | __| __| '__| / __|/ _ \ __| / / _` |/ _ \ __| | '_ ` _ \ / _ \ __| '_ \ / _ \ / _` / __|
59 * | (_| | |_| |_| | \__ \ __/ |_ / / (_| | __/ |_ | | | | | | __/ |_| | | | (_) | (_| \__ \
60 * \__,_|\__|\__|_| |___/\___|\__/_/ \__, |\___|\__| |_| |_| |_|\___|\__|_| |_|\___/ \__,_|___/
63 ***************************************************************************************************/
66 * returns true if a node has x87 registers
68 int ia32_has_x87_register(const ir_node *n);
71 * Returns the attributes of an ia32 node.
73 ia32_attr_t *get_ia32_attr(ir_node *node);
74 const ia32_attr_t *get_ia32_attr_const(const ir_node *node);
76 ia32_x87_attr_t *get_ia32_x87_attr(ir_node *node);
77 const ia32_x87_attr_t *get_ia32_x87_attr_const(const ir_node *node);
79 ia32_immediate_attr_t *get_ia32_immediate_attr(ir_node *node);
80 const ia32_immediate_attr_t *get_ia32_immediate_attr_const(const ir_node *node);
83 * Gets the condcode attributes of a node.
85 ia32_condcode_attr_t *get_ia32_condcode_attr(ir_node *node);
86 const ia32_condcode_attr_t *get_ia32_condcode_attr_const(const ir_node *node);
89 * Gets the Call node attributes.
91 ia32_call_attr_t *get_ia32_call_attr(ir_node *node);
92 const ia32_call_attr_t *get_ia32_call_attr_const(const ir_node *node);
95 * Gets the CopyB node attributes.
97 ia32_copyb_attr_t *get_ia32_copyb_attr(ir_node *node);
98 const ia32_copyb_attr_t *get_ia32_copyb_attr_const(const ir_node *node);
101 * Gets the type of an ia32 node.
103 ia32_op_type_t get_ia32_op_type(const ir_node *node);
106 * Sets the type of an ia32 node.
108 void set_ia32_op_type(ir_node *node, ia32_op_type_t tp);
111 * Gets the supported address mode of an ia32 node
113 ia32_am_type_t get_ia32_am_support(const ir_node *node);
116 * Sets the supported addrmode of an ia32 node
118 void set_ia32_am_support(ir_node *node, ia32_am_type_t am_arity);
121 * Gets the addressmode offset as long.
123 int get_ia32_am_offs_int(const ir_node *node);
126 * Sets the addressmode offset
128 void set_ia32_am_offs_int(ir_node *node, int offset);
130 void add_ia32_am_offs_int(ir_node *node, int offset);
133 * Returns the symconst entity associated to addrmode.
135 ir_entity *get_ia32_am_sc(const ir_node *node);
138 * Sets the symconst entity associated to addrmode.
140 void set_ia32_am_sc(ir_node *node, ir_entity *sc);
143 * Sets the sign bit for address mode symconst.
145 void set_ia32_am_sc_sign(ir_node *node);
148 * Clears the sign bit for address mode symconst.
150 void clear_ia32_am_sc_sign(ir_node *node);
153 * Returns the sign bit for address mode symconst.
155 int is_ia32_am_sc_sign(const ir_node *node);
158 * Gets the addr mode const.
160 unsigned get_ia32_am_scale(const ir_node *node);
163 * Sets the const for addr mode.
165 void set_ia32_am_scale(ir_node *node, unsigned scale);
168 * Sets the uses_frame flag.
170 void set_ia32_use_frame(ir_node *node);
173 * Clears the uses_frame flag.
175 void clear_ia32_use_frame(ir_node *node);
178 * Gets the uses_frame flag.
180 int is_ia32_use_frame(const ir_node *node);
183 * copies all address-mode attributes from one node to the other
185 void ia32_copy_am_attrs(ir_node *to, const ir_node *from);
188 * Sets node to commutative.
190 void set_ia32_commutative(ir_node *node);
193 * Sets node to non-commutative.
195 void clear_ia32_commutative(ir_node *node);
198 * Checks if node is commutative.
200 int is_ia32_commutative(const ir_node *node);
203 * Sets node needs_stackent
205 void set_ia32_need_stackent(ir_node *node);
208 * Clears node needs_stackent
210 void clear_ia32_need_stackent(ir_node *node);
213 * Checks if node needs a stack entity assigned
215 int is_ia32_need_stackent(const ir_node *node);
217 void set_ia32_is_reload(ir_node *node);
218 int is_ia32_is_reload(const ir_node *node);
220 void set_ia32_is_spill(ir_node *node);
221 int is_ia32_is_spill(const ir_node *node);
223 void set_ia32_is_remat(ir_node *node);
224 int is_ia32_is_remat(const ir_node *node);
227 * Gets the mode of the stored/loaded value (only set for Store/Load)
229 ir_mode *get_ia32_ls_mode(const ir_node *node);
232 * Sets the mode of the stored/loaded value (only set for Store/Load)
234 void set_ia32_ls_mode(ir_node *node, ir_mode *mode);
237 * Gets the frame entity assigned to this node;
239 ir_entity *get_ia32_frame_ent(const ir_node *node);
242 * Sets the frame entity for this node;
244 void set_ia32_frame_ent(ir_node *node, ir_entity *ent);
247 * Returns the argument register requirements of an ia32 node.
249 const arch_register_req_t **get_ia32_in_req_all(const ir_node *node);
252 * Sets the argument register requirements of an ia32 node.
254 void set_ia32_in_req_all(ir_node *node, const arch_register_req_t **reqs);
257 * Returns the result register requirements of an ia32 node.
259 const arch_register_req_t **get_ia32_out_req_all(const ir_node *node);
262 * Sets the result register requirements of an ia32 node.
264 void set_ia32_out_req_all(ir_node *node, const arch_register_req_t **reqs);
267 * Returns the argument register requirements of an ia32 node.
269 const arch_register_req_t *get_ia32_in_req(const ir_node *node, int pos);
272 * Returns the result register requirements of an ia32 node.
274 const arch_register_req_t *get_ia32_out_req(const ir_node *node, int pos);
277 * Sets the OUT register requirements at position pos.
279 void set_ia32_req_out(ir_node *node, const arch_register_req_t *req, int pos);
282 * Sets the IN register requirements at position pos.
284 void set_ia32_req_in(ir_node *node, const arch_register_req_t *req, int pos);
287 * Returns the condition code of a node.
289 long get_ia32_condcode(const ir_node *node);
292 * Sets the condition code of a node
294 void set_ia32_condcode(ir_node *node, long code);
297 * Returns the condition code of a node.
299 unsigned get_ia32_copyb_size(const ir_node *node);
302 * Gets the instruction latency.
304 unsigned get_ia32_latency(const ir_node *node);
308 * Sets the flags for the n'th out.
310 void set_ia32_out_flags(ir_node *node, arch_irn_flags_t flags, int pos);
313 * Gets the flags for the n'th out.
315 arch_irn_flags_t get_ia32_out_flags(const ir_node *node, int pos);
318 * Get the list of available execution units.
320 const be_execution_unit_t ***get_ia32_exec_units(const ir_node *node);
323 * Get the exception label attribute.
325 unsigned get_ia32_exc_label(const ir_node *node);
328 * Set the exception label attribute.
330 void set_ia32_exc_label(ir_node *node, unsigned flag);
333 * Return the exception label id.
335 ir_label_t get_ia32_exc_label_id(const ir_node *node);
338 * Assign the exception label id.
340 void set_ia32_exc_label_id(ir_node *node, ir_label_t id);
345 * Returns the name of the original ir node.
347 const char *get_ia32_orig_node(const ir_node *node);
350 * Sets the name of the original ir node.
352 void set_ia32_orig_node(ir_node *node, const ir_node *old);
356 /******************************************************************************************************
358 * (_) | | | | | | / _| | | (_)
359 * ___ _ __ ___ ___ _ __ _| | __ _| |_| |_ _ __ | |_ _ _ _ __ ___| |_ _ ___ _ __ ___
360 * / __| '_ \ / _ \/ __| |/ _` | | / _` | __| __| '__| | _| | | | '_ \ / __| __| |/ _ \| '_ \ / __|
361 * \__ \ |_) | __/ (__| | (_| | | | (_| | |_| |_| | | | | |_| | | | | (__| |_| | (_) | | | | \__ \
362 * |___/ .__/ \___|\___|_|\__,_|_| \__,_|\__|\__|_| |_| \__,_|_| |_|\___|\__|_|\___/|_| |_| |___/
365 ******************************************************************************************************/
368 * Returns the ident of an entity
369 * @param ent The entity
370 * @return The ident of the entity
372 ident *ia32_get_ent_ident(ir_entity *ent);
375 * Copy the attributes from a Const to an ia32_Const
377 void set_ia32_Const_attr(ir_node *ia32_cnst, ir_node *cnst);
379 void set_ia32_Const_tarval(ir_node *node, tarval *tv);
382 * Returns whether or not the node is an AddrModeS node.
384 int is_ia32_AddrModeS(const ir_node *node);
387 * Returns whether or not the node is an AddrModeD node.
389 int is_ia32_AddrModeD(const ir_node *node);
392 * Swaps left/right input of a node (and adjusts pnc if needed)
394 void ia32_swap_left_right(ir_node *node);
397 * Initializes the nodes attributes.
399 void init_ia32_attributes(ir_node *node, arch_irn_flags_t flags,
400 const arch_register_req_t **in_reqs,
401 const arch_register_req_t **out_reqs,
402 const be_execution_unit_t ***execution_units,
405 void init_ia32_x87_attributes(ir_node *node);
406 void init_ia32_asm_attributes(ir_node *node);
407 void init_ia32_immediate_attributes(ir_node *node, ir_entity *symconst,
408 int symconst_sign, long offset);
409 void init_ia32_call_attributes(ir_node *res, unsigned pop, ir_type *call_tp);
410 void init_ia32_copyb_attributes(ir_node *res, unsigned size);
411 void init_ia32_condcode_attributes(ir_node *res, long pnc);
413 /* Include the generated headers */
414 #include "gen_ia32_new_nodes.h"
416 #endif /* FIRM_BE_IA32_IA32_NEW_NODES_H */