2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
8 * @brief Handling of ia32 specific firm opcodes.
9 * @author Christian Wuerdig
11 * This file implements the creation of the achitecture specific firm opcodes
12 * and the coresponding node constructors for the ia32 assembler irg.
14 #ifndef FIRM_BE_IA32_IA32_NEW_NODES_H
15 #define FIRM_BE_IA32_IA32_NEW_NODES_H
17 #include "ia32_nodes_attr.h"
19 /** indices for AM inputs */
25 n_ia32_binary_left = 3,
26 n_ia32_binary_right = 4
29 /** proj numbers for "normal" one-result nodes (for the complicated cases where we not only
37 extern struct obstack opcodes_obst;
40 * Returns the attributes of an ia32 node.
42 ia32_attr_t *get_ia32_attr(ir_node *node);
43 const ia32_attr_t *get_ia32_attr_const(const ir_node *node);
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);
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);
51 const ia32_asm_attr_t *get_ia32_asm_attr_const(const ir_node *node);
54 * Gets the condcode attributes of a node.
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);
60 * Gets the Call node attributes.
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);
66 * Gets the CopyB node attributes.
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);
72 * Gets the ClimbFrame node attributes.
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);
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);
81 * Gets the type of an ia32 node.
83 ia32_op_type_t get_ia32_op_type(const ir_node *node);
86 * Sets the type of an ia32 node.
88 void set_ia32_op_type(ir_node *node, ia32_op_type_t tp);
91 * Gets the supported address mode of an ia32 node
93 ia32_am_type_t get_ia32_am_support(const ir_node *node);
96 * Sets the supported addrmode of an ia32 node
98 void set_ia32_am_support(ir_node *node, ia32_am_type_t am_arity);
101 * Gets the addressmode offset as long.
103 int get_ia32_am_offs_int(const ir_node *node);
106 * Sets the addressmode offset
108 void set_ia32_am_offs_int(ir_node *node, int offset);
110 void add_ia32_am_offs_int(ir_node *node, int offset);
113 * Returns the symconst entity associated to addrmode.
115 ir_entity *get_ia32_am_sc(const ir_node *node);
118 * Sets the symconst entity associated to addrmode.
120 void set_ia32_am_sc(ir_node *node, ir_entity *sc);
123 * Sets the sign bit for address mode symconst.
125 void set_ia32_am_sc_sign(ir_node *node);
128 * Clears the sign bit for address mode symconst.
130 void clear_ia32_am_sc_sign(ir_node *node);
133 * Returns the sign bit for address mode symconst.
135 int is_ia32_am_sc_sign(const ir_node *node);
137 void set_ia32_am_tls_segment(ir_node *node, bool value);
139 bool get_ia32_am_tls_segment(const ir_node *node);
142 * Gets the addr mode const.
144 unsigned get_ia32_am_scale(const ir_node *node);
147 * Sets the const for addr mode.
149 void set_ia32_am_scale(ir_node *node, unsigned scale);
152 * Sets the uses_frame flag.
154 void set_ia32_use_frame(ir_node *node);
157 * Clears the uses_frame flag.
159 void clear_ia32_use_frame(ir_node *node);
162 * Gets the uses_frame flag.
164 int is_ia32_use_frame(const ir_node *node);
167 * copies all address-mode attributes from one node to the other
169 void ia32_copy_am_attrs(ir_node *to, const ir_node *from);
172 * Sets node to commutative.
174 void set_ia32_commutative(ir_node *node);
177 * Sets node to non-commutative.
179 void clear_ia32_commutative(ir_node *node);
182 * Checks if node is commutative.
184 int is_ia32_commutative(const ir_node *node);
187 * Sets node needs_stackent
189 void set_ia32_need_stackent(ir_node *node);
192 * Clears node needs_stackent
194 void clear_ia32_need_stackent(ir_node *node);
197 * Checks if node needs a stack entity assigned
199 int is_ia32_need_stackent(const ir_node *node);
201 void set_ia32_is_reload(ir_node *node);
202 int is_ia32_is_reload(const ir_node *node);
204 void set_ia32_is_spill(ir_node *node);
205 int is_ia32_is_spill(const ir_node *node);
207 void set_ia32_is_remat(ir_node *node);
208 int is_ia32_is_remat(const ir_node *node);
211 * Gets the mode of the stored/loaded value (only set for Store/Load)
213 ir_mode *get_ia32_ls_mode(const ir_node *node);
216 * Sets the mode of the stored/loaded value (only set for Store/Load)
218 void set_ia32_ls_mode(ir_node *node, ir_mode *mode);
221 * Gets the frame entity assigned to this node;
223 ir_entity *get_ia32_frame_ent(const ir_node *node);
226 * Sets the frame entity for this node;
228 void set_ia32_frame_ent(ir_node *node, ir_entity *ent);
231 * Returns the condition code of a node.
233 ia32_condition_code_t get_ia32_condcode(const ir_node *node);
236 * Sets the condition code of a node
238 void set_ia32_condcode(ir_node *node, ia32_condition_code_t code);
240 const ir_switch_table *get_ia32_switch_table(const ir_node *node);
242 unsigned get_ia32_copyb_size(const ir_node *node);
245 * Gets the instruction latency.
247 unsigned get_ia32_latency(const ir_node *node);
250 * Get the exception label attribute.
252 unsigned get_ia32_exc_label(const ir_node *node);
255 * Set the exception label attribute.
257 void set_ia32_exc_label(ir_node *node, unsigned flag);
260 * Return the exception label id.
262 ir_label_t get_ia32_exc_label_id(const ir_node *node);
265 * Assign the exception label id.
267 void set_ia32_exc_label_id(ir_node *node, ir_label_t id);
272 * Sets the name of the original ir node.
274 void set_ia32_orig_node(ir_node *node, const ir_node *old);
279 * Swaps left/right input of a node (and sets ins_permuted accordingly)
281 void ia32_swap_left_right(ir_node *node);
283 /* Include the generated headers */
284 #include "gen_ia32_new_nodes.h"