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
25 * This file implements the creation of the achitecture specific firm opcodes
26 * and the coresponding node constructors for the ia32 assembler irg.
28 #ifndef FIRM_BE_IA32_IA32_NEW_NODES_H
29 #define FIRM_BE_IA32_IA32_NEW_NODES_H
31 #include "ia32_nodes_attr.h"
33 /** indices for AM inputs */
39 n_ia32_binary_left = 3,
40 n_ia32_binary_right = 4
43 /** proj numbers for "normal" one-result nodes (for the complicated cases where we not only
51 extern struct obstack opcodes_obst;
54 * Returns the attributes of an ia32 node.
56 ia32_attr_t *get_ia32_attr(ir_node *node);
57 const ia32_attr_t *get_ia32_attr_const(const ir_node *node);
59 ia32_x87_attr_t *get_ia32_x87_attr(ir_node *node);
60 const ia32_x87_attr_t *get_ia32_x87_attr_const(const ir_node *node);
62 ia32_immediate_attr_t *get_ia32_immediate_attr(ir_node *node);
63 const ia32_immediate_attr_t *get_ia32_immediate_attr_const(const ir_node *node);
65 const ia32_asm_attr_t *get_ia32_asm_attr_const(const ir_node *node);
68 * Gets the condcode attributes of a node.
70 ia32_condcode_attr_t *get_ia32_condcode_attr(ir_node *node);
71 const ia32_condcode_attr_t *get_ia32_condcode_attr_const(const ir_node *node);
74 * Gets the Call node attributes.
76 ia32_call_attr_t *get_ia32_call_attr(ir_node *node);
77 const ia32_call_attr_t *get_ia32_call_attr_const(const ir_node *node);
80 * Gets the CopyB node attributes.
82 ia32_copyb_attr_t *get_ia32_copyb_attr(ir_node *node);
83 const ia32_copyb_attr_t *get_ia32_copyb_attr_const(const ir_node *node);
86 * Gets the ClimbFrame node attributes.
88 ia32_climbframe_attr_t *get_ia32_climbframe_attr(ir_node *node);
89 const ia32_climbframe_attr_t *get_ia32_climbframe_attr_const(const ir_node *node);
91 ia32_switch_attr_t *get_ia32_switch_attr(ir_node *node);
92 const ia32_switch_attr_t *get_ia32_switch_attr_const(const ir_node *node);
95 * Gets the type of an ia32 node.
97 ia32_op_type_t get_ia32_op_type(const ir_node *node);
100 * Sets the type of an ia32 node.
102 void set_ia32_op_type(ir_node *node, ia32_op_type_t tp);
105 * Gets the supported address mode of an ia32 node
107 ia32_am_type_t get_ia32_am_support(const ir_node *node);
110 * Sets the supported addrmode of an ia32 node
112 void set_ia32_am_support(ir_node *node, ia32_am_type_t am_arity);
115 * Gets the addressmode offset as long.
117 int get_ia32_am_offs_int(const ir_node *node);
120 * Sets the addressmode offset
122 void set_ia32_am_offs_int(ir_node *node, int offset);
124 void add_ia32_am_offs_int(ir_node *node, int offset);
127 * Returns the symconst entity associated to addrmode.
129 ir_entity *get_ia32_am_sc(const ir_node *node);
132 * Sets the symconst entity associated to addrmode.
134 void set_ia32_am_sc(ir_node *node, ir_entity *sc);
137 * Sets the sign bit for address mode symconst.
139 void set_ia32_am_sc_sign(ir_node *node);
142 * Clears the sign bit for address mode symconst.
144 void clear_ia32_am_sc_sign(ir_node *node);
147 * Returns the sign bit for address mode symconst.
149 int is_ia32_am_sc_sign(const ir_node *node);
151 void set_ia32_am_tls_segment(ir_node *node, bool value);
153 bool get_ia32_am_tls_segment(const ir_node *node);
156 * Gets the addr mode const.
158 unsigned get_ia32_am_scale(const ir_node *node);
161 * Sets the const for addr mode.
163 void set_ia32_am_scale(ir_node *node, unsigned scale);
166 * Sets the uses_frame flag.
168 void set_ia32_use_frame(ir_node *node);
171 * Clears the uses_frame flag.
173 void clear_ia32_use_frame(ir_node *node);
176 * Gets the uses_frame flag.
178 int is_ia32_use_frame(const ir_node *node);
181 * copies all address-mode attributes from one node to the other
183 void ia32_copy_am_attrs(ir_node *to, const ir_node *from);
186 * Sets node to commutative.
188 void set_ia32_commutative(ir_node *node);
191 * Sets node to non-commutative.
193 void clear_ia32_commutative(ir_node *node);
196 * Checks if node is commutative.
198 int is_ia32_commutative(const ir_node *node);
201 * Sets node needs_stackent
203 void set_ia32_need_stackent(ir_node *node);
206 * Clears node needs_stackent
208 void clear_ia32_need_stackent(ir_node *node);
211 * Checks if node needs a stack entity assigned
213 int is_ia32_need_stackent(const ir_node *node);
215 void set_ia32_is_reload(ir_node *node);
216 int is_ia32_is_reload(const ir_node *node);
218 void set_ia32_is_spill(ir_node *node);
219 int is_ia32_is_spill(const ir_node *node);
221 void set_ia32_is_remat(ir_node *node);
222 int is_ia32_is_remat(const ir_node *node);
225 * Gets the mode of the stored/loaded value (only set for Store/Load)
227 ir_mode *get_ia32_ls_mode(const ir_node *node);
230 * Sets the mode of the stored/loaded value (only set for Store/Load)
232 void set_ia32_ls_mode(ir_node *node, ir_mode *mode);
235 * Gets the frame entity assigned to this node;
237 ir_entity *get_ia32_frame_ent(const ir_node *node);
240 * Sets the frame entity for this node;
242 void set_ia32_frame_ent(ir_node *node, ir_entity *ent);
245 * Returns the condition code of a node.
247 ia32_condition_code_t get_ia32_condcode(const ir_node *node);
250 * Sets the condition code of a node
252 void set_ia32_condcode(ir_node *node, ia32_condition_code_t code);
254 const ir_switch_table *get_ia32_switch_table(const ir_node *node);
256 unsigned get_ia32_copyb_size(const ir_node *node);
259 * Gets the instruction latency.
261 unsigned get_ia32_latency(const ir_node *node);
264 * Get the exception label attribute.
266 unsigned get_ia32_exc_label(const ir_node *node);
269 * Set the exception label attribute.
271 void set_ia32_exc_label(ir_node *node, unsigned flag);
274 * Return the exception label id.
276 ir_label_t get_ia32_exc_label_id(const ir_node *node);
279 * Assign the exception label id.
281 void set_ia32_exc_label_id(ir_node *node, ir_label_t id);
286 * Returns the name of the original ir node.
288 const char *get_ia32_orig_node(const ir_node *node);
291 * Sets the name of the original ir node.
293 void set_ia32_orig_node(ir_node *node, const ir_node *old);
298 * Swaps left/right input of a node (and sets ins_permuted accordingly)
300 void ia32_swap_left_right(ir_node *node);
302 /* Include the generated headers */
303 #include "gen_ia32_new_nodes.h"