2 * Copyright (C) 1995-2007 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
21 * Function prototypes for the assembler ir node constructors.
22 * @author Christian Wuerdig
26 #ifndef _IA32_NEW_NODES_H_
27 #define _IA32_NEW_NODES_H_
29 #include "firm_config.h"
30 #include "ia32_nodes_attr.h"
32 /***************************************************************************************************
34 * | | | | | | / / | | | | | | | |
35 * __ _| |_| |_ _ __ ___ ___| |_ / /_ _ ___| |_ _ __ ___ ___| |_| |__ ___ __| |___
36 * / _` | __| __| '__| / __|/ _ \ __| / / _` |/ _ \ __| | '_ ` _ \ / _ \ __| '_ \ / _ \ / _` / __|
37 * | (_| | |_| |_| | \__ \ __/ |_ / / (_| | __/ |_ | | | | | | __/ |_| | | | (_) | (_| \__ \
38 * \__,_|\__|\__|_| |___/\___|\__/_/ \__, |\___|\__| |_| |_| |_|\___|\__|_| |_|\___/ \__,_|___/
41 ***************************************************************************************************/
44 * returns true if a node has x87 registers
46 int ia32_has_x87_register(const ir_node *n);
49 * Returns the attributes of an ia32 node.
51 ia32_attr_t *get_ia32_attr(const ir_node *node);
54 * Gets the type of an ia32 node.
56 ia32_op_type_t get_ia32_op_type(const ir_node *node);
59 * Sets the type of an ia32 node.
61 void set_ia32_op_type(ir_node *node, ia32_op_type_t tp);
64 * Gets the immediate op type of an ia32 node.
66 ia32_immop_type_t get_ia32_immop_type(const ir_node *node);
69 * Sets the immediate op type of an ia32 node.
71 void set_ia32_immop_type(ir_node *node, ia32_immop_type_t tp);
74 * Gets the supported addrmode of an ia32 node
76 ia32_am_type_t get_ia32_am_support(const ir_node *node);
79 * Sets the supported addrmode of an ia32 node
81 void set_ia32_am_support(ir_node *node, ia32_am_type_t am_tp);
84 * Gets the addrmode flavour of an ia32 node
86 ia32_am_flavour_t get_ia32_am_flavour(const ir_node *node);
89 * Sets the addrmode flavour of an ia32 node
91 void set_ia32_am_flavour(ir_node *node, ia32_am_flavour_t am_flavour);
94 * Gets the addressmode offset as long.
96 int get_ia32_am_offs_int(const ir_node *node);
99 * Sets the addressmode offset
101 void set_ia32_am_offs_int(ir_node *node, int offset);
103 void add_ia32_am_offs_int(ir_node *node, int offset);
106 * Returns the symconst entity associated to addrmode.
108 ir_entity *get_ia32_am_sc(const ir_node *node);
111 * Sets the symconst entity associated to addrmode.
113 void set_ia32_am_sc(ir_node *node, ir_entity *sc);
116 * Sets the sign bit for address mode symconst.
118 void set_ia32_am_sc_sign(ir_node *node);
121 * Clears the sign bit for address mode symconst.
123 void clear_ia32_am_sc_sign(ir_node *node);
126 * Returns the sign bit for address mode symconst.
128 int is_ia32_am_sc_sign(const ir_node *node);
131 * Gets the addr mode const.
133 int get_ia32_am_scale(const ir_node *node);
136 * Sets the const for addr mode.
138 void set_ia32_am_scale(ir_node *node, int scale);
141 * Return the tarval of an immediate operation or NULL if none set
143 tarval *get_ia32_Immop_tarval(const ir_node *node);
146 * Return the symconst entity of an immediate operation or NULL if none set
148 ir_entity* get_ia32_Immop_symconst(const ir_node *node);
151 * Sets the attributes of an immediate operation to the specified tarval
153 void set_ia32_Immop_tarval(ir_node *node, tarval *tv);
156 * Sets the attributes of an immediate operation to the specified SymConst
158 void set_ia32_Immop_symconst(ir_node *node, ir_entity *entity);
161 * Sets the uses_frame flag.
163 void set_ia32_use_frame(ir_node *node);
166 * Clears the uses_frame flag.
168 void clear_ia32_use_frame(ir_node *node);
171 * Gets the uses_frame flag.
173 int is_ia32_use_frame(const ir_node *node);
176 * Sets node to commutative.
178 void set_ia32_commutative(ir_node *node);
181 * Sets node to non-commutative.
183 void clear_ia32_commutative(ir_node *node);
186 * Checks if node is commutative.
188 int is_ia32_commutative(const ir_node *node);
193 void set_ia32_emit_cl(ir_node *node);
196 * Clears node emit_cl.
198 void clear_ia32_emit_cl(ir_node *node);
201 * Checks if node is commutative.
203 int is_ia32_emit_cl(const ir_node *node);
208 void set_ia32_got_lea(ir_node *node);
211 * Clears node got_lea.
213 void clear_ia32_got_lea(ir_node *node);
216 * Checks if node got lea.
218 int is_ia32_got_lea(const ir_node *node);
221 * Sets node needs_stackent
223 void set_ia32_need_stackent(ir_node *node);
226 * Clears node needs_stackent
228 void clear_ia32_need_stackent(ir_node *node);
231 * Checks if node needs a stackentity assigned
233 int is_ia32_need_stackent(const ir_node *node);
236 * Gets the mode of the stored/loaded value (only set for Store/Load)
238 ir_mode *get_ia32_ls_mode(const ir_node *node);
241 * Sets the mode of the stored/loaded value (only set for Store/Load)
243 void set_ia32_ls_mode(ir_node *node, ir_mode *mode);
246 * Gets the frame entity assigned to this node;
248 ir_entity *get_ia32_frame_ent(const ir_node *node);
251 * Sets the frame entity for this node;
253 void set_ia32_frame_ent(ir_node *node, ir_entity *ent);
256 * Returns the argument register requirements of an ia32 node.
258 const arch_register_req_t **get_ia32_in_req_all(const ir_node *node);
261 * Sets the argument register requirements of an ia32 node.
263 void set_ia32_in_req_all(ir_node *node, const arch_register_req_t **reqs);
266 * Returns the result register requirements of an ia32 node.
268 const arch_register_req_t **get_ia32_out_req_all(const ir_node *node);
271 * Sets the result register requirements of an ia32 node.
273 void set_ia32_out_req_all(ir_node *node, const arch_register_req_t **reqs);
276 * Returns the argument register requirements of an ia32 node.
278 const arch_register_req_t *get_ia32_in_req(const ir_node *node, int pos);
281 * Returns the result register requirements of an ia32 node.
283 const arch_register_req_t *get_ia32_out_req(const ir_node *node, int pos);
286 * Sets the OUT register requirements at position pos.
288 void set_ia32_req_out(ir_node *node, const arch_register_req_t *req, int pos);
291 * Sets the IN register requirements at position pos.
293 void set_ia32_req_in(ir_node *node, const arch_register_req_t *req, int pos);
296 * Returns the register flag of an ia32 node.
298 arch_irn_flags_t get_ia32_flags(const ir_node *node);
301 * Sets the register flag of an ia32 node.
303 void set_ia32_flags(ir_node *node, arch_irn_flags_t flags);
306 * Returns the result register slots of an ia32 node.
308 const arch_register_t **get_ia32_slots(const ir_node *node);
311 * Returns the name of the OUT register at position pos.
313 const char *get_ia32_out_reg_name(const ir_node *node, int pos);
316 * Returns the index of the OUT register at position pos within its register class.
318 int get_ia32_out_regnr(const ir_node *node, int pos);
321 * Returns the OUT register at position pos.
323 const arch_register_t *get_ia32_out_reg(const ir_node *node, int pos);
326 * Sets the number of results.
328 void set_ia32_n_res(ir_node *node, int n_res);
331 * Returns the number of results.
333 int get_ia32_n_res(const ir_node *node);
336 * Returns the flavour of an ia32 node,
338 ia32_op_flavour_t get_ia32_flavour(const ir_node *node);
341 * Sets the flavour of an ia32 node to flavour_Div/Mod/DivMod/Mul/Mulh.
343 void set_ia32_flavour(ir_node *node, ia32_op_flavour_t op_flav);
346 * Returns the projnum code.
348 pn_Cmp get_ia32_pncode(const ir_node *node);
351 * Sets the projnum code
353 void set_ia32_pncode(ir_node *node, pn_Cmp code);
356 * Gets the instruction latency.
358 unsigned get_ia32_latency(const ir_node *node);
361 * Sets the instruction latency.
363 void set_ia32_latency(ir_node *node, unsigned latency);
367 * Sets the flags for the n'th out.
369 void set_ia32_out_flags(ir_node *node, arch_irn_flags_t flags, int pos);
372 * Gets the flags for the n'th out.
374 arch_irn_flags_t get_ia32_out_flags(const ir_node *node, int pos);
377 * Get the list of available execution units.
379 const be_execution_unit_t ***get_ia32_exec_units(const ir_node *node);
384 * Returns the name of the original ir node.
386 const char *get_ia32_orig_node(const ir_node *node);
389 * Sets the name of the original ir node.
391 void set_ia32_orig_node(ir_node *node, const char *name);
395 /******************************************************************************************************
397 * (_) | | | | | | / _| | | (_)
398 * ___ _ __ ___ ___ _ __ _| | __ _| |_| |_ _ __ | |_ _ _ _ __ ___| |_ _ ___ _ __ ___
399 * / __| '_ \ / _ \/ __| |/ _` | | / _` | __| __| '__| | _| | | | '_ \ / __| __| |/ _ \| '_ \ / __|
400 * \__ \ |_) | __/ (__| | (_| | | | (_| | |_| |_| | | | | |_| | | | | (__| |_| | (_) | | | | \__ \
401 * |___/ .__/ \___|\___|_|\__,_|_| \__,_|\__|\__|_| |_| \__,_|_| |_|\___|\__|_|\___/|_| |_| |___/
404 ******************************************************************************************************/
407 * Returns the ident of an entity
408 * @param ent The entity
409 * @return The ident of the entity
411 ident *ia32_get_ent_ident(ir_entity *ent);
414 * Copy the attributes from Immop to an Immop
416 void copy_ia32_Immop_attr(ir_node *node, ir_node *src);
419 * Returns the proj of the result value for nodes that have the usual
420 * (res, Mem) result tuple
422 ir_node *get_ia32_result_proj(const ir_node *node);
425 * Copy the attributes from a Const to an ia32_Const
427 void set_ia32_Const_attr(ir_node *ia32_cnst, ir_node *cnst);
429 void set_ia32_Const_tarval(ir_node *node, tarval *tv);
432 * Sets the AddrMode attribute
433 * @param direction The "direction" of AM ('S' source or 'D' destination)
435 void set_ia32_AddrMode(ir_node *node, char direction);
438 * Returns whether or not the node is an immediate operation with Const.
440 int is_ia32_ImmConst(const ir_node *node);
443 * Returns whether or not the node is an immediate operation with SymConst.
445 int is_ia32_ImmSymConst(const ir_node *node);
448 * Returns whether or not the node is an AddrModeS node.
450 int is_ia32_AddrModeS(const ir_node *node);
453 * Returns whether or not the node is an AddrModeD node.
455 int is_ia32_AddrModeD(const ir_node *node);
458 * Checks if node is a Load or fLoad.
460 int is_ia32_Ld(const ir_node *node);
463 * Checks if node is a Store or fStore.
465 int is_ia32_St(const ir_node *node);
468 * Checks if node is a Const or fConst.
470 int is_ia32_Cnst(const ir_node *node);
473 * Initializes the nodes attributes.
475 void init_ia32_attributes(ir_node *node, arch_irn_flags_t flags,
476 const arch_register_req_t **in_reqs,
477 const arch_register_req_t **out_reqs,
478 const be_execution_unit_t ***execution_units,
479 int n_res, unsigned latency);
482 * Registers the ia32_copy_attr function for all ia32 opcodes.
484 void ia32_register_copy_attr_func(void);
486 /* Include the generated headers */
487 #include "gen_ia32_new_nodes.h"
489 #endif /* _IA32_NEW_NODES_H_ */