start work on aggregate types

The parser now has some code to parse the description
of structured types.

I tried to be even less specific than LLVM "type" by
creating just enough abstraction so that I can deal
with both AARCH64 and x64.  The base types used in the
definition of an aggregate are really just syntactic sugar
to give a structure a size and an alignment.  Only the
location of float components matters for the compilation.
In particular this means that the front-ends have to know
how the ABI works to pass/return small integer types.
This also means that the font-end has to be aware of the
layout of structures.

Chris Lattner has a proposition [1] for LLVM that is still
pending and goes in the direction of giving more control
of the ABI the front-end.

[1]: http://www.nondot.org/sabre/LLVMNotes/ExtendedIntegerResults.txt
This commit is contained in:
Quentin Carbonneaux 2015-09-07 21:59:45 -04:00
parent 8f2922eb1a
commit 87ab8941ed
5 changed files with 201 additions and 47 deletions

View file

@ -143,8 +143,8 @@ eins(Ins i, Fn *fn, FILE *f)
[OSext] = "movsl",
[OZext] = "movzl",
[OLoad] = "mov",
[OLoadss] = "movsw",
[OLoadus] = "movzw",
[OLoadsh] = "movsw",
[OLoaduh] = "movzw",
[OLoadsb] = "movsb",
[OLoadub] = "movzb",
};
@ -214,8 +214,8 @@ eins(Ins i, Fn *fn, FILE *f)
i.op - OStorel, i.arg[0], i.arg[1]);
break;
case OLoad:
case OLoadss:
case OLoadus:
case OLoadsh:
case OLoaduh:
case OLoadsb:
case OLoadub:
emitf(fn, f, "\t%s%w %M, %R\n", otoa[i.op],
@ -298,11 +298,12 @@ emitfn(Fn *fn, FILE *f)
fprintf(f,
".text\n"
".globl liscf\n"
".type liscf, @function\n"
"liscf:\n"
".globl %s\n"
".type %s, @function\n"
"%s:\n"
"\tpush %%rbp\n"
"\tmov %%rsp, %%rbp\n"
"\tmov %%rsp, %%rbp\n",
fn->name, fn->name, fn->name
);
fs = framesz(fn);
if (fs)