From 6f09869ea139782fd97e80182a0645891bf548d5 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Tue, 18 Aug 2015 19:11:48 -0400 Subject: move spill and emit to the new slot system In emit, I worked a little to make sure that framesz works when we change the size of the svec array (if we need more alignments). --- lisc/spill.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'lisc/spill.c') diff --git a/lisc/spill.c b/lisc/spill.c index a407047..5fa54ca 100644 --- a/lisc/spill.c +++ b/lisc/spill.c @@ -141,10 +141,10 @@ bcnt(Bits *b) /* glad I can pull it :) */ } extern Ins insb[NIns], *curi; /* shared work buffer */ -static Bits *f; /* temps to prioritize in registers (for tcmp1) */ -static Tmp *tmp; /* current temporaries (for tcmpX) */ -static int ntmp; /* current # of temps (for limit) */ -static uint ns; /* current # of spill slots */ +static Bits *f; /* temps to prioritize in registers (for tcmp1) */ +static Tmp *tmp; /* current temporaries (for tcmpX) */ +static int ntmp; /* current # of temps (for limit) */ +static int *svec; /* free slots vector */ static int tcmp0(const void *pa, const void *pb) @@ -170,7 +170,12 @@ slot(int t) diag("spill: cannot spill register"); s = tmp[t].spill; if (!s) { - s = ++ns; + if (tmp[t].type == TWord) + s = slota(1, 1, svec); + else if (tmp[t].type == TLong) + s = slota(2, 2, svec); + else + diag("spill: unknown type (1)"); tmp[t].spill = s; } return SLOT(s); @@ -189,8 +194,10 @@ store(Ref r, int s) { if (tmp[r.val].type == TLong) emit(OStorel, R, r, SLOT(s)); - else + else if (tmp[r.val].type == TWord) emit(OStorew, R, r, SLOT(s)); + else + diag("spill: unknown type (2)"); } static int @@ -293,7 +300,7 @@ spill(Fn *fn) int j, s; Phi *p; - ns = 0; + svec = fn->svec; tmp = fn->tmp; ntmp = fn->ntmp; assert(ntmp < NBit*BITS); -- cgit 1.4.1