aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
AgeCommit message (Collapse)Author
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
2024-10-19llvn: fix incorrect mips64 callconv handlingmlugg
2024-10-19llvm: fix lowering of avr_interrupt and m68k_interrupt callconvsmlugg
2024-10-19cbe,translate-c: support more callconvsmlugg
There are several more that we could support here, but I didn't feel like going down the rabbit-hole of figuring them out. In particular, some of the Clang enum fields aren't specific enough for us, so we'll have to switch on the target to figure out how to translate-c them. That can be a future enhancement.
2024-10-19std.Target: rename `defaultCCallingConvention` and `Cpu.Arch.fromCallconv`mlugg
2024-10-19std: update for new `CallingConvention`mlugg
The old `CallingConvention` type is replaced with the new `NewCallingConvention`. References to `NewCallingConvention` in the compiler are updated accordingly. In addition, a few parts of the standard library are updated to use the new type correctly.
2024-10-19compiler: introduce new `CallingConvention`mlugg
This commit begins implementing accepted proposal #21209 by making `std.builtin.CallingConvention` a tagged union. The stage1 dance here is a little convoluted. This commit introduces the new type as `NewCallingConvention`, keeping the old `CallingConvention` around. The compiler uses `std.builtin.NewCallingConvention` exclusively, but when fetching the type from `std` when running the compiler (e.g. with `getBuiltinType`), the name `CallingConvention` is used. This allows a prior build of Zig to be used to build this commit. The next commit will update `zig1.wasm`, and then the compiler and standard library can be updated to completely replace `CallingConvention` with `NewCallingConvention`. The second half of #21209 is to remove `@setAlignStack`, which will be implemented in another commit after updating `zig1.wasm`.
2024-10-17Merge pull request #21610 from alexrp/riscv-abisAndrew Kelley
Fix some RISC-V ABI issues and add ILP32/LP64 (soft float) to module tests
2024-10-16llvm: Disable f16 lowering for loongarch.Alex Rønne Petersen
This should be reverted with LLVM 20.
2024-10-16llvm: Fix natural int width specifications for loongarch in DataLayoutBuilder.Alex Rønne Petersen
2024-10-15llvm: Enable native f16 lowering for riscv32.Alex Rønne Petersen
2024-10-15llvm: Fix compiler crash when lowering f16 for riscv32 ilp32.Alex Rønne Petersen
2024-10-13Merge pull request #21688 from Snektron/spirv-fixRobin Voetter
spirv: fix some bitrot
2024-10-12implement packed struct equality (#21679)David Rubin
2024-10-13spirv: don't generate OpUnreachable after noreturn callRobin Voetter
It seems that these are now automatically added to AIR in Sema.
2024-10-13spirv: implement repeat and dbg_arg_inlineRobin Voetter
2024-10-13spirv: don't try to lower types which have no runtime bitsRobin Voetter
2024-10-06Merge pull request #21605 from alexrp/ohos-stuffAlex Rønne Petersen
`std.Target`: Introduce `Abi.ohoseabi` to distinguish the soft float case.
2024-10-06Merge pull request #21587 from alexrp/hexagon-portingAlex Rønne Petersen
Some initial `hexagon-linux` port work
2024-10-05std.Target: Introduce Abi.ohoseabi to distinguish the soft float case.Alex Rønne Petersen
For the same reason as #21504.
2024-10-05Merge pull request #21574 from alexrp/llvm-sub-archAlex Rønne Petersen
`llvm`: Implement sub-architecture translation in `targetTriple()`.
2024-10-04remove `@fence` (#21585)David Rubin
closes #11650