aboutsummaryrefslogtreecommitdiff
path: root/src/zig_llvm.cpp
AgeCommit message (Collapse)Author
2021-07-26minimum/maximum builtinsRobin Voetter
2021-07-22add -femit-llvm-bc CLI option and implement itAndrew Kelley
* Added doc comments for `std.Target.ObjectFormat` enum * `std.Target.oFileExt` is removed because it is incorrect for Plan-9 targets. Instead, use `std.Target.ObjectFormat.fileExt` and pass a CPU architecture. * Added `Compilation.Directory.joinZ` for when a null byte is desired. * Improvements to `Compilation.create` logic for computing `use_llvm` and reporting errors in contradictory flags. `-femit-llvm-ir` and `-femit-llvm-bc` will now imply `-fLLVM`. * Fix compilation when passing `.bc` files on the command line. * Improvements to the stage2 LLVM backend: - cleaned up error messages and error reporting. Properly bubble up some errors rather than dumping to stderr; others turn into panics. - properly call ZigLLVMCreateTargetMachine and ZigLLVMTargetMachineEmitToFile and implement calculation of the respective parameters (cpu features, code model, abi name, lto, tsan, etc). - LLVM module verification only runs in debug builds of the compiler - use LLVMDumpModule rather than printToString because in the case that we incorrectly pass a null pointer to LLVM it may crash during dumping the module and having it partially printed is helpful in this case. - support -femit-asm, -fno-emit-bin, -femit-llvm-ir, -femit-llvm-bc - Support LLVM backend when used with Mach-O and WASM linkers.
2021-06-29Remove mention of lldMachO from the projectJakub Konka
including: * finding lldMachO in CMake config * punting `ld64.lld` to LLD linker * providing bindings to LLD linker
2021-06-18stage1: Store the specified code model in the LLVM moduleLemonBoy
This is needed for LTO builds to pick up the correct module. Closes #9132
2021-06-04llvm: Add support for collecting time trace (#8546)Min-Yih Hsu
LLVM time profiler can collect time traces and present them in a hierarchical view. Which breakdowns the time spent in each Pass or even IR unit. The result is also exported into a format that can be easily visualized by the Chrome browser. Currently this features is controlled by the following environment variables: - `ZIG_LLVM_TIME_TRACE_FILE` toggles this feature and specifies the output time trace file. - `ZIG_LLVM_TIME_TRACE_GRANULARITY` controls the time granularity in ms (default to 500).
2021-04-09llvm new-pm: Build O0 pipeline in the correct wayMin-Yih Hsu
Use `PassBuilder::buildO0DefaultPipeline` to build pipeline for -O0 in replacement of `PassBuilder::buildPerModuleDefaultPipeline`. This affects both normal and LTO settings. Two redundant Passes - which were added by accident - were also removed from LTO pipeline.
2021-04-09Revert "Revert back to the old LLVM PassManager"Min-Yih Hsu
This reverts commit 09008125e7944ae01bb907f2eb8dbff41d7a0715.
2021-04-06stage1: Work around a small problem in LLVM APILemonBoy
The missing initializer for a single field in the TargetOptions class was enough to turn the stack protectors into hot garbage. Fixes #8408
2021-04-02Revert back to the old LLVM PassManagerAndrew Kelley
See #8418 This reverts commit ba1bea2fe87b73a53a3ecd729789853dcc56affe. This reverts commit 94383d14df77fa638dac14f4b2bda5a2e3f21c5c. This reverts commit 0d53a2bff01750f9220bcc861d662b2c5f304506.
2021-04-02zig_llvm.cpp: remove dead codeAndrew Kelley
2021-04-02llvm new-pm: Add missing pipeline option and PassesMin-Yih Hsu
- Enable MergeFunctionsPass in non-debug build. - Verify input and output IR when the assertion is turned on. - Add AlwaysInlinePass in debug build. - Add more comments.
2021-04-02llvm new-pm: Port LLVM 11.x-based changes to LLVM 12.xMin-Yih Hsu
Now zig will use new PM for optimization by default.
2021-02-28stage1: update to LLVM 12 sret callsite requirementsAndrew Kelley
Without this, the LLVM IR that zig generates cannot be compiled by LLVM.
2021-02-26stage1: Fix emission of sret annotation for LLVMLemonBoy
LLVM12 deprecated `sret` and replaced it with the `sret(<Ty>)` form. Closes #8075
2021-02-26Revert "stage1: upgrade to new LLVM sret attribute requirement"Andrew Kelley
This reverts commit 685b5c26b703d54381a74b71361816ad85ec8584. @LemonBoy has a better patch, so reverting this to merge that one.
2021-02-26stage1: upgrade to new LLVM sret attribute requirementAndrew Kelley
LLVM 12 requires sret attributes to have the struct type as a parameter, and provides no C function for supplying it. Therefore, we must add another C++ wrapper API for adding the sret attribute. Fixes ability to build from source in the llvm12 branch.
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-02-25fix to compile against 12.0.0-rc2Michael Dusan
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
2020-12-24stage1: add tsan LLVM passes when appropriateAndrew Kelley
2020-12-16Update zig_llvm.cpp and other bitsJakub Konka
Include updates to corresponding zig sources llvm commit b2851aea80e5a8f0cfd6c3c5a56a6b00fb28c6b6
2020-12-08invoke LLD as a child process rather than a libraryAndrew Kelley
Closes #3825
2020-11-22Merge branch 'piepiepie' of https://github.com/LemonBoy/zig into pieAndrew Kelley
Conflicts: lib/std/dynamic_library.zig (fixed in this commit) src/all_types.hpp src/codegen.cpp src/link.cpp src/main.cpp Will manually apply the diffs to these deleted files to the new zig code in a followup commit.
2020-11-18Allow Zig to be built with clang 11 and -WerrorTimon Kruiper
This was brought to the horizon when using zig-bootstrap to cross compile Zig for windows-gnu.
2020-11-16Enable loop interleaving when unrolling is enabledFrank Denis
This mimics clang's default behavior.
2020-11-01stage1: Implement Add/Mul reduction operatorsLemonBoy
2020-10-12Merge remote-tracking branch 'origin/master' into llvm11Andrew Kelley
2020-10-12Rename .macosx to .macosVignesh Rajagopalan
2020-10-07Merge remote-tracking branch 'origin/master' into llvm11Andrew Kelley
Conflicts: cmake/Findllvm.cmake The llvm11 branch changed 10's to 11's and master branch added the "using LLVM_CONFIG_EXE" help message, so the resolution was to merge these changes together. I also added a check to make sure LLVM is built with AVR enabled, which is no longer an experimental target.
2020-10-05stage1: Implement @reduce builtin for vector typesLemonBoy
The builtin folds a Vector(N,T) into a scalar T using a specified operator. Closes #2698
2020-09-30Merge remote-tracking branch 'origin/master' into llvm11Andrew Kelley
The changes to install_files.h needed to put into src/libcxx.zig
2020-09-28stage2: building DLL import lib filesAndrew Kelley
2020-07-24update LLVM C++ API wrappers from llvm 10 to 11Andrew Kelley
2020-04-03change the default ABI of riscv64-linux-muslAndrew Kelley
Before, this would cause a link failure when mixing Zig and C code for RISC-V targets. Now, the ABIs match and Zig and C code can be mixed successfully. I will file a follow-up issue for the ability to deal more explicitly with ABIs. closes #4863
2020-02-25Merge remote-tracking branch 'origin/master' into llvm10Andrew Kelley
2020-02-21remove sub-arch from stage1Andrew Kelley
2020-02-18improvements which allow zig to emit multiple things at onceAndrew Kelley
example: zig build-obj test.zig -femit-llvm-ir -femit-asm this will generate all three: test.o test.s test.ll
2020-01-29Merge remote-tracking branch 'origin/master' into llvm10Andrew Kelley
2020-01-23link: update to llvm 10 APIAndrew Kelley
2020-01-23fix incorrect list of sub-arches for aarch64Andrew Kelley
tests use older sub-arch that works in the older qemu
2020-01-22update zig_llvm.h and zig_llvm.cpp to llvm 10Andrew Kelley
2020-01-16zig_llvm: update CodeGenFileType usageAndrew Kelley
2020-01-16Merge remote-tracking branch 'origin/master' into llvm10Andrew Kelley
2020-01-02Use the LLVM C++ APILemonBoy
2019-12-23add zig llvm wrapper for atomicrmwVexu
2019-12-21Initial support for static PIE executablesLemonBoy
2019-12-15Generate the fn pointers into the correct address spaceLemonBoy
Fixes #3645
2019-12-05implement `@call`Andrew Kelley
closes #3732
2019-10-12Add dlltool functionalityLemonBoy
Don't need no patched lld --kill-at behaviour now.
2019-10-02we have to use c++14 now for llvm10Andrew Kelley