aboutsummaryrefslogtreecommitdiff
path: root/src/ir_print.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-07-18 19:24:45 +0100
committerGinger Bill <bill@gingerbill.org>2017-07-18 19:24:45 +0100
commit59fb7b020a5e0bd2d23daab0f74e9cfa23420afc (patch)
tree435bd10ec767d4bdf56bfc3d232c0c9debea18d8 /src/ir_print.cpp
parent65f079ebc474f9decc7afb222630c04b4da32690 (diff)
Merge `raw_union` into `struct` as a memory layout tag `#raw_union`
Diffstat (limited to 'src/ir_print.cpp')
-rw-r--r--src/ir_print.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/ir_print.cpp b/src/ir_print.cpp
index e2b4fcb1a..e2d33054b 100644
--- a/src/ir_print.cpp
+++ b/src/ir_print.cpp
@@ -300,8 +300,14 @@ void ir_print_type(irFileBuffer *f, irModule *m, Type *t) {
} return;
case Type_Record: {
- switch (t->Record.kind) {
- case TypeRecord_Struct:
+ if (t->Record.is_raw_union) {
+ // NOTE(bill): The zero size array is used to fix the alignment used in a structure as
+ // LLVM takes the first element's alignment as the entire alignment (like C)
+ i64 size_of_union = type_size_of(heap_allocator(), t);
+ i64 align_of_union = type_align_of(heap_allocator(), t);
+ ir_fprintf(f, "{[0 x <%lld x i8>], [%lld x i8]}", align_of_union, size_of_union);
+ return;
+ } else {
if (t->Record.is_packed) {
ir_fprintf(f, "<");
}
@@ -323,13 +329,6 @@ void ir_print_type(irFileBuffer *f, irModule *m, Type *t) {
ir_fprintf(f, ">");
}
return;
- case TypeRecord_RawUnion: {
- // NOTE(bill): The zero size array is used to fix the alignment used in a structure as
- // LLVM takes the first element's alignment as the entire alignment (like C)
- i64 size_of_union = type_size_of(heap_allocator(), t);
- i64 align_of_union = type_align_of(heap_allocator(), t);
- ir_fprintf(f, "{[0 x <%lld x i8>], [%lld x i8]}", align_of_union, size_of_union);
- } return;
}
} break;