2 * Function prototypes for the assembler ir node constructors.
3 * @author Christian Wuerdig
7 #ifndef _IA32_NEW_NODES_H_
8 #define _IA32_NEW_NODES_H_
10 #include "firm_config.h"
11 #include "ia32_nodes_attr.h"
13 /***************************************************************************************************
15 * | | | | | | / / | | | | | | | |
16 * __ _| |_| |_ _ __ ___ ___| |_ / /_ _ ___| |_ _ __ ___ ___| |_| |__ ___ __| |___
17 * / _` | __| __| '__| / __|/ _ \ __| / / _` |/ _ \ __| | '_ ` _ \ / _ \ __| '_ \ / _ \ / _` / __|
18 * | (_| | |_| |_| | \__ \ __/ |_ / / (_| | __/ |_ | | | | | | __/ |_| | | | (_) | (_| \__ \
19 * \__,_|\__|\__|_| |___/\___|\__/_/ \__, |\___|\__| |_| |_| |_|\___|\__|_| |_|\___/ \__,_|___/
22 ***************************************************************************************************/
25 * returns true if a node has x87 registers
27 int ia32_has_x87_register(const ir_node *n);
30 * Returns the attributes of an ia32 node.
32 ia32_attr_t *get_ia32_attr(const ir_node *node);
35 * Gets the type of an ia32 node.
37 ia32_op_type_t get_ia32_op_type(const ir_node *node);
40 * Sets the type of an ia32 node.
42 void set_ia32_op_type(ir_node *node, ia32_op_type_t tp);
45 * Gets the immediate op type of an ia32 node.
47 ia32_immop_type_t get_ia32_immop_type(const ir_node *node);
50 * Sets the immediate op type of an ia32 node.
52 void set_ia32_immop_type(ir_node *node, ia32_immop_type_t tp);
55 * Gets the supported addrmode of an ia32 node
57 ia32_am_type_t get_ia32_am_support(const ir_node *node);
60 * Sets the supported addrmode of an ia32 node
62 void set_ia32_am_support(ir_node *node, ia32_am_type_t am_tp);
65 * Gets the addrmode flavour of an ia32 node
67 ia32_am_flavour_t get_ia32_am_flavour(const ir_node *node);
70 * Sets the addrmode flavour of an ia32 node
72 void set_ia32_am_flavour(ir_node *node, ia32_am_flavour_t am_flavour);
75 * Gets the joined addrmode offset.
77 char *get_ia32_am_offs(const ir_node *node);
80 * Gets the addressmode offset as long.
82 int get_ia32_am_offs_int(const ir_node *node);
85 * Sets the addressmode offset
87 void set_ia32_am_offs_int(ir_node *node, int offset);
90 * Adds an offset for addrmode.
92 void add_ia32_am_offs(ir_node *node, const char *offset);
94 void add_ia32_am_offs_int(ir_node *node, int offset);
97 * Subs an offset for addrmode.
99 void sub_ia32_am_offs(ir_node *node, const char *offset);
102 * Returns the symconst ident associated to addrmode.
104 ident *get_ia32_am_sc(const ir_node *node);
107 * Sets the symconst ident associated to addrmode.
109 void set_ia32_am_sc(ir_node *node, ident *sc);
112 * Sets the sign bit for address mode symconst.
114 void set_ia32_am_sc_sign(ir_node *node);
117 * Clears the sign bit for address mode symconst.
119 void clear_ia32_am_sc_sign(ir_node *node);
122 * Returns the sign bit for address mode symconst.
124 int is_ia32_am_sc_sign(const ir_node *node);
127 * Gets the addr mode const.
129 int get_ia32_am_scale(const ir_node *node);
132 * Sets the const for addr mode.
134 void set_ia32_am_scale(ir_node *node, int scale);
137 * Return the tarval of an immediate operation or NULL in case of SymConst
139 tarval *get_ia32_Immop_tarval(const ir_node *node);
142 * Sets the attributes of an immediate operation to the specified tarval
144 void set_ia32_Immop_tarval(ir_node *node, tarval *tv);
147 * Gets the string representation of the internal const (tv or symconst)
149 const char *get_ia32_cnst(const ir_node *node);
152 * Sets the string representation of the internal const.
154 void set_ia32_cnst(ir_node *node, const char *cnst);
157 * Gets the ident representation of the internal const (tv or symconst)
159 ident *get_ia32_id_cnst(const ir_node *node);
162 * Sets the ident representation of the internal const.
164 void set_ia32_id_cnst(ir_node *node, ident *cnst);
167 * Sets the uses_frame flag.
169 void set_ia32_use_frame(ir_node *node);
172 * Clears the uses_frame flag.
174 void clear_ia32_use_frame(ir_node *node);
177 * Gets the uses_frame flag.
179 int is_ia32_use_frame(const ir_node *node);
182 * Sets node to commutative.
184 void set_ia32_commutative(ir_node *node);
187 * Sets node to non-commutative.
189 void clear_ia32_commutative(ir_node *node);
192 * Checks if node is commutative.
194 int is_ia32_commutative(const ir_node *node);
199 void set_ia32_emit_cl(ir_node *node);
202 * Clears node emit_cl.
204 void clear_ia32_emit_cl(ir_node *node);
207 * Checks if node is commutative.
209 int is_ia32_emit_cl(const ir_node *node);
214 void set_ia32_got_lea(ir_node *node);
217 * Clears node got_lea.
219 void clear_ia32_got_lea(ir_node *node);
222 * Checks if node got lea.
224 int is_ia32_got_lea(const ir_node *node);
227 * Sets node got_reload.
229 void set_ia32_got_reload(ir_node *node);
232 * Clears node got_reload.
234 void clear_ia32_got_reload(ir_node *node);
237 * Checks if node got reload.
239 int is_ia32_got_reload(const ir_node *node);
242 * Gets the mode of the stored/loaded value (only set for Store/Load)
244 ir_mode *get_ia32_ls_mode(const ir_node *node);
247 * Sets the mode of the stored/loaded value (only set for Store/Load)
249 void set_ia32_ls_mode(ir_node *node, ir_mode *mode);
252 * Gets the mode of the result.
254 ir_mode *get_ia32_res_mode(const ir_node *node);
257 * Sets the mode of the result.
259 void set_ia32_res_mode(ir_node *node, ir_mode *mode);
262 * Gets the frame entity assigned to this node;
264 ir_entity *get_ia32_frame_ent(const ir_node *node);
267 * Sets the frame entity for this node;
269 void set_ia32_frame_ent(ir_node *node, ir_entity *ent);
272 * Returns the argument register requirements of an ia32 node.
274 const ia32_register_req_t **get_ia32_in_req_all(const ir_node *node);
277 * Sets the argument register requirements of an ia32 node.
279 void set_ia32_in_req_all(ir_node *node, const ia32_register_req_t **reqs);
282 * Returns the result register requirements of an ia32 node.
284 const ia32_register_req_t **get_ia32_out_req_all(const ir_node *node);
287 * Sets the result register requirements of an ia32 node.
289 void set_ia32_out_req_all(ir_node *node, const ia32_register_req_t **reqs);
292 * Returns the argument register requirements of an ia32 node.
294 const ia32_register_req_t *get_ia32_in_req(const ir_node *node, int pos);
297 * Returns the result register requirements of an ia32 node.
299 const ia32_register_req_t *get_ia32_out_req(const ir_node *node, int pos);
302 * Sets the OUT register requirements at position pos.
304 void set_ia32_req_out(ir_node *node, const ia32_register_req_t *req, int pos);
307 * Sets the IN register requirements at position pos.
309 void set_ia32_req_in(ir_node *node, const ia32_register_req_t *req, int pos);
312 * Returns the register flag of an ia32 node.
314 arch_irn_flags_t get_ia32_flags(const ir_node *node);
317 * Sets the register flag of an ia32 node.
319 void set_ia32_flags(ir_node *node, arch_irn_flags_t flags);
322 * Returns the result register slots of an ia32 node.
324 const arch_register_t **get_ia32_slots(const ir_node *node);
327 * Returns the name of the OUT register at position pos.
329 const char *get_ia32_out_reg_name(const ir_node *node, int pos);
332 * Returns the index of the OUT register at position pos within its register class.
334 int get_ia32_out_regnr(const ir_node *node, int pos);
337 * Returns the OUT register at position pos.
339 const arch_register_t *get_ia32_out_reg(const ir_node *node, int pos);
342 * Sets the number of results.
344 void set_ia32_n_res(ir_node *node, int n_res);
347 * Returns the number of results.
349 int get_ia32_n_res(const ir_node *node);
352 * Returns the flavour of an ia32 node,
354 ia32_op_flavour_t get_ia32_flavour(const ir_node *node);
357 * Sets the flavour of an ia32 node to flavour_Div/Mod/DivMod/Mul/Mulh.
359 void set_ia32_flavour(ir_node *node, ia32_op_flavour_t op_flav);
362 * Returns the projnum code.
364 long get_ia32_pncode(const ir_node *node);
367 * Sets the projnum code
369 void set_ia32_pncode(ir_node *node, long code);
372 * Gets the instruction latency.
374 unsigned get_ia32_latency(const ir_node *node);
377 * Sets the instruction latency.
379 void set_ia32_latency(ir_node *node, unsigned latency);
383 * Sets the flags for the n'th out.
385 void set_ia32_out_flags(ir_node *node, arch_irn_flags_t flags, int pos);
388 * Gets the flags for the n'th out.
390 arch_irn_flags_t get_ia32_out_flags(const ir_node *node, int pos);
393 * Get the list of available execution units.
395 const be_execution_unit_t ***get_ia32_exec_units(const ir_node *node);
400 * Returns the name of the original ir node.
402 const char *get_ia32_orig_node(const ir_node *node);
405 * Sets the name of the original ir node.
407 void set_ia32_orig_node(ir_node *node, const char *name);
411 /******************************************************************************************************
413 * (_) | | | | | | / _| | | (_)
414 * ___ _ __ ___ ___ _ __ _| | __ _| |_| |_ _ __ | |_ _ _ _ __ ___| |_ _ ___ _ __ ___
415 * / __| '_ \ / _ \/ __| |/ _` | | / _` | __| __| '__| | _| | | | '_ \ / __| __| |/ _ \| '_ \ / __|
416 * \__ \ |_) | __/ (__| | (_| | | | (_| | |_| |_| | | | | |_| | | | | (__| |_| | (_) | | | | \__ \
417 * |___/ .__/ \___|\___|_|\__,_|_| \__,_|\__|\__|_| |_| \__,_|_| |_|\___|\__|_|\___/|_| |_| |___/
420 ******************************************************************************************************/
423 * Gets the type of an ia32_Const.
425 unsigned get_ia32_Const_type(const ir_node *node);
428 * Sets the type of an ia32_Const.
430 void set_ia32_Const_type(ir_node *node, int type);
433 * Copy the attributes from an ia32_Const to an Immop (Add_i, Sub_i, ...) node
435 void set_ia32_Immop_attr(ir_node *node, ir_node *cnst);
438 * Copy the attributes from Immop to an Immop
440 void copy_ia32_Immop_attr(ir_node *node, ir_node *src);
443 * Returns the proj of the result value for nodes that have the usual
444 * (res, Mem) result tuple
446 ir_node *get_ia32_result_proj(const ir_node *node);
449 * Returns the source mode for ia32 conv nodes
451 ir_mode *get_ia32_Conv_src_mode(const ir_node *node);
454 * Returns the target mode for ia32 conv nodes
456 ir_mode *get_ia32_Conv_tgt_mode(const ir_node *node);
459 * Copy the attributes from a Const to an ia32_Const
461 void set_ia32_Const_attr(ir_node *ia32_cnst, ir_node *cnst);
464 * Sets the AddrMode attribute
465 * @param direction The "direction" of AM ('S' source or 'D' destination)
467 void set_ia32_AddrMode(ir_node *node, char direction);
470 * Returns whether or not the node is an immediate operation with Const.
472 int is_ia32_ImmConst(const ir_node *node);
475 * Returns whether or not the node is an immediate operation with SymConst.
477 int is_ia32_ImmSymConst(const ir_node *node);
480 * Returns whether or not the node is an AddrModeS node.
482 int is_ia32_AddrModeS(const ir_node *node);
485 * Returns whether or not the node is an AddrModeD node.
487 int is_ia32_AddrModeD(const ir_node *node);
490 * Checks if node is a Load or fLoad.
492 int is_ia32_Ld(const ir_node *node);
495 * Checks if node is a Store or fStore.
497 int is_ia32_St(const ir_node *node);
500 * Checks if node is a Const or fConst.
502 int is_ia32_Cnst(const ir_node *node);
505 * Initializes the nodes attributes.
507 void init_ia32_attributes(ir_node *node, arch_irn_flags_t flags, const ia32_register_req_t **in_reqs, \
508 const ia32_register_req_t **out_reqs, const be_execution_unit_t ***execution_units, int n_res, unsigned latency);
511 * Registers the ia32_copy_attr function for all ia32 opcodes.
513 void ia32_register_copy_attr_func(void);
515 /* Include the generated headers */
516 #include "gen_ia32_new_nodes.h"
518 #endif /* _IA32_NEW_NODES_H_ */