added DBG_OPT_LEA( to report Lea craetion to the firm statistic module
[libfirm] / ir / be / ia32 / ia32_map_regs.h
1 #ifndef _IA32_MAP_REGS_H_
2 #define _IA32_MAP_REGS_H_
3
4 #include "irnode.h"
5 #include "set.h"
6
7 #include "../bearch.h"
8 #include "ia32_nodes_attr.h"
9
10 /**
11  * Convenience macro to check if register <code>out<\code>
12  * and register <code>in<\code> are equal.
13  */
14 #define REGS_ARE_EQUAL(out, in) \
15         ((arch_register_get_class(out) == arch_register_get_class(in)) && \
16         (arch_register_get_index(out) == arch_register_get_index(in)))
17
18 /**
19  * Set compare function
20  */
21 int  ia32_cmp_irn_reg_assoc(const void *a, const void *b, size_t len);
22
23 /**
24  * Assigns a register to a firm node.
25  */
26 void ia32_set_firm_reg(ir_node *irn, const arch_register_t *reg, set *reg_set);
27
28 /**
29  * Gets the register assigned to a firm node.
30  */
31 const arch_register_t *ia32_get_firm_reg(const ir_node *irn, set *reg_set);
32
33 /**
34  * Enters for each general purpose register the corresponding 16bit
35  * name into a pmap.
36  */
37 void ia32_build_16bit_reg_map(pmap *reg_map);
38
39 /**
40  * Enters for each general purpose register the corresponding 8bit
41  * name into a pmap.
42  */
43 void ia32_build_8bit_reg_map(pmap *reg_map);
44
45 /**
46  * Returns the corresponding mapped name for a register.
47  */
48 char *ia32_get_mapped_reg_name(pmap *reg_map, const arch_register_t *reg);
49
50 /**
51  * Check all parameters and determine the maximum number of parameters
52  * to pass in gp regs resp. in fp regs.
53  *
54  * @param n       The number of parameters
55  * @param modes   The list of the parameter modes
56  * @param n_int   Holds the number of int parameters to be passed in regs after the call
57  * @param n_float Holds the number of float parameters to be passed in regs after the call
58  * @return        The number of the last parameter to be passed in register
59  */
60 int ia32_get_n_regparam_class(int n, ir_mode **modes, int *n_int, int *n_float);
61
62 /**
63  * Returns the register for parameter nr.
64  *
65  * @param n     The number of parameters
66  * @param modes The list of the parameter modes
67  * @param nr    The number of the parameter to return the requirements for
68  * @param cc    The calling convention
69  * @return      The register
70  */
71 const arch_register_t *ia32_get_RegParam_reg(int n, ir_mode **modes, long nr, unsigned cc);
72
73 /**
74  * Translates the projnum into a "real" argument position for register
75  * requirements dependent on the predecessor.
76  */
77 long ia32_translate_proj_pos(const ir_node *proj);
78
79 #endif /* _IA32_MAP_REGS_H_ */