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

@ -26,7 +26,6 @@ OpDesc opdesc[NOp] = {
[OLoadus] = { "loadus", 1, 0 },
[OLoadsb] = { "loadsb", 1, 0 },
[OLoadub] = { "loadub", 1, 0 },
[OAlloc] = { "alloc", 1, 1 },
[OCopy] = { "copy", 1, 1 },
[ONop] = { "nop", 0, 0 },
[OSwap] = { "swap", 2, 2 },
@ -34,6 +33,9 @@ OpDesc opdesc[NOp] = {
[OXDiv] = { "xdiv", 1, 1 },
[OXCmpw] = { "xcmpw", 2, 1 },
[OXCmpl] = { "xcmpl", 2, 1 },
[OAlloc] = { "alloc4", 1, 1 },
[OAlloc+1] = { "alloc8", 1, 1 },
[OAlloc+2] = { "alloc16", 1, 1 },
#define X(c) \
[OCmp+C##c] = { "c" #c, 2, 0 }, \
@ -559,7 +561,10 @@ printref(Ref r, Fn *fn, FILE *f)
}
break;
case RSlot:
fprintf(f, "$%d", r.val);
fprintf(f, "S%d", r.val);
break;
case RMem:
fprintf(f, "M%d", r.val);
break;
}
return "";