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