aboutsummaryrefslogtreecommitdiff
path: root/src/target.zig
AgeCommit message (Collapse)Author
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-27spirv: forbid merging logical pointersRobin Voetter
Under some architecture/operating system combinations it is forbidden to return a pointer from a merge, as these pointers must point to a location at compile time. This adds a check for those cases when returning a pointer from a block merge.
2024-10-26Compilation: Omit Clang CPU model flags for some targets.Alex Rønne Petersen
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-23also find static libc files on the hostAndrew Kelley
and don't look for glibc files on windows
2024-10-23move linker input file parsing to the compilation pipelineAndrew Kelley
2024-10-20compiler: Remove uses of defaultFunctionAlignment() in the frontend.Alex Rønne Petersen
minFunctionAlignment() is something we can know ahead of time for any given target because it's a matter of ABI. However, defaultFunctionAlignment() is a matter of optimization and every backend can do it differently depending on any number of factors. For example, LLVM will base the choice on the CPU model in its aarch64 backend. So just don't use this value in the frontend.
2024-10-20compiler: Update defaultFunctionAlignment()/minFunctionAlignment() for more ↵Alex Rønne Petersen
targets. defaultFunctionAlignment() can be made more sophisticated over time based on the CPU model and/or features. For now, I've picked some reasonable values for the CPUs that are most commonly used in practice. (Values are sourced from LLVM.)
2024-10-20compiler: Disallow function alignment for nvptx and spirv.Alex Rønne Petersen
2024-10-19x86_64: handle incoming stack alignmentmlugg
2024-10-19compiler: remove @setAlignStackmlugg
This commit finishes implementing #21209 by removing the `@setAlignStack` builtin in favour of `CallingConvention` payloads. The x86_64 backend is updated to use the stack alignment given in the calling convention (the LLVM backend was already updated in a previous commit). Resolves: #21209
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-15llvm: Fix ilp32e/lp64e and ilp32f/lp64f ABI selection for riscv.Alex Rønne Petersen
2024-10-05compiler: Don't require PIC for aarch64-linux-ohos.Alex Rønne Petersen
While Clang defaults to PIC for this target, it's not actually required.
2024-10-05compiler: Don't link to nonexistent libc libraries for ohos.Alex Rønne Petersen
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-04Adds new cpu architectures propeller1 and propeller2. (#21563)Felix Queißner
* Adds new cpu architectures propeller1 and propeller2. These cpu architectures allow targeting the Parallax Propeller 1 and Propeller 2, which are both very special microcontrollers with 512 registers and 8 cpu cores. Resolves #21559 * Adds std.elf.EM.PROPELLER and std.elf.EM.PROPELLER2 * Fixes missing switch prongs in src/codegen/llvm.zig * Fixes order in std.Target.Arch --------- Co-authored-by: Felix "xq" Queißner <git@random-projects.net>
2024-10-03Merge pull request #21570 from alexrp/windows-itaniumAlex Rønne Petersen
Initial port work for `*-windows-itanium` support.
2024-10-03Merge pull request #21504 from alexrp/android-softfpAlex Rønne Petersen
`std.Target`: Introduce `Abi.androideabi` to distinguish the soft float case.
2024-09-28Initial port work for `*-windows-itanium` support.Alex Rønne Petersen
https://llvm.org/docs/HowToBuildWindowsItaniumPrograms.html This is a weird middle ground between `*-windows-gnu` and `*-windows-msvc`. It uses the C++ ABI of the former while using the system libraries of the latter.
2024-09-26remove formatted panicsAndrew Kelley
implements #17969
2024-09-24std.Target: Introduce Abi.androideabi to distinguish the soft float case.Alex Rønne Petersen
Abi.android on its own is not enough to know whether soft float or hard float should be used. In the C world, androideabi is typically used for the soft float case, so let's go with that. Note that Android doesn't have a hard float ABI, so no androideabihf. Closes #21488.
2024-09-23std.Target: Remove Cpu.Arch.dxil and ObjectFormat.dxcontainer.Alex Rønne Petersen
See: https://devblogs.microsoft.com/directx/directx-adopting-spir-v Since we never hooked up the (experimental) DirectX LLVM backend, we've never actually supported targeting DXIL in Zig. With Microsoft moving away from DXIL, that seems very unlikely to change.
2024-09-10Compilation: Pass hard/soft float flags to Clang as appropriate.Alex Rønne Petersen
2024-09-05compiler: Force ELFv2 for powerpc64.Alex Rønne Petersen
LLD does not support ELFv1. By forcing ELFv2, we can at least build working binaries for triples like `powerpc64-linux-none`.
2024-09-01Rename usesLargePIC to picLevel and return the PIC levelantlilja
2024-08-28llvm: Set PIC level 1 for MIPS.Alex Rønne Petersen
For hysterical raisins, MIPS always uses 1, regardless of `-fpic` vs `-fPIC`.
2024-08-25sema: `resolve{Struct,Union}Inner` don't throw away SemasDavid Rubin
before this, calls to `resolveTypeFieldsStruct` (now renamed to the more correct `resolveStructFieldTypes`) would just throw away the sema that `resolveStructInner` created and create its own. There is no reason to do this, and we fix it to preserve the sema through it all.
2024-08-12all: Handle spirv in addition to spirv(32,64) where applicable.Alex Rønne Petersen
Some of this is arbitrary since spirv (as opposed to spirv32/spirv64) refers to the version with logical memory layout, i.e. no 'real' pointers. This change at least matches what clang does.
2024-08-11std.Target: Add goff and xcoff to ObjectFormat.Alex Rønne Petersen
Also improve the docs a bit, and handle driverkit and dxil in default().
2024-08-07Merge pull request #20969 from alexrp/llvm-unsup-targetsAndrew Kelley
`llvm`: Fix hasLlvmSupport() for dxil, spirv[32,64], and kalimba.
2024-08-07target: Fix hasLlvmSupport() for dxil, spirv[32,64], and kalimba.Alex Rønne Petersen
2024-08-02glibc: Change riscv32-linux-gnuilp32 target triple to riscv32-linux-gnu.Alex Rønne Petersen
This target triple was weird on multiple levels: * The `ilp32` ABI is the soft float ABI. This is not the main ABI we want to support on RISC-V; rather, we want `ilp32d`. * `gnuilp32` is a bespoke tag that was introduced in Zig. The rest of the world just uses `gnu` for RISC-V target triples. * `gnu_ilp32` is already the name of an ILP32 ABI used on AArch64. `gnuilp32` is too easy to confuse with this. * We don't use this convention for `riscv64-linux-gnu`. * Supporting all RISC-V ABIs with this convention will result in combinatorial explosion; see #20690.
2024-08-01std: dwarf namespace reorgAndrew Kelley
std.debug.Dwarf is the parsing/decoding logic. std.dwarf remains the unopinionated types and bits alone. If you look at this diff you can see a lot less redundancy in namespaces.
2024-07-30std.Target: Remove `sparcel` architecture tag.Alex Rønne Petersen
What is `sparcel`, you might ask? Good question! If you take a peek in the SPARC v8 manual, §2.2, it is quite explicit that SPARC v8 is a big-endian architecture. No little-endian or mixed-endian support to be found here. On the other hand, the SPARC v9 manual, in §3.2.1.2, states that it has support for mixed-endian operation, with big-endian mode being the default. Ok, so `sparcel` must just be referring to SPARC v9 running in little-endian mode, surely? Nope: * https://github.com/llvm/llvm-project/blob/40b4fd7a3e81d32b29364a1b15337bcf817659c0/llvm/lib/Target/Sparc/SparcTargetMachine.cpp#L226 * https://github.com/llvm/llvm-project/blob/40b4fd7a3e81d32b29364a1b15337bcf817659c0/llvm/lib/Target/Sparc/SparcTargetMachine.cpp#L104 So, `sparcel` in LLVM is referring to some sort of fantastical little-endian SPARC v8 architecture. I've scoured the internet and I can find absolutely no evidence that such a thing exists or has ever existed. In fact, I can find no evidence that a little-endian implementation of SPARC v9 ever existed, either. Or any SPARC version, actually! The support was added here: https://reviews.llvm.org/D8741 Notably, there is no mention whatsoever of what CPU this might be referring to, and no justification given for the "but some are little" comment added in the patch. My best guess is that this might have been some private exercise in creating a little-endian version of SPARC that never saw the light of day. Given that SPARC v8 explicitly doesn't support little-endian operation (let alone little-endian instruction encoding!), and no CPU is known to be implemented as such, I think it's very reasonable for us to just remove this support.
2024-07-30std.Target: Remove `spir`/`spir64` architecture tags.Alex Rønne Petersen
These were for very old OpenCL have been long abandoned in favor of SPIR-V. * https://github.com/KhronosGroup/SPIR * https://github.com/KhronosGroup/SPIR-Tools
2024-07-28std.Target.Cpu.Arch: Remove the `aarch64_32` tag.Alex Rønne Petersen
This is a misfeature that we inherited from LLVM: * https://reviews.llvm.org/D61259 * https://reviews.llvm.org/D61939 (`aarch64_32` and `arm64_32` are equivalent.) I truly have no idea why this triple passed review in LLVM. It is, to date, the *only* tag in the architecture component that is not, in fact, an architecture. In reality, it is just an ILP32 ABI for AArch64 (*not* AArch32). The triples that use `aarch64_32` look like `aarch64_32-apple-watchos`. Yes, that triple is exactly what you think; it has no ABI component. They really, seriously did this. Since only Apple could come up with silliness like this, it should come as no surprise that no one else uses `aarch64_32`. Later on, a GNU ILP32 ABI for AArch64 was developed, and support was added to LLVM: * https://reviews.llvm.org/D94143 * https://reviews.llvm.org/D104931 Here, sanity seems to have prevailed, and a triple using this ABI looks like `aarch64-linux-gnu_ilp32` as you would expect. As can be seen from the diffs in this commit, there was plenty of confusion throughout the Zig codebase about what exactly `aarch64_32` was. So let's just remove it. In its place, we'll use `aarch64-watchos-ilp32`, `aarch64-linux-gnuilp32`, and so on. We'll then translate these appropriately when talking to LLVM. Hence, this commit adds the `ilp32` ABI tag (we already have `gnuilp32`).
2024-07-21std.Target: Remove the `tce`/`tcele` arch tags.Alex Rønne Petersen
There is no obvious reason why this would be relevant for Zig to target. I rather question the value of LLVM even having target triple code for this, too. See: https://blog.llvm.org/2010/06/tce-project-co-design-of-application.html See: https://github.com/cpc/llvmtce
2024-07-21std.Target: Remove the `shave` arch tag.Alex Rønne Petersen
This was added as an architecture to LLVM's target triple parser and the Clang driver in 2015. No backend ever materialized as far as I can see (same for GCC). In 2016, other code referring to it started using "Myriad" instead. Ultimately, all code related to it that isn't in the target triple parser was removed. It seems to be a real product, just... literally no one seems to know anything about the ISA. I figure after almost a decade with no public ISA documentation to speak of, and no LLVM backend to reference, it's probably safe to assume that we're not going to learn much about this ISA, making it useless for Zig. See: https://github.com/llvm/llvm-project/commit/1b5767f72b5a037ca8f1802d737de97f8d92263d See: https://github.com/llvm/llvm-project/commit/84a7564b28360843ee9afec5d3823c89623eb6a5 See: https://github.com/llvm/llvm-project/commit/8cfe9d8f2ad3a52ba7fd5841d3939aa810536e16
2024-07-21std.Target: Remove `hsail`/`hsail64` arch tags.Alex Rønne Petersen
This seems to just be dead. See: https://github.com/search?q=repo%3Allvm%2Fllvm-project%20hsail&type=code See: https://github.com/HSAFoundation/HSAIL-Tools/commits/master
2024-07-21std.Target: Remove `amdil`/`amdil64` arch tags.Alex Rønne Petersen
This is really obscure and no one is 100% sure what it is. It seems to be old and unused. My suspicion is that it's just an old term for "AMDGPU" before it was upstreamed to LLVM. See: https://github.com/search?q=repo%3Allvm%2Fllvm-project+amdil&type=code
2024-07-21std.Target: Remove the `r600` arch tag.Alex Rønne Petersen
These are quite old GPUs, and it is unlikely that Zig will ever be able to target them. See: https://en.wikipedia.org/wiki/Radeon_HD_2000_series
2024-07-21std.Target: Remove the `renderscript32`/`renderscript64` arch tags.Alex Rønne Petersen
It's dead: https://developer.android.com/guide/topics/renderscript/migrate
2024-07-20std.Target: Remove `nacl` OS specifier and `le32`/`le64` arch specifiers.Alex Rønne Petersen
Native Client is dead. https://developer.chrome.com/docs/native-client
2024-07-16InternPool: enable separate codegen/linking threadJacob Young
Let's see what happens :)
2024-07-08Compilation: put supported codegen backends on a separate threadJacob Young
(There are no supported backends.)
2024-07-04compiler: type.zig -> Type.zigmlugg
2024-06-22rename src/Module.zig to src/Zcu.zigAndrew Kelley
This patch is a pure rename plus only changing the file path in `@import` sites, so it is expected to not create version control conflicts, even when rebasing.
2024-06-21Closes #20355: Enables dynamic linking for `.os_tag == .other` againFelix "xq" Queißner