rework storage of types

The arm64 ABI needs to know precisely what
floating point types are being used, so we
need to store that information.

I also made typ[] a dynamic array.
This commit is contained in:
Quentin Carbonneaux 2017-04-08 21:09:59 -04:00
parent 49a4593c33
commit 96836855a5
4 changed files with 68 additions and 54 deletions

View file

@ -19,32 +19,37 @@ struct RAlloc {
static void
classify(AClass *a, Typ *t, int *pn, int *pe)
{
Seg *seg;
int n, s, *cls;
Field *fld;
int s, *cls;
uint n;
for (n=0; n<t->nunion; n++) {
seg = t->seg[n];
fld = t->fields[n];
for (s=0; *pe<2; (*pe)++) {
cls = &a->cls[*pe];
for (; *pn<8; s++) {
switch (seg[s].type) {
case SEnd:
switch (fld[s].type) {
case FEnd:
goto Done;
case SPad:
case FPad:
/* don't change anything */
break;
case SFlt:
case Fs:
case Fd:
if (*cls == Kx)
*cls = Kd;
break;
case SInt:
case Fb:
case Fh:
case Fw:
case Fl:
*cls = Kl;
break;
case STyp:
classify(a, &typ[seg[s].len], pn, pe);
case FTyp:
classify(a, &typ[fld[s].len], pn, pe);
continue;
}
*pn += seg[s].len;
*pn += fld[s].len;
}
Done:
assert(*pn <= 8);