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 * Adds an offset for addrmode.
87 void add_ia32_am_offs(ir_node *node, const char *offset);
89 void add_ia32_am_offs_int(ir_node *node, int offset);
92 * Subs an offset for addrmode.
94 void sub_ia32_am_offs(ir_node *node, const char *offset);
97 * Returns the symconst ident associated to addrmode.
99 ident *get_ia32_am_sc(const ir_node *node);
102 * Sets the symconst ident associated to addrmode.
104 void set_ia32_am_sc(ir_node *node, ident *sc);
107 * Sets the sign bit for address mode symconst.
109 void set_ia32_am_sc_sign(ir_node *node);
112 * Clears the sign bit for address mode symconst.
114 void clear_ia32_am_sc_sign(ir_node *node);
117 * Returns the sign bit for address mode symconst.
119 int is_ia32_am_sc_sign(const ir_node *node);
122 * Gets the addr mode const.
124 int get_ia32_am_scale(const ir_node *node);
127 * Sets the const for addr mode.
129 void set_ia32_am_scale(ir_node *node, int scale);
132 * Return the tarval of an immediate operation or NULL in case of SymConst
134 tarval *get_ia32_Immop_tarval(const ir_node *node);
137 * Sets the attributes of an immediate operation to the specified tarval
139 void set_ia32_Immop_tarval(ir_node *node, tarval *tv);
142 * Gets the string representation of the internal const (tv or symconst)
144 const char *get_ia32_cnst(const ir_node *node);
147 * Sets the string representation of the internal const.
149 void set_ia32_cnst(ir_node *node, const char *cnst);
152 * Gets the ident representation of the internal const (tv or symconst)
154 ident *get_ia32_id_cnst(const ir_node *node);
157 * Sets the ident representation of the internal const.
159 void set_ia32_id_cnst(ir_node *node, ident *cnst);
162 * Sets the uses_frame flag.
164 void set_ia32_use_frame(ir_node *node);
167 * Clears the uses_frame flag.
169 void clear_ia32_use_frame(ir_node *node);
172 * Gets the uses_frame flag.
174 int is_ia32_use_frame(const ir_node *node);
177 * Sets node to commutative.
179 void set_ia32_commutative(ir_node *node);
182 * Sets node to non-commutative.
184 void clear_ia32_commutative(ir_node *node);
187 * Checks if node is commutative.
189 int is_ia32_commutative(const ir_node *node);
194 void set_ia32_emit_cl(ir_node *node);
197 * Clears node emit_cl.
199 void clear_ia32_emit_cl(ir_node *node);
202 * Checks if node is commutative.
204 int is_ia32_emit_cl(const ir_node *node);
209 void set_ia32_got_lea(ir_node *node);
212 * Clears node got_lea.
214 void clear_ia32_got_lea(ir_node *node);
217 * Checks if node got lea.
219 int is_ia32_got_lea(const ir_node *node);
222 * Sets node got_reload.
224 void set_ia32_got_reload(ir_node *node);
227 * Clears node got_reload.
229 void clear_ia32_got_reload(ir_node *node);
232 * Checks if node got reload.
234 int is_ia32_got_reload(const ir_node *node);
237 * Gets the mode of the stored/loaded value (only set for Store/Load)
239 ir_mode *get_ia32_ls_mode(const ir_node *node);
242 * Sets the mode of the stored/loaded value (only set for Store/Load)
244 void set_ia32_ls_mode(ir_node *node, ir_mode *mode);
247 * Gets the mode of the result.
249 ir_mode *get_ia32_res_mode(const ir_node *node);
252 * Sets the mode of the result.
254 void set_ia32_res_mode(ir_node *node, ir_mode *mode);
257 * Gets the source mode of conversion.
259 ir_mode *get_ia32_src_mode(const ir_node *node);
262 * Sets the source mode of conversion.
264 void set_ia32_src_mode(ir_node *node, ir_mode *mode);
267 * Gets the target mode of conversion.
269 ir_mode *get_ia32_tgt_mode(const ir_node *node);
272 * Sets the target mode of conversion.
274 void set_ia32_tgt_mode(ir_node *node, ir_mode *mode);
277 * Gets the frame entity assigned to this node;
279 entity *get_ia32_frame_ent(const ir_node *node);
282 * Sets the frame entity for this node;
284 void set_ia32_frame_ent(ir_node *node, entity *ent);
287 * Returns the argument register requirements of an ia32 node.
289 const ia32_register_req_t **get_ia32_in_req_all(const ir_node *node);
292 * Sets the argument register requirements of an ia32 node.
294 void set_ia32_in_req_all(ir_node *node, const ia32_register_req_t **reqs);
297 * Returns the result register requirements of an ia32 node.
299 const ia32_register_req_t **get_ia32_out_req_all(const ir_node *node);
302 * Sets the result register requirements of an ia32 node.
304 void set_ia32_out_req_all(ir_node *node, const ia32_register_req_t **reqs);
307 * Returns the argument register requirements of an ia32 node.
309 const ia32_register_req_t *get_ia32_in_req(const ir_node *node, int pos);
312 * Returns the result register requirements of an ia32 node.
314 const ia32_register_req_t *get_ia32_out_req(const ir_node *node, int pos);
317 * Sets the OUT register requirements at position pos.
319 void set_ia32_req_out(ir_node *node, const ia32_register_req_t *req, int pos);
322 * Sets the IN register requirements at position pos.
324 void set_ia32_req_in(ir_node *node, const ia32_register_req_t *req, int pos);
327 * Returns the register flag of an ia32 node.
329 arch_irn_flags_t get_ia32_flags(const ir_node *node);
332 * Sets the register flag of an ia32 node.
334 void set_ia32_flags(ir_node *node, arch_irn_flags_t flags);
337 * Returns the result register slots of an ia32 node.
339 const arch_register_t **get_ia32_slots(const ir_node *node);
342 * Returns the name of the OUT register at position pos.
344 const char *get_ia32_out_reg_name(const ir_node *node, int pos);
347 * Returns the index of the OUT register at position pos within its register class.
349 int get_ia32_out_regnr(const ir_node *node, int pos);
352 * Returns the OUT register at position pos.
354 const arch_register_t *get_ia32_out_reg(const ir_node *node, int pos);
357 * Sets the number of results.
359 void set_ia32_n_res(ir_node *node, int n_res);
362 * Returns the number of results.
364 int get_ia32_n_res(const ir_node *node);
367 * Returns the flavour of an ia32 node,
369 ia32_op_flavour_t get_ia32_flavour(const ir_node *node);
372 * Sets the flavour of an ia32 node to flavour_Div/Mod/DivMod/Mul/Mulh.
374 void set_ia32_flavour(ir_node *node, ia32_op_flavour_t op_flav);
377 * Returns the projnum code.
379 long get_ia32_pncode(const ir_node *node);
382 * Sets the projnum code
384 void set_ia32_pncode(ir_node *node, long code);
387 * Gets the instruction latency.
389 unsigned get_ia32_latency(const ir_node *node);
392 * Sets the instruction latency.
394 void set_ia32_latency(ir_node *node, unsigned latency);
399 * Returns the name of the original ir node.
401 const char *get_ia32_orig_node(const ir_node *node);
404 * Sets the name of the original ir node.
406 void set_ia32_orig_node(ir_node *node, const char *name);
410 /******************************************************************************************************
412 * (_) | | | | | | / _| | | (_)
413 * ___ _ __ ___ ___ _ __ _| | __ _| |_| |_ _ __ | |_ _ _ _ __ ___| |_ _ ___ _ __ ___
414 * / __| '_ \ / _ \/ __| |/ _` | | / _` | __| __| '__| | _| | | | '_ \ / __| __| |/ _ \| '_ \ / __|
415 * \__ \ |_) | __/ (__| | (_| | | | (_| | |_| |_| | | | | |_| | | | | (__| |_| | (_) | | | | \__ \
416 * |___/ .__/ \___|\___|_|\__,_|_| \__,_|\__|\__|_| |_| \__,_|_| |_|\___|\__|_|\___/|_| |_| |___/
419 ******************************************************************************************************/
422 * Gets the type of an ia32_Const.
424 unsigned get_ia32_Const_type(const ir_node *node);
427 * Sets the type of an ia32_Const.
429 void set_ia32_Const_type(ir_node *node, int type);
432 * Copy the attributes from an ia32_Const to an Immop (Add_i, Sub_i, ...) node
434 void set_ia32_Immop_attr(ir_node *node, ir_node *cnst);
437 * Copy the attributes from Immop to an Immop
439 void copy_ia32_Immop_attr(ir_node *node, ir_node *src);
442 * Copy the attributes from a Const to an ia32_Const
444 void set_ia32_Const_attr(ir_node *ia32_cnst, ir_node *cnst);
447 * Sets the AddrMode attribute
448 * @param direction The "direction" of AM ('S' source or 'D' destination)
450 void set_ia32_AddrMode(ir_node *node, char direction);
453 * Returns whether or not the node is an immediate operation with Const.
455 int is_ia32_ImmConst(const ir_node *node);
458 * Returns whether or not the node is an immediate operation with SymConst.
460 int is_ia32_ImmSymConst(const ir_node *node);
463 * Returns whether or not the node is an AddrModeS node.
465 int is_ia32_AddrModeS(const ir_node *node);
468 * Returns whether or not the node is an AddrModeD node.
470 int is_ia32_AddrModeD(const ir_node *node);
473 * Checks if node is a Load or fLoad.
475 int is_ia32_Ld(const ir_node *node);
478 * Checks if node is a Store or fStore.
480 int is_ia32_St(const ir_node *node);
483 * Checks if node is a Const or fConst.
485 int is_ia32_Cnst(const ir_node *node);
488 * Initializes the nodes attributes.
490 void init_ia32_attributes(ir_node *node, arch_irn_flags_t flags, const ia32_register_req_t **in_reqs, \
491 const ia32_register_req_t **out_reqs, int n_res, unsigned latency);
493 /* Include the generated headers */
494 #include "gen_ia32_new_nodes.h"
496 #endif /* _IA32_NEW_NODES_H_ */