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
56 * returns true if a node has x87 registers
58 int ia32_has_x87_register(const ir_node *n);
61 * Returns the attributes of an ia32 node.
63 ia32_attr_t *get_ia32_attr(ir_node *node);
64 const ia32_attr_t *get_ia32_attr_const(const ir_node *node);
66 ia32_x87_attr_t *get_ia32_x87_attr(ir_node *node);
67 const ia32_x87_attr_t *get_ia32_x87_attr_const(const ir_node *node);
69 ia32_immediate_attr_t *get_ia32_immediate_attr(ir_node *node);
70 const ia32_immediate_attr_t *get_ia32_immediate_attr_const(const ir_node *node);
72 const ia32_asm_attr_t *get_ia32_asm_attr_const(const ir_node *node);
75 * Gets the condcode attributes of a node.
77 ia32_condcode_attr_t *get_ia32_condcode_attr(ir_node *node);
78 const ia32_condcode_attr_t *get_ia32_condcode_attr_const(const ir_node *node);
81 * Gets the Call node attributes.
83 ia32_call_attr_t *get_ia32_call_attr(ir_node *node);
84 const ia32_call_attr_t *get_ia32_call_attr_const(const ir_node *node);
87 * Gets the CopyB node attributes.
89 ia32_copyb_attr_t *get_ia32_copyb_attr(ir_node *node);
90 const ia32_copyb_attr_t *get_ia32_copyb_attr_const(const ir_node *node);
93 * Gets the ClimbFrame node attributes.
95 ia32_climbframe_attr_t *get_ia32_climbframe_attr(ir_node *node);
96 const ia32_climbframe_attr_t *get_ia32_climbframe_attr_const(const ir_node *node);
98 ia32_switch_attr_t *get_ia32_switch_attr(ir_node *node);
99 const ia32_switch_attr_t *get_ia32_switch_attr_const(const ir_node *node);
102 * Gets the type of an ia32 node.
104 ia32_op_type_t get_ia32_op_type(const ir_node *node);
107 * Sets the type of an ia32 node.
109 void set_ia32_op_type(ir_node *node, ia32_op_type_t tp);
112 * Gets the supported address mode of an ia32 node
114 ia32_am_type_t get_ia32_am_support(const ir_node *node);
117 * Sets the supported addrmode of an ia32 node
119 void set_ia32_am_support(ir_node *node, ia32_am_type_t am_arity);
122 * Gets the addressmode offset as long.
124 int get_ia32_am_offs_int(const ir_node *node);
127 * Sets the addressmode offset
129 void set_ia32_am_offs_int(ir_node *node, int offset);
131 void add_ia32_am_offs_int(ir_node *node, int offset);
134 * Returns the symconst entity associated to addrmode.
136 ir_entity *get_ia32_am_sc(const ir_node *node);
139 * Sets the symconst entity associated to addrmode.
141 void set_ia32_am_sc(ir_node *node, ir_entity *sc);
144 * Sets the sign bit for address mode symconst.
146 void set_ia32_am_sc_sign(ir_node *node);
149 * Clears the sign bit for address mode symconst.
151 void clear_ia32_am_sc_sign(ir_node *node);
154 * Returns the sign bit for address mode symconst.
156 int is_ia32_am_sc_sign(const ir_node *node);
159 * Gets the addr mode const.
161 unsigned get_ia32_am_scale(const ir_node *node);
164 * Sets the const for addr mode.
166 void set_ia32_am_scale(ir_node *node, unsigned scale);
169 * Sets the uses_frame flag.
171 void set_ia32_use_frame(ir_node *node);
174 * Clears the uses_frame flag.
176 void clear_ia32_use_frame(ir_node *node);
179 * Gets the uses_frame flag.
181 int is_ia32_use_frame(const ir_node *node);
184 * copies all address-mode attributes from one node to the other
186 void ia32_copy_am_attrs(ir_node *to, const ir_node *from);
189 * Sets node to commutative.
191 void set_ia32_commutative(ir_node *node);
194 * Sets node to non-commutative.
196 void clear_ia32_commutative(ir_node *node);
199 * Checks if node is commutative.
201 int is_ia32_commutative(const ir_node *node);
204 * Sets node needs_stackent
206 void set_ia32_need_stackent(ir_node *node);
209 * Clears node needs_stackent
211 void clear_ia32_need_stackent(ir_node *node);
214 * Checks if node needs a stack entity assigned
216 int is_ia32_need_stackent(const ir_node *node);
218 void set_ia32_is_reload(ir_node *node);
219 int is_ia32_is_reload(const ir_node *node);
221 void set_ia32_is_spill(ir_node *node);
222 int is_ia32_is_spill(const ir_node *node);
224 void set_ia32_is_remat(ir_node *node);
225 int is_ia32_is_remat(const ir_node *node);
228 * Gets the mode of the stored/loaded value (only set for Store/Load)
230 ir_mode *get_ia32_ls_mode(const ir_node *node);
233 * Sets the mode of the stored/loaded value (only set for Store/Load)
235 void set_ia32_ls_mode(ir_node *node, ir_mode *mode);
238 * Gets the frame entity assigned to this node;
240 ir_entity *get_ia32_frame_ent(const ir_node *node);
243 * Sets the frame entity for this node;
245 void set_ia32_frame_ent(ir_node *node, ir_entity *ent);
248 * Returns the condition code of a node.
250 ia32_condition_code_t get_ia32_condcode(const ir_node *node);
253 * Sets the condition code of a node
255 void set_ia32_condcode(ir_node *node, ia32_condition_code_t code);
257 long get_ia32_default_pn(const ir_node *node);
259 unsigned get_ia32_copyb_size(const ir_node *node);
262 * Gets the instruction latency.
264 unsigned get_ia32_latency(const ir_node *node);
268 * Get the list of available execution units.
270 const be_execution_unit_t ***get_ia32_exec_units(const ir_node *node);
273 * Get the exception label attribute.
275 unsigned get_ia32_exc_label(const ir_node *node);
278 * Set the exception label attribute.
280 void set_ia32_exc_label(ir_node *node, unsigned flag);
283 * Return the exception label id.
285 ir_label_t get_ia32_exc_label_id(const ir_node *node);
288 * Assign the exception label id.
290 void set_ia32_exc_label_id(ir_node *node, ir_label_t id);
295 * Returns the name of the original ir node.
297 const char *get_ia32_orig_node(const ir_node *node);
300 * Sets the name of the original ir node.
302 void set_ia32_orig_node(ir_node *node, const ir_node *old);
308 * Returns the ident of an entity
309 * @param ent The entity
310 * @return The ident of the entity
312 ident *ia32_get_ent_ident(ir_entity *ent);
315 * Copy the attributes from a Const to an ia32_Const
317 void set_ia32_Const_attr(ir_node *ia32_cnst, ir_node *cnst);
319 void set_ia32_Const_tarval(ir_node *node, ir_tarval *tv);
322 * Returns whether or not the node is an AddrModeS node.
324 int is_ia32_AddrModeS(const ir_node *node);
327 * Returns whether or not the node is an AddrModeD node.
329 int is_ia32_AddrModeD(const ir_node *node);
332 * Swaps left/right input of a node (and sets ins_permuted accordingly)
334 void ia32_swap_left_right(ir_node *node);
336 /* Include the generated headers */
337 #include "gen_ia32_new_nodes.h"