tentative support for fast allocs

It seems that the MEM reference type is
meaningless in too many positions.
Because of this, it is unclear if we
should keep it or just introduce a
OAddr instruction that only accepts
slots.

Regardless of the above, the spilling
module needs to use the new slot_()
function, also, the emit function needs
to fetch the size of the stack frame
from the slot[] array.

The naming is still very transitional,
here is a list of all bogus names I can
think of:

  - SLOT()
  - Tmp.spill
  - slot_
This commit is contained in:
Quentin Carbonneaux 2015-08-14 15:54:25 -04:00
parent 0f3846e261
commit 67d3c2834d
5 changed files with 170 additions and 27 deletions

View file

@ -90,6 +90,7 @@ struct Ref {
enum {
RTmp,
RCon,
RMem,
RSlot,
NRef = (1<<14) - 1
};
@ -98,6 +99,7 @@ enum {
#define TMP(x) (Ref){RTmp, x}
#define CON(x) (Ref){RCon, x}
#define CON_Z CON(0) /* reserved zero constant */
#define MEM(x) (Ref){RMem, x}
#define SLOT(x) (Ref){RSlot, x}
static inline int req(Ref a, Ref b)
@ -139,6 +141,7 @@ enum Op {
OLoadub,
OCopy,
OAlloc,
OAlloc1 = OAlloc + 2,
NPubOp,
/* reserved instructions */
@ -237,7 +240,7 @@ struct Fn {
int ncon;
int nblk;
Blk **rpo;
uint nspill;
int slot[3];
};
@ -262,6 +265,7 @@ void ssafix(Fn *, int);
void filllive(Fn *);
/* isel.c */
int slot_(int, int, Fn *);
void isel(Fn *);
/* spill.c */