aboutsummaryrefslogtreecommitdiff
path: root/src/ir_print.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-08-13 01:22:14 +0100
committergingerBill <bill@gingerbill.org>2018-08-13 01:22:14 +0100
commit89f4e7a8dbed4272f85f10568a542697aa3b38f8 (patch)
tree125195ac6f23c9ec830b1ea0423001771eeb7592 /src/ir_print.cpp
parent55f4eabecdb5282d975369ec770078ec7bd49be6 (diff)
`-no-crt` flag for windows amd64
Diffstat (limited to 'src/ir_print.cpp')
-rw-r--r--src/ir_print.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/ir_print.cpp b/src/ir_print.cpp
index ac1c20d90..46d351c8f 100644
--- a/src/ir_print.cpp
+++ b/src/ir_print.cpp
@@ -1737,6 +1737,15 @@ void print_llvm_ir(irGen *ir) {
}
}
+ if (ir->print_chkstk) {
+ // TODO(bill): Clean up this code
+ ir_write_str_lit(f, "\n\n");
+ ir_write_str_lit(f, "define void @__chkstk() #0 {\n");
+ ir_write_str_lit(f, "\tcall void asm sideeffect \"push %rcx \\09\\0Apush %rax \\09\\0Acmp $$0x1000,%rax \\09\\0Alea 24(%rsp),%rcx \\09\\0Ajb 1f \\09\\0A2: \\09\\0Asub $$0x1000,%rcx \\09\\0Aorl $$0,(%rcx) \\09\\0Asub $$0x1000,%rax \\09\\0Acmp $$0x1000,%rax \\09\\0Aja 2b \\09\\0A1: \\09\\0Asub %rax,%rcx \\09\\0Aorl $$0,(%rcx) \\09\\0Apop %rax \\09\\0Apop %rcx \\09\\0Aret \\09\\0A\", \"~{dirflag},~{fpsr},~{flags}\"()\n");
+ ir_write_str_lit(f, "\tret void\n");
+ ir_write_str_lit(f, "}\n\n");
+ }
+
// NOTE(bill): Print procedures with bodies next
for_array(member_index, m->members.entries) {
auto *entry = &m->members.entries[member_index];