parrotcode: compilers/imcc/reg_alloc.c | |
Contents | Compilers |
compilers/imcc/reg_alloc.c
Register allocator:
This is a brute force register allocator. It uses a graph-coloring algorithm, but the implementation is very kludgy.
It is a partial implementation of a Briggs-style register allocator The following parts are just missing:
- Renumbering
- Coaelesceing
PARROT_CANNOT_RETURN_NULL static unsigned int *ig_get_word(int i, int j, int N, NOTNULL(unsigned int *graph), NOTNULL(int *bit_ofs))
static void ig_set(int i, int j, int N, NOTNULL(unsigned int *graph))
int ig_test(int i, int j, int N, NOTNULL(unsigned int *graph))
PARROT_CANNOT_RETURN_NULL static unsigned int *ig_allocate(int N)
void imc_reg_alloc(PARROT_INTERP, NULLOK(IMC_Unit *unit))
void free_reglist(NOTNULL(IMC_Unit *unit))
void graph_coloring_reg_alloc(PARROT_INTERP, NOTNULL(IMC_Unit *unit))
static void make_stat(NOTNULL(IMC_Unit *unit), NULLOK(int *sets), NULLOK(int *cols))
static void imc_stat_init(NOTNULL(IMC_Unit *unit))
static void print_stat(PARROT_INTERP, NOTNULL(IMC_Unit *unit))
static int reg_sort_f(NOTNULL(const void *a), NOTNULL(const void *b))
static void sort_reglist(NOTNULL(IMC_Unit *unit))
static void build_reglist(Parrot_Interp interp, NOTNULL(IMC_Unit *unit))
static void rebuild_reglist(NOTNULL(IMC_Unit *unit))
static void build_interference_graph(PARROT_INTERP, NOTNULL(IMC_Unit *unit))
static void compute_du_chain(NOTNULL(IMC_Unit *unit))
static void compute_one_du_chain(NOTNULL(SymReg *r), NOTNULL(IMC_Unit *unit))
static int interferes(PARROT_INTERP, NOTNULL(IMC_Unit *unit), NOTNULL(SymReg *r0), NOTNULL(SymReg *r1))
static int ig_find_color(NOTNULL(const IMC_Unit *unit), NOTNULL(const char *avail))
static int try_allocate(PARROT_INTERP, NOTNULL(IMC_Unit *unit))
static void map_colors(NOTNULL(IMC_Unit *unit), int x, NOTNULL(unsigned int *graph), NOTNULL(char *avail), int typ, int already_allocated)
static int first_avail(NOTNULL(IMC_Unit *unit), int reg_set, NULLOK(Set **avail))
static void allocate_uniq(PARROT_INTERP, NOTNULL(IMC_Unit *unit), int usage)
static void vanilla_reg_alloc(SHIM_INTERP, NOTNULL(IMC_Unit *unit))
static void allocate_lexicals(PARROT_INTERP, NOTNULL(IMC_Unit *unit))
static void allocate_non_volatile(PARROT_INTERP, NOTNULL(IMC_Unit *unit))
|