#include "stack-man.h" #include "simplex86.h" typedef struct reg_alloc_t reg_alloc_t; typedef struct reg_pool_t reg_pool_t; #define MAX_REGISTERS (16) #define MAX_SPILLS (16) struct reg_pool_t { int n_registers; reg_t registers[MAX_REGISTERS]; }; struct reg_alloc_t { const reg_pool_t * pool; int allocated[MAX_REGISTERS]; int clobbered[MAX_REGISTERS]; int failed; }; void reg_alloc_init (reg_alloc_t *ra, const reg_pool_t *reg_pool); /* This resurrects a register that has been freed, but is known * to still contain a useful value. */ reg_t reg_alloc_alloc_preserve (reg_alloc_t *ra, reg_t reg); reg_t reg_alloc_alloc (reg_alloc_t *ra); void reg_alloc_free (reg_alloc_t *ra, reg_t reg); int reg_alloc_failed (reg_alloc_t *ra); int reg_alloc_clobbered (reg_alloc_t *ra, reg_t reg);