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 * Gets the addr mode const.
87 int get_ia32_am_scale(const ir_node *node);
90 * Sets the const for addr mode.
92 void set_ia32_am_scale(ir_node *node, int scale);
95 * Return the tarval of an immediate operation or NULL in case of SymConst
97 tarval *get_ia32_Immop_tarval(const ir_node *node);
100 * Sets the attributes of an immediate operation to the specified tarval
102 void set_ia32_Immop_tarval(ir_node *node, tarval *tv);
105 * Return the sc attribute.
107 ident *get_ia32_sc(const ir_node *node);
110 * Sets the sc attribute.
112 void set_ia32_sc(ir_node *node, ident *sc);
115 * Gets the string representation of the internal const (tv or symconst)
117 const char *get_ia32_cnst(const ir_node *node);
120 * Sets the string representation of the internal const.
122 void set_ia32_cnst(ir_node *node, char *cnst);
125 * Gets the ident representation of the internal const (tv or symconst)
127 ident *get_ia32_id_cnst(const ir_node *node);
130 * Sets the ident representation of the internal const.
132 void set_ia32_id_cnst(ir_node *node, ident *cnst);
135 * Sets the uses_frame flag.
137 void set_ia32_use_frame(ir_node *node);
140 * Clears the uses_frame flag.
142 void clear_ia32_use_frame(ir_node *node);
145 * Gets the uses_frame flag.
147 int is_ia32_use_frame(const ir_node *node);
150 * Sets node to commutative.
152 void set_ia32_commutative(ir_node *node);
155 * Sets node to non-commutative.
157 void clear_ia32_commutative(ir_node *node);
160 * Checks if node is commutative.
162 int is_ia32_commutative(const ir_node *node);
167 void set_ia32_emit_cl(ir_node *node);
170 * Clears node emit_cl.
172 void clear_ia32_emit_cl(ir_node *node);
175 * Checks if node is commutative.
177 int is_ia32_emit_cl(const ir_node *node);
180 * Gets the mode of the stored/loaded value (only set for Store/Load)
182 ir_mode *get_ia32_ls_mode(const ir_node *node);
185 * Sets the mode of the stored/loaded value (only set for Store/Load)
187 void set_ia32_ls_mode(ir_node *node, ir_mode *mode);
190 * Gets the mode of the result.
192 ir_mode *get_ia32_res_mode(const ir_node *node);
195 * Sets the mode of the result.
197 void set_ia32_res_mode(ir_node *node, ir_mode *mode);
200 * Gets the frame entity assigned to this node;
202 entity *get_ia32_frame_ent(const ir_node *node);
205 * Sets the frame entity for this node;
207 void set_ia32_frame_ent(ir_node *node, entity *ent);
210 * Returns the argument register requirements of an ia32 node.
212 const ia32_register_req_t **get_ia32_in_req_all(const ir_node *node);
215 * Sets the argument register requirements of an ia32 node.
217 void set_ia32_in_req_all(ir_node *node, const ia32_register_req_t **reqs);
220 * Returns the result register requirements of an ia32 node.
222 const ia32_register_req_t **get_ia32_out_req_all(const ir_node *node);
225 * Sets the result register requirements of an ia32 node.
227 void set_ia32_out_req_all(ir_node *node, const ia32_register_req_t **reqs);
230 * Returns the argument register requirements of an ia32 node.
232 const ia32_register_req_t *get_ia32_in_req(const ir_node *node, int pos);
235 * Returns the result register requirements of an ia32 node.
237 const ia32_register_req_t *get_ia32_out_req(const ir_node *node, int pos);
240 * Sets the OUT register requirements at position pos.
242 void set_ia32_req_out(ir_node *node, const ia32_register_req_t *req, int pos);
245 * Sets the IN register requirements at position pos.
247 void set_ia32_req_in(ir_node *node, const ia32_register_req_t *req, int pos);
250 * Returns the register flag of an ia32 node.
252 arch_irn_flags_t get_ia32_flags(const ir_node *node);
255 * Sets the register flag of an ia32 node.
257 void set_ia32_flags(ir_node *node, arch_irn_flags_t flags);
260 * Returns the result register slots of an ia32 node.
262 const arch_register_t **get_ia32_slots(const ir_node *node);
265 * Returns the name of the OUT register at position pos.
267 const char *get_ia32_out_reg_name(const ir_node *node, int pos);
270 * Returns the index of the OUT register at position pos within its register class.
272 int get_ia32_out_regnr(const ir_node *node, int pos);
275 * Returns the OUT register at position pos.
277 const arch_register_t *get_ia32_out_reg(const ir_node *node, int pos);
280 * Sets the number of results.
282 void set_ia32_n_res(ir_node *node, int n_res);
285 * Returns the number of results.
287 int get_ia32_n_res(const ir_node *node);
290 * Returns the flavour of an ia32 node,
292 ia32_op_flavour_t get_ia32_flavour(const ir_node *node);
295 * Sets the flavour of an ia32 node to flavour_Div/Mod/DivMod/Mul/Mulh.
297 void set_ia32_flavour(ir_node *node, ia32_op_flavour_t op_flav);
300 * Returns the projnum code.
302 long get_ia32_pncode(const ir_node *node);
305 * Sets the projnum code
307 void set_ia32_pncode(ir_node *node, long code);
312 * Returns the name of the original ir node.
314 const char *get_ia32_orig_node(const ir_node *node);
317 * Sets the name of the original ir node.
319 void set_ia32_orig_node(ir_node *node, const char *name);
323 /******************************************************************************************************
325 * (_) | | | | | | / _| | | (_)
326 * ___ _ __ ___ ___ _ __ _| | __ _| |_| |_ _ __ | |_ _ _ _ __ ___| |_ _ ___ _ __ ___
327 * / __| '_ \ / _ \/ __| |/ _` | | / _` | __| __| '__| | _| | | | '_ \ / __| __| |/ _ \| '_ \ / __|
328 * \__ \ |_) | __/ (__| | (_| | | | (_| | |_| |_| | | | | |_| | | | | (__| |_| | (_) | | | | \__ \
329 * |___/ .__/ \___|\___|_|\__,_|_| \__,_|\__|\__|_| |_| \__,_|_| |_|\___|\__|_|\___/|_| |_| |___/
332 ******************************************************************************************************/
335 * Gets the type of an ia32_Const.
337 unsigned get_ia32_Const_type(const ir_node *node);
340 * Sets the type of an ia32_Const.
342 void set_ia32_Const_type(ir_node *node, int type);
345 * Copy the attributes from an ia32_Const to an Immop (Add_i, Sub_i, ...) node
347 void set_ia32_Immop_attr(ir_node *node, ir_node *cnst);
350 * Copy the attributes from Immop to an Immop
352 void copy_ia32_Immop_attr(ir_node *node, ir_node *src);
355 * Copy the attributes from a Const to an ia32_Const
357 void set_ia32_Const_attr(ir_node *ia32_cnst, ir_node *cnst);
360 * Sets the AddrMode attribute
361 * @param direction The "direction" of AM ('S' source or 'D' destination)
363 void set_ia32_AddrMode(ir_node *node, char direction);
366 * Returns whether or not the node is an immediate operation with Const.
368 int is_ia32_ImmConst(const ir_node *node);
371 * Returns whether or not the node is an immediate operation with SymConst.
373 int is_ia32_ImmSymConst(const ir_node *node);
376 * Returns whether or not the node is an AddrModeS node.
378 int is_ia32_AddrModeS(const ir_node *node);
381 * Returns whether or not the node is an AddrModeD node.
383 int is_ia32_AddrModeD(const ir_node *node);
386 * Checks if node is a Load or fLoad.
388 int is_ia32_Ld(const ir_node *node);
391 * Checks if node is a Store or fStore.
393 int is_ia32_St(const ir_node *node);
396 * Checks if node is a Const or fConst.
398 int is_ia32_Cnst(const ir_node *node);
401 * Allocates num register slots for node.
403 void alloc_ia32_reg_slots(ir_node *node, int num);
406 * Initializes the nodes attributes.
408 void init_ia32_attributes(ir_node *node, arch_irn_flags_t flags, const ia32_register_req_t **in_reqs, \
409 const ia32_register_req_t **out_reqs, int n_res);
412 * Registers the ia32_copy_attr function for all ia32 opcodes.
414 void ia32_register_copy_attr_func(void);
416 /* Include the generated headers */
417 #include "gen_ia32_new_nodes.h"
419 #endif /* _IA32_NEW_NODES_H_ */