aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm
AgeCommit message (Collapse)Author
2021-03-28Merge remote-tracking branch 'origin/master' into llvm12Andrew Kelley
2021-03-16stage2 llvm bindings: use correct type for LLVMBool for ABI compatTadeo Kondrak
2021-03-14stage2 llvm bindings: rename LLVMBool to BoolTadeo Kondrak
2021-03-04Merge remote-tracking branch 'origin/master' into llvm12Andrew Kelley
Syncing with master branch because I want to re-run update_clang_options.zig in the llvm12 branch.
2021-03-02stage2: add support for optionals in the LLVM backendTimon Kruiper
We can now codegen optionals! This includes the following instructions: - is_null - is_null_ptr - is_non_null - is_non_null_ptr - optional_payload - optional_payload_ptr - br_void Also includes a test for optionals.
2021-02-25Merge remote-tracking branch 'origin/master' into llvm12Andrew Kelley
Conflicts: * src/clang.zig * src/llvm.zig - this file got moved to src/llvm/bindings.zig in master branch so I had to put the new LLVM arch/os enum tags into it. * lib/std/target.zig, src/stage1/target.cpp - haiku had an inconsistency with its default target ABI, gnu vs eabi. In this commit we make it gnu in both places to match the latest changes by @hoanga. * src/translate_c.zig
2021-01-23add LTO supportAndrew Kelley
The CLI gains -flto and -fno-lto options to override the default. However, the cool thing about this is that the defaults are great! In general when you use build-exe in release mode, Zig will enable LTO if it would work and it would help. zig cc supports detecting and honoring the -flto and -fno-lto flags as well. The linkWithLld functions are improved to all be the same with regards to copying the artifact instead of trying to pass single objects through LLD with -r. There is possibly a future improvement here as well; see the respective TODOs. stage1 is updated to support outputting LLVM bitcode instead of machine code when lto is enabled. This allows LLVM to optimize across the Zig and C/C++ code boundary. closes #2845
2021-01-08stage2: add initial impl of control flow in LLVM backendTimon Kruiper
The following TZIR instrutions have been implemented in the backend: - all cmp operators (lt, lte, gt, gte, eq, neq) - block - br - condbr The following LLVMIR is generated for a simple assert function: ``` define void @assert(i1 %0) { Entry: %1 = alloca i1, align 1 store i1 %0, i1* %1, align 1 %2 = load i1, i1* %1, align 1 %3 = xor i1 %2, true br i1 %3, label %Then, label %Else Then: ; preds = %Entry call void @llvm.debugtrap() unreachable Else: ; preds = %Entry br label %Block Block: ; preds = %Else ret void } ``` See tests for more examples.
2021-01-06stage2: rename and move files related to LLVM backendTimon Kruiper