2 * Internal register allocation facility.
3 * @author Sebastian Hack
10 #include "firm_config.h"
13 * Register allocation data for a node.
15 typedef struct _ra_info_t {
16 int pressure; /**< Register pressure at this node. */
17 int color; /**< The color assigned to this node. */
18 int sim_live_phi_n; /**< The number of simulatenously live phi operand.
19 This is only used if the ir node occurs as an
20 operand to a phi function. */
21 int *sim_live_phi; /**< The array of simultaneously live nodes. Same restrictions
22 like @c sim_live_phi hold here. */
25 #define get_irn_ra_info(irn) get_irn_data(irn, ra_info_t, ra_irn_data_offset)
26 #define get_ra_info_irn(inf) get_irn_data_base(inf, ra_irn_data_offset)
28 extern size_t ra_irn_data_offset;
30 extern size_t ra_irg_data_offset;
32 #define get_irg_ra_link(irg) (*(get_irg_data(irg, void *, ra_irg_data_offset)))
33 #define set_irg_ra_link(irg,ptr) (*(get_irg_data(irg, void *, ra_irg_data_offset)) = ptr)
36 * Initialize the register allocation framework.
38 void be_ra_init(void);
41 * The 'no color' color. The register allocator should use this value,
42 * if a color cannot be assigned at some point.
47 * Check, if a color is valid.
48 * @param col The color.
49 * @return 1, if the color is ok, 0 if the color is illegal.
51 #define is_color(col) ((col) != NO_COLOR)
53 static INLINE int __get_irn_color(const ir_node *irn)
55 return get_irn_ra_info(irn)->color;
58 static INLINE void __set_irn_color(const ir_node *irn, int color)
60 get_irn_ra_info(irn)->color = color;
63 static INLINE int __is_allocatable_irn(const ir_node *irn)
65 return mode_is_datab(get_irn_mode(irn));
68 #define get_irn_color(irn) __get_irn_color(irn)
69 #define set_irn_color(irn,col) __set_irn_color(irn, col)
70 #define is_allocatable_irn(irn) __is_allocatable_irn(irn)