summaryrefslogtreecommitdiff
path: root/regalloc.h
blob: 08e6bc9efe9a87a4f92caf487a57b78f42c88e3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "codex86.h"

typedef struct RegAlloc RegAlloc;

RegAlloc *reg_alloc_new            (Asm      *a);
void      reg_alloc_normalize      (RegAlloc *ra);
op_t      reg_alloc_get_register   (RegAlloc *ra,
				    op_t      op);
op_t      reg_alloc_alloc_gp       (RegAlloc *ra);
op_t      reg_alloc_alloc_mmx      (RegAlloc *ra);
op_t      reg_alloc_alloc_sse      (RegAlloc *ra);
op_t      reg_alloc_alloc_gp_force (RegAlloc *ra,
				    reg_t     reg);
op_t      reg_alloc_get_register_or_memory (RegAlloc *ra, op_t);

/* It is allowed to read a variable immediately after
 * deallocating it. New variables may be allocated in
 * the same slot, but this is fine because instructions
 * work when both operands are the same register. In
 * other words, a decallocated register remains usable until
 * someone has written into a newly allocated variable.
 */
void      reg_alloc_dealloc        (RegAlloc *ra,
				    op_t      var);