1 #ifndef _IA32_NEW_NODES_H_
2 #define _IA32_NEW_NODES_H_
5 * Function prototypes for the assembler ir node constructors.
6 * @author Christian Wuerdig
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 * Adds an offset for addrmode.
77 void add_ia32_am_offs(ir_node *node, const char *offset);
80 * Subs an offset for addrmode.
82 void sub_ia32_am_offs(ir_node *node, const char *offset);
85 * Returns the symconst ident associated to addrmode.
87 ident *get_ia32_am_sc(const ir_node *node);
90 * Sets the symconst ident associated to addrmode.
92 void set_ia32_am_sc(ir_node *node, ident *sc);
95 * Sets the sign bit for address mode symconst.
97 void set_ia32_am_sc_sign(ir_node *node);
100 * Clears the sign bit for address mode symconst.
102 void clear_ia32_am_sc_sign(ir_node *node);
105 * Returns the sign bit for address mode symconst.
107 int is_ia32_am_sc_sign(const ir_node *node);
110 * Gets the addr mode const.
112 int get_ia32_am_scale(const ir_node *node);
115 * Sets the const for addr mode.
117 void set_ia32_am_scale(ir_node *node, int scale);
120 * Return the tarval of an immediate operation or NULL in case of SymConst
122 tarval *get_ia32_Immop_tarval(const ir_node *node);
125 * Sets the attributes of an immediate operation to the specified tarval
127 void set_ia32_Immop_tarval(ir_node *node, tarval *tv);
130 * Return the sc attribute.
132 ident *get_ia32_sc(const ir_node *node);
135 * Sets the sc attribute.
137 void set_ia32_sc(ir_node *node, ident *sc);
140 * Gets the string representation of the internal const (tv or symconst)
142 const char *get_ia32_cnst(const ir_node *node);
145 * Sets the string representation of the internal const.
147 void set_ia32_cnst(ir_node *node, char *cnst);
150 * Gets the ident representation of the internal const (tv or symconst)
152 ident *get_ia32_id_cnst(const ir_node *node);
155 * Sets the ident representation of the internal const.
157 void set_ia32_id_cnst(ir_node *node, ident *cnst);
160 * Sets the uses_frame flag.
162 void set_ia32_use_frame(ir_node *node);
165 * Clears the uses_frame flag.
167 void clear_ia32_use_frame(ir_node *node);
170 * Gets the uses_frame flag.
172 int is_ia32_use_frame(const ir_node *node);
175 * Sets node to commutative.
177 void set_ia32_commutative(ir_node *node);
180 * Sets node to non-commutative.
182 void clear_ia32_commutative(ir_node *node);
185 * Checks if node is commutative.
187 int is_ia32_commutative(const ir_node *node);
192 void set_ia32_emit_cl(ir_node *node);
195 * Clears node emit_cl.
197 void clear_ia32_emit_cl(ir_node *node);
200 * Checks if node is commutative.
202 int is_ia32_emit_cl(const ir_node *node);
205 * Gets the mode of the stored/loaded value (only set for Store/Load)
207 ir_mode *get_ia32_ls_mode(const ir_node *node);
210 * Sets the mode of the stored/loaded value (only set for Store/Load)
212 void set_ia32_ls_mode(ir_node *node, ir_mode *mode);
215 * Gets the mode of the result.
217 ir_mode *get_ia32_res_mode(const ir_node *node);
220 * Sets the mode of the result.
222 void set_ia32_res_mode(ir_node *node, ir_mode *mode);
225 * Gets the frame entity assigned to this node;
227 entity *get_ia32_frame_ent(const ir_node *node);
230 * Sets the frame entity for this node;
232 void set_ia32_frame_ent(ir_node *node, entity *ent);
235 * Returns the argument register requirements of an ia32 node.
237 const ia32_register_req_t **get_ia32_in_req_all(const ir_node *node);
240 * Sets the argument register requirements of an ia32 node.
242 void set_ia32_in_req_all(ir_node *node, const ia32_register_req_t **reqs);
245 * Returns the result register requirements of an ia32 node.
247 const ia32_register_req_t **get_ia32_out_req_all(const ir_node *node);
250 * Sets the result register requirements of an ia32 node.
252 void set_ia32_out_req_all(ir_node *node, const ia32_register_req_t **reqs);
255 * Returns the argument register requirements of an ia32 node.
257 const ia32_register_req_t *get_ia32_in_req(const ir_node *node, int pos);
260 * Returns the result register requirements of an ia32 node.
262 const ia32_register_req_t *get_ia32_out_req(const ir_node *node, int pos);
265 * Sets the OUT register requirements at position pos.
267 void set_ia32_req_out(ir_node *node, const ia32_register_req_t *req, int pos);
270 * Sets the IN register requirements at position pos.
272 void set_ia32_req_in(ir_node *node, const ia32_register_req_t *req, int pos);
275 * Returns the register flag of an ia32 node.
277 arch_irn_flags_t get_ia32_flags(const ir_node *node);
280 * Sets the register flag of an ia32 node.
282 void set_ia32_flags(ir_node *node, arch_irn_flags_t flags);
285 * Returns the result register slots of an ia32 node.
287 const arch_register_t **get_ia32_slots(const ir_node *node);
290 * Returns the name of the OUT register at position pos.
292 const char *get_ia32_out_reg_name(const ir_node *node, int pos);
295 * Returns the index of the OUT register at position pos within its register class.
297 int get_ia32_out_regnr(const ir_node *node, int pos);
300 * Returns the OUT register at position pos.
302 const arch_register_t *get_ia32_out_reg(const ir_node *node, int pos);
305 * Sets the number of results.
307 void set_ia32_n_res(ir_node *node, int n_res);
310 * Returns the number of results.
312 int get_ia32_n_res(const ir_node *node);
315 * Returns the flavour of an ia32 node,
317 ia32_op_flavour_t get_ia32_flavour(const ir_node *node);
320 * Sets the flavour of an ia32 node to flavour_Div/Mod/DivMod/Mul/Mulh.
322 void set_ia32_flavour(ir_node *node, ia32_op_flavour_t op_flav);
325 * Returns the projnum code.
327 long get_ia32_pncode(const ir_node *node);
330 * Sets the projnum code
332 void set_ia32_pncode(ir_node *node, long code);
337 * Returns the name of the original ir node.
339 const char *get_ia32_orig_node(const ir_node *node);
342 * Sets the name of the original ir node.
344 void set_ia32_orig_node(ir_node *node, const char *name);
348 /******************************************************************************************************
350 * (_) | | | | | | / _| | | (_)
351 * ___ _ __ ___ ___ _ __ _| | __ _| |_| |_ _ __ | |_ _ _ _ __ ___| |_ _ ___ _ __ ___
352 * / __| '_ \ / _ \/ __| |/ _` | | / _` | __| __| '__| | _| | | | '_ \ / __| __| |/ _ \| '_ \ / __|
353 * \__ \ |_) | __/ (__| | (_| | | | (_| | |_| |_| | | | | |_| | | | | (__| |_| | (_) | | | | \__ \
354 * |___/ .__/ \___|\___|_|\__,_|_| \__,_|\__|\__|_| |_| \__,_|_| |_|\___|\__|_|\___/|_| |_| |___/
357 ******************************************************************************************************/
360 * Gets the type of an ia32_Const.
362 unsigned get_ia32_Const_type(const ir_node *node);
365 * Sets the type of an ia32_Const.
367 void set_ia32_Const_type(ir_node *node, int type);
370 * Copy the attributes from an ia32_Const to an Immop (Add_i, Sub_i, ...) node
372 void set_ia32_Immop_attr(ir_node *node, ir_node *cnst);
375 * Copy the attributes from Immop to an Immop
377 void copy_ia32_Immop_attr(ir_node *node, ir_node *src);
380 * Copy the attributes from a Const to an ia32_Const
382 void set_ia32_Const_attr(ir_node *ia32_cnst, ir_node *cnst);
385 * Sets the AddrMode attribute
386 * @param direction The "direction" of AM ('S' source or 'D' destination)
388 void set_ia32_AddrMode(ir_node *node, char direction);
391 * Returns whether or not the node is an immediate operation with Const.
393 int is_ia32_ImmConst(const ir_node *node);
396 * Returns whether or not the node is an immediate operation with SymConst.
398 int is_ia32_ImmSymConst(const ir_node *node);
401 * Returns whether or not the node is an AddrModeS node.
403 int is_ia32_AddrModeS(const ir_node *node);
406 * Returns whether or not the node is an AddrModeD node.
408 int is_ia32_AddrModeD(const ir_node *node);
411 * Checks if node is a Load or fLoad.
413 int is_ia32_Ld(const ir_node *node);
416 * Checks if node is a Store or fStore.
418 int is_ia32_St(const ir_node *node);
421 * Checks if node is a Const or fConst.
423 int is_ia32_Cnst(const ir_node *node);
426 * Allocates num register slots for node.
428 void alloc_ia32_reg_slots(ir_node *node, int num);
431 * Initializes the nodes attributes.
433 void init_ia32_attributes(ir_node *node, arch_irn_flags_t flags, const ia32_register_req_t **in_reqs, \
434 const ia32_register_req_t **out_reqs, int n_res);
437 * Registers the ia32_copy_attr function for all ia32 opcodes.
439 void ia32_register_copy_attr_func(void);
441 /* Include the generated headers */
442 #include "gen_ia32_new_nodes.h"
444 #endif /* _IA32_NEW_NODES_H_ */