From 87ab8941edb69a84979068fe74718f8a12b43262 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Mon, 7 Sep 2015 21:59:45 -0400 Subject: 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 --- lisc/lisc.h | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'lisc/lisc.h') diff --git a/lisc/lisc.h b/lisc/lisc.h index 81d3280..71b0f28 100644 --- a/lisc/lisc.h +++ b/lisc/lisc.h @@ -15,6 +15,7 @@ typedef struct Blk Blk; typedef struct Tmp Tmp; typedef struct Con Con; typedef struct Fn Fn; +typedef struct Type Type; typedef enum { U, F, T } B3; @@ -51,6 +52,7 @@ enum { NBlk = 128, NIns = 256, NAlign = 3, + NSeg = 32, BITS = 4, NBit = 64, @@ -120,8 +122,8 @@ enum Op { OStores, OStoreb, OLoad, - OLoadss, - OLoadus, + OLoadsh, + OLoaduh, OLoadsb, OLoadub, OAlloc, @@ -197,14 +199,6 @@ struct Blk { }; struct Tmp { -#if 0 - enum { - TUndef, - TWord, - TLong, - TReg, - } type; -#endif char name[NString]; uint ndef, nuse; uint cost; @@ -232,6 +226,18 @@ struct Fn { int nblk; Blk **rpo; int svec[NAlign]; + char name[NString]; +}; + +struct Type { + int dark; + int size; + int align; + + struct { + uint flt:1; + uint len:31; + } seg[NSeg]; }; @@ -244,7 +250,7 @@ extern OpDesc opdesc[]; void diag(char *); void *alloc(size_t); Blk *blocka(void); -Fn *parsefn(FILE *); +Fn *parse(FILE *); void printfn(Fn *, FILE *); /* ssa.c */ -- cgit 1.4.1