aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
AgeCommit message (Collapse)Author
2024-12-03llvm: Remove dead targetArch() and targetOs() functions.Alex Rønne Petersen
These were leftovers from when we used the LLVM API to create modules.
2024-12-03std.Target: Remove Os.Tag.bridgeos.Alex Rønne Petersen
It doesn't appear that targeting bridgeOS is meaningfully supported by Apple. Even LLVM/Clang appear to have incomplete support for it, suggesting that Apple never bothered to upstream that support. So there's really no sense in us pretending to support this.
2024-11-28llvm: Lower ohoseabi to ohos instead of verbatim.Alex Rønne Petersen
LLVM doesn't recognize ohoseabi.
2024-11-28Merge pull request #22067 from alexrp/pie-testsAlex Rønne Petersen
Add PIC/PIE tests and fix some bugs + some improvements to the test harness
2024-11-24dwarf: fix stepping through an inline loop containing one statementJacob Young
Previously, stepping from the single statement within the loop would always exit the loop because all of the code unrolled from the loop is associated with the same line and treated by the debugger as one line.
2024-11-24std.Target: Add Os.HurdVersionRange for Os.Tag.hurd.Alex Rønne Petersen
This is necessary since isGnuLibC() is true for hurd, so we need to be able to represent a glibc version for it. Also add an Os.TaggedVersionRange.gnuLibCVersion() convenience function.
2024-11-12Merge pull request #21920 from alexrp/nobuiltinAlex Rønne Petersen
compiler: Improve handling of `-fno-builtin` and compiler-rt options
2024-11-09spirv: dont emit forward pointer for annotation instructionsRobin Voetter
2024-11-08spirv: emit ArrayStride for many-item pointersRobin Voetter
2024-11-08spirv: make all vulkan structs Block for nowRobin Voetter
2024-11-08add storage_buffer address spaceRobin Voetter
2024-11-08spirv: assembler hacky constant placeholdersRobin Voetter
2024-11-08spirv: make default generic address space for vulkan FunctionRobin Voetter
We are not using Private variables. This needs to be cleaned up a bit more, this will happen with the general address space improvements.
2024-11-08spirv: track global OpVariables properly in assemblerRobin Voetter
Also cleans up the assembler a bit in general.
2024-11-08spirv: properly resolve type inputs in assemblyRobin Voetter
For now the frontend still allows type inputs in assembly. We might as well resolve them properly in the SPIR-V backend.
2024-11-08llvm: Disable lowering to f16 on sparc.Alex Rønne Petersen
2024-11-05llvm: Also apply the nobuiltin attribute for the no_builtin module option.Alex Rønne Petersen
From `zig build-exe --help`: -fno-builtin Disable implicit builtin knowledge of functions It seems entirely reasonable and even expected that this option should imply both no-builtins on functions (which disables transformation of recognized code patterns to libcalls) and nobuiltin on call sites (which disables transformation of libcalls to intrinsics). We now match Clang's behavior for -fno-builtin. In both cases, we're painting with a fairly broad brush by applying this to an entire module, but it's better than nothing. #21833 proposes a more fine-grained way to apply nobuiltin.
2024-11-05Compilation: Move no_builtin to Package.Module.Alex Rønne Petersen
This option, by its very nature, needs to be attached to a module. If it isn't, the code in a module could break at random when compiled into an application that doesn't have this option set. After this change, skip_linker_dependencies no longer implies no_builtin in the LLVM backend.
2024-11-05Merge pull request #21907 from alexrp/valgrind-stuffAlex Rønne Petersen
Add client request support for all architectures supported by Valgrind
2024-11-04llvm: Use no-builtins attribute instead of nobuiltin.Alex Rønne Petersen
The former prevents recognizing code patterns and turning them into libcalls, which is what we want for compiler-rt. The latter is meant to be used on call sites to prevent them from being turned into intrinsics. Context: https://github.com/ziglang/zig/issues/21833
2024-11-04llvm: Add client request support for all archs supported by Valgrind.Alex Rønne Petersen
2024-11-03Merge pull request #21843 from alexrp/callconv-followupAlex Rønne Petersen
Some follow-up work for #21697
2024-11-03Merge pull request #21599 from alexrp/thumb-portingAlex Rønne Petersen
2024-11-03llvm: Update the list of address spaces for LLVM 19.Alex Rønne Petersen
Mainly affects amdgcn.
2024-11-03std.Target: Replace isARM() with isArmOrThumb() and rename it to isArm().Alex Rønne Petersen
The old isARM() function was a portability trap. With the name it had, it seemed like the obviously correct function to use, but it didn't include Thumb. In the vast majority of cases where someone wants to ask "is the target Arm?", Thumb *should* be included. There are exactly 3 cases in the codebase where we do actually need to exclude Thumb, although one of those is in Aro and mirrors a check in Clang that is itself likely a bug. These rare cases can just add an extra isThumb() check.
2024-11-02llvm: Remove extraneous commas for branch hint metadata in textual IR output.Alex Rønne Petersen
2024-11-02cbe: Support some more calling conventions.Alex Rønne Petersen
2024-11-02compiler: Handle arm_aapcs16_vfp alongside arm_aapcs_vfp in some places.Alex Rønne Petersen
2024-11-02llvm: Fix lowering of gnuilp32 ABI to be gnu_ilp32.Alex Rønne Petersen
LLVM doesn't even recognize the gnuilp32 spelling as an alternative.
2024-11-02std.Target: Add muslabin32 and muslabi64 tags to Abi.Alex Rønne Petersen
Once we upgrade to LLVM 20, these should be lowered verbatim rather than to simply musl. Similarly, the special case in llvmMachineAbi() should go away.
2024-11-02std.Target: Remove armv7k/armv7s.Alex Rønne Petersen
Like d1d95294fd657f771657ea671a6984b860347fb0, this is more Apple nonsense where they abused the arch component of the triple to encode what's really an ABI. Handling this correctly in Zig's target triple model would take quite a bit of work. Fortunately, the last Armv7-based Apple Watch was released in 2017 and these targets are now considered legacy. By the time Zig hits 1.0, they will be a distant memory. So just remove them.
2024-11-01std.Target: Add support for specifying Android API level.Alex Rønne Petersen
2024-11-01llvm: Set OS min version and libc version in ~all cases.Alex Rønne Petersen
Except Windows, because that just doesn't really fit into LLVM's target triple format currently.
2024-11-01llvm: Set vendor type in LLVM target triple for more OSs.Alex Rønne Petersen
Annoyingly, LLVM and Clang have various checks throughout that depend on these vendor types being set.
2024-11-01Merge pull request #21861 from alichraghi/masterRobin Voetter
spirv: push constants and small fixes
2024-11-01spirv: decorate arrays strideAli Cheraghi
2024-11-01spirv: Uniform/PushConstant variablesAli Cheraghi
- Rename GPU address spaces to match with SPIR-V spec. - Emit `Block` Decoration for Uniform/PushConstant variables. - Don't emit `OpTypeForwardPointer` for non-opencl targets. (there's still a false-positive about recursive structs) Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
2024-10-31compiler: remove anonymous struct types, unify all tuplesmlugg
This commit reworks how anonymous struct literals and tuples work. Previously, an untyped anonymous struct literal (e.g. `const x = .{ .a = 123 }`) was given an "anonymous struct type", which is a special kind of struct which coerces using structural equivalence. This mechanism was a holdover from before we used RLS / result types as the primary mechanism of type inference. This commit changes the language so that the type assigned here is a "normal" struct type. It uses a form of equivalence based on the AST node and the type's structure, much like a reified (`@Type`) type. Additionally, tuples have been simplified. The distinction between "simple" and "complex" tuple types is eliminated. All tuples, even those explicitly declared using `struct { ... }` syntax, use structural equivalence, and do not undergo staged type resolution. Tuples are very restricted: they cannot have non-`auto` layouts, cannot have aligned fields, and cannot have default values with the exception of `comptime` fields. Tuples currently do not have optimized layout, but this can be changed in the future. This change simplifies the language, and fixes some problematic coercions through pointers which led to unintuitive behavior. Resolves: #16865
2024-10-31zig_llvm: Reduce our exposure to LLVM API breakage.Alex Rønne Petersen
LLVM recently introduced new Triple::ArchType members in 19.1.3 which broke our static assertions in zig_llvm.cpp. When implementing a fix for that, I realized that we don't even need a lot of the stuff we have in zig_llvm.(cpp,h) anymore. This commit trims the interface down considerably.
2024-10-29Merge pull request #21826 from Snektron/spirv-vulkanRobin Voetter
spirv: vulkan setup
2024-10-27implement new interrupts in the llvm backendDavid Rubin
2024-10-27spirv: generate test entry points for vulkanRobin Voetter
2024-10-27spirv: use PhysicalStorageBuffer64 for global pointers under vkRobin Voetter
We can use real pointers with this storage class!!
2024-10-27spirv: fix up calling conventions for vulkanRobin Voetter
* Fragment and Vertex CCs are only valid for SPIR-V when running under Vulkan. * Emit GLCompute instead of Kernel for SPIR-V kernels.
2024-10-25Merge pull request #21710 from alexrp/function-alignmentAlex Rønne Petersen
Some improvements to the compiler's handling of function alignment
2024-10-23Merge pull request #21758 from kcbanner/dll_storage_classAndrew Kelley
Add `is_dll_import` to @extern, to support `__declspec(dllimport)` with the MSVC ABI
2024-10-22Cause a compilation error to occur if using @extern with is_dll_import in a ↵kcbanner
comptime scope. Add a note about thread local / dll import being the cause.
2024-10-22Add support for specifying `dll_storage_class` in @externkcbanner
2024-10-20llvm: Add some missing fnptr alignment specifications in DataLayoutBuilder.Alex Rønne Petersen
2024-10-19llvm: fix lowering `arm_aapcs_vfp` functionsmlugg