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 the attributes of an ia32 node.
27 ia32_attr_t *get_ia32_attr(const ir_node *node);
30 * Gets the type of an ia32 node.
32 ia32_op_type_t get_ia32_op_type(const ir_node *node);
35 * Sets the type of an ia32 node.
37 void set_ia32_op_type(ir_node *node, ia32_op_type_t tp);
40 * Gets the immediate op type of an ia32 node.
42 ia32_immop_type_t get_ia32_immop_type(const ir_node *node);
45 * Sets the immediate op type of an ia32 node.
47 void set_ia32_immop_type(ir_node *node, ia32_immop_type_t tp);
50 * Gets the supported addrmode of an ia32 node
52 ia32_am_type_t get_ia32_am_support(const ir_node *node);
55 * Sets the supported addrmode of an ia32 node
57 void set_ia32_am_support(ir_node *node, ia32_am_type_t am_tp);
60 * Gets the addrmode flavour of an ia32 node
62 ia32_am_flavour_t get_ia32_am_flavour(const ir_node *node);
65 * Sets the addrmode flavour of an ia32 node
67 void set_ia32_am_flavour(ir_node *node, ia32_am_flavour_t am_flavour);
70 * Gets the joined addrmode offset.
72 char *get_ia32_am_offs(const ir_node *node);
75 * Gets the addressmode offset as long.
77 long get_ia32_am_offs_long(const ir_node *node);
80 * Adds an offset for addrmode.
82 void add_ia32_am_offs(ir_node *node, const char *offset);
85 * Subs an offset for addrmode.
87 void sub_ia32_am_offs(ir_node *node, const char *offset);
90 * Returns the symconst ident associated to addrmode.
92 ident *get_ia32_am_sc(const ir_node *node);
95 * Sets the symconst ident associated to addrmode.
97 void set_ia32_am_sc(ir_node *node, ident *sc);
100 * Sets the sign bit for address mode symconst.
102 void set_ia32_am_sc_sign(ir_node *node);
105 * Clears the sign bit for address mode symconst.
107 void clear_ia32_am_sc_sign(ir_node *node);
110 * Returns the sign bit for address mode symconst.
112 int is_ia32_am_sc_sign(const ir_node *node);
115 * Gets the addr mode const.
117 int get_ia32_am_scale(const ir_node *node);
120 * Sets the const for addr mode.
122 void set_ia32_am_scale(ir_node *node, int scale);
125 * Return the tarval of an immediate operation or NULL in case of SymConst
127 tarval *get_ia32_Immop_tarval(const ir_node *node);
130 * Sets the attributes of an immediate operation to the specified tarval
132 void set_ia32_Immop_tarval(ir_node *node, tarval *tv);
135 * Gets the string representation of the internal const (tv or symconst)
137 const char *get_ia32_cnst(const ir_node *node);
140 * Sets the string representation of the internal const.
142 void set_ia32_cnst(ir_node *node, const char *cnst);
145 * Gets the ident representation of the internal const (tv or symconst)
147 ident *get_ia32_id_cnst(const ir_node *node);
150 * Sets the ident representation of the internal const.
152 void set_ia32_id_cnst(ir_node *node, ident *cnst);
155 * Sets the uses_frame flag.
157 void set_ia32_use_frame(ir_node *node);
160 * Clears the uses_frame flag.
162 void clear_ia32_use_frame(ir_node *node);
165 * Gets the uses_frame flag.
167 int is_ia32_use_frame(const ir_node *node);
170 * Sets node to commutative.
172 void set_ia32_commutative(ir_node *node);
175 * Sets node to non-commutative.
177 void clear_ia32_commutative(ir_node *node);
180 * Checks if node is commutative.
182 int is_ia32_commutative(const ir_node *node);
187 void set_ia32_emit_cl(ir_node *node);
190 * Clears node emit_cl.
192 void clear_ia32_emit_cl(ir_node *node);
195 * Checks if node is commutative.
197 int is_ia32_emit_cl(const ir_node *node);
202 void set_ia32_got_lea(ir_node *node);
205 * Clears node got_lea.
207 void clear_ia32_got_lea(ir_node *node);
210 * Checks if node got lea.
212 int is_ia32_got_lea(const ir_node *node);
215 * Sets node got_reload.
217 void set_ia32_got_reload(ir_node *node);
220 * Clears node got_reload.
222 void clear_ia32_got_reload(ir_node *node);
225 * Checks if node got reload.
227 int is_ia32_got_reload(const ir_node *node);
230 * Gets the mode of the stored/loaded value (only set for Store/Load)
232 ir_mode *get_ia32_ls_mode(const ir_node *node);
235 * Sets the mode of the stored/loaded value (only set for Store/Load)
237 void set_ia32_ls_mode(ir_node *node, ir_mode *mode);
240 * Gets the mode of the result.
242 ir_mode *get_ia32_res_mode(const ir_node *node);
245 * Sets the mode of the result.
247 void set_ia32_res_mode(ir_node *node, ir_mode *mode);
250 * Gets the source mode of conversion.
252 ir_mode *get_ia32_src_mode(const ir_node *node);
255 * Sets the source mode of conversion.
257 void set_ia32_src_mode(ir_node *node, ir_mode *mode);
260 * Gets the target mode of conversion.
262 ir_mode *get_ia32_tgt_mode(const ir_node *node);
265 * Sets the target mode of conversion.
267 void set_ia32_tgt_mode(ir_node *node, ir_mode *mode);
270 * Gets the frame entity assigned to this node;
272 entity *get_ia32_frame_ent(const ir_node *node);
275 * Sets the frame entity for this node;
277 void set_ia32_frame_ent(ir_node *node, entity *ent);
280 * Returns the argument register requirements of an ia32 node.
282 const ia32_register_req_t **get_ia32_in_req_all(const ir_node *node);
285 * Sets the argument register requirements of an ia32 node.
287 void set_ia32_in_req_all(ir_node *node, const ia32_register_req_t **reqs);
290 * Returns the result register requirements of an ia32 node.
292 const ia32_register_req_t **get_ia32_out_req_all(const ir_node *node);
295 * Sets the result register requirements of an ia32 node.
297 void set_ia32_out_req_all(ir_node *node, const ia32_register_req_t **reqs);
300 * Returns the argument register requirements of an ia32 node.
302 const ia32_register_req_t *get_ia32_in_req(const ir_node *node, int pos);
305 * Returns the result register requirements of an ia32 node.
307 const ia32_register_req_t *get_ia32_out_req(const ir_node *node, int pos);
310 * Sets the OUT register requirements at position pos.
312 void set_ia32_req_out(ir_node *node, const ia32_register_req_t *req, int pos);
315 * Sets the IN register requirements at position pos.
317 void set_ia32_req_in(ir_node *node, const ia32_register_req_t *req, int pos);
320 * Returns the register flag of an ia32 node.
322 arch_irn_flags_t get_ia32_flags(const ir_node *node);
325 * Sets the register flag of an ia32 node.
327 void set_ia32_flags(ir_node *node, arch_irn_flags_t flags);
330 * Returns the result register slots of an ia32 node.
332 const arch_register_t **get_ia32_slots(const ir_node *node);
335 * Returns the name of the OUT register at position pos.
337 const char *get_ia32_out_reg_name(const ir_node *node, int pos);
340 * Returns the index of the OUT register at position pos within its register class.
342 int get_ia32_out_regnr(const ir_node *node, int pos);
345 * Returns the OUT register at position pos.
347 const arch_register_t *get_ia32_out_reg(const ir_node *node, int pos);
350 * Sets the number of results.
352 void set_ia32_n_res(ir_node *node, int n_res);
355 * Returns the number of results.
357 int get_ia32_n_res(const ir_node *node);
360 * Returns the flavour of an ia32 node,
362 ia32_op_flavour_t get_ia32_flavour(const ir_node *node);
365 * Sets the flavour of an ia32 node to flavour_Div/Mod/DivMod/Mul/Mulh.
367 void set_ia32_flavour(ir_node *node, ia32_op_flavour_t op_flav);
370 * Returns the projnum code.
372 long get_ia32_pncode(const ir_node *node);
375 * Sets the projnum code
377 void set_ia32_pncode(ir_node *node, long code);
380 * Gets the instruction latency.
382 unsigned get_ia32_latency(const ir_node *node);
385 * Sets the instruction latency.
387 void set_ia32_latency(ir_node *node, unsigned latency);
392 * Returns the name of the original ir node.
394 const char *get_ia32_orig_node(const ir_node *node);
397 * Sets the name of the original ir node.
399 void set_ia32_orig_node(ir_node *node, const char *name);
403 /******************************************************************************************************
405 * (_) | | | | | | / _| | | (_)
406 * ___ _ __ ___ ___ _ __ _| | __ _| |_| |_ _ __ | |_ _ _ _ __ ___| |_ _ ___ _ __ ___
407 * / __| '_ \ / _ \/ __| |/ _` | | / _` | __| __| '__| | _| | | | '_ \ / __| __| |/ _ \| '_ \ / __|
408 * \__ \ |_) | __/ (__| | (_| | | | (_| | |_| |_| | | | | |_| | | | | (__| |_| | (_) | | | | \__ \
409 * |___/ .__/ \___|\___|_|\__,_|_| \__,_|\__|\__|_| |_| \__,_|_| |_|\___|\__|_|\___/|_| |_| |___/
412 ******************************************************************************************************/
415 * Gets the type of an ia32_Const.
417 unsigned get_ia32_Const_type(const ir_node *node);
420 * Sets the type of an ia32_Const.
422 void set_ia32_Const_type(ir_node *node, int type);
425 * Copy the attributes from an ia32_Const to an Immop (Add_i, Sub_i, ...) node
427 void set_ia32_Immop_attr(ir_node *node, ir_node *cnst);
430 * Copy the attributes from Immop to an Immop
432 void copy_ia32_Immop_attr(ir_node *node, ir_node *src);
435 * Copy the attributes from a Const to an ia32_Const
437 void set_ia32_Const_attr(ir_node *ia32_cnst, ir_node *cnst);
440 * Sets the AddrMode attribute
441 * @param direction The "direction" of AM ('S' source or 'D' destination)
443 void set_ia32_AddrMode(ir_node *node, char direction);
446 * Returns whether or not the node is an immediate operation with Const.
448 int is_ia32_ImmConst(const ir_node *node);
451 * Returns whether or not the node is an immediate operation with SymConst.
453 int is_ia32_ImmSymConst(const ir_node *node);
456 * Returns whether or not the node is an AddrModeS node.
458 int is_ia32_AddrModeS(const ir_node *node);
461 * Returns whether or not the node is an AddrModeD node.
463 int is_ia32_AddrModeD(const ir_node *node);
466 * Checks if node is a Load or fLoad.
468 int is_ia32_Ld(const ir_node *node);
471 * Checks if node is a Store or fStore.
473 int is_ia32_St(const ir_node *node);
476 * Checks if node is a Const or fConst.
478 int is_ia32_Cnst(const ir_node *node);
481 * Initializes the nodes attributes.
483 void init_ia32_attributes(ir_node *node, arch_irn_flags_t flags, const ia32_register_req_t **in_reqs, \
484 const ia32_register_req_t **out_reqs, int n_res, unsigned latency);
486 /* Include the generated headers */
487 #include "gen_ia32_new_nodes.h"
489 #endif /* _IA32_NEW_NODES_H_ */