diff options
| author | 2022-08-29 08:17:03 +0200 | |
|---|---|---|
| committer | 2022-08-29 09:03:36 +0200 | |
| commit | a984cedd59c5dc290b896e4b8743f771df31e1bd (patch) | |
| tree | 232d8a35f0d3bb8ce57ac2f6c2fb620615a5044f /src/llvm.cff | |
| parent | 6aeb4e79bf92863a3b5d41b22db71cf342c9b54e (diff) | |
add type, multiline strings
Diffstat (limited to 'src/llvm.cff')
| -rw-r--r-- | src/llvm.cff | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/llvm.cff b/src/llvm.cff index 0031777..eb13919 100644 --- a/src/llvm.cff +++ b/src/llvm.cff @@ -72,6 +72,15 @@ extern fn genagg(ty *const Type) void { } } +extern fn llvm_addtype(ty *const Type) void { + if ty.u.#tag == :Agg and !ty.u.Agg.fwd { + gen("%%type.%s.%d = type ", ty.u.Agg.name ?? as(*u8)".", ty.u.Agg.id); + genagg(ty); + gen("\n"); + } +} + + fn gendata(ty *const Type, ex *Expr) void; fn gen(fmt *const u8, ...) void { let ap va_list #?; @@ -93,8 +102,12 @@ fn gen(fmt *const u8, ...) void { case Arr arr; assert(arr.length >= 0, "arr length"); gen("[%z x %t]", arr.length, arr.child); - case Agg; - genagg(ty); + case Agg agg; + if agg.fwd { + genagg(ty); + } else { + gen("%%type.%s.%d", ty.u.Agg.name ?? as(*u8)".", ty.u.Agg.id); + } case Enum enu; pritype(enu.intty); case BitF bitf; pritype(bitf.intty); case Fn f; |