aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Target.zig
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-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-02std.Target: Rename amdgpu module to amdgcn.Alex Rønne Petersen
This was an inconsistency left over from c825b567b26c475e058e074e5d22af006854fab6.
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: Pick arm_aapcs16_vfp for arm-watchos-* in cCallingConvention().Alex Rønne Petersen
This is a legacy target, but we should still get it right.
2024-11-02Merge pull request #21617 from alexrp/target-dyld-stuffAlex Rønne Petersen
Improve the `DynamicLinker` API and fix `detectAbiAndDynamicLinker()` for non-Linux/Hurd ELF hosts
2024-11-02Merge pull request #21729 from alexrp/target-cpu-baselineAlex Rønne Petersen
`std.Target.Cpu.Model`: Further refinements to `generic()` and `baseline()`
2024-11-01std.Target: Add support for specifying Android API level.Alex Rønne Petersen
2024-11-01std.Target: Add semver min/max versions for a bunch of OSs.Alex Rønne Petersen
2024-11-01std.Target: Update known OS max versions.Alex Rønne Petersen
2024-11-01std.Target: Remove arch-specific handling for macos in ↵Alex Rønne Petersen
Os.VersionRange.default(). The minimum is now the same for both aarch64 and x86_64.
2024-11-01std.Target: Sort some OS switches according to the Os enum.Alex Rønne Petersen
2024-11-01Merge pull request #21861 from alichraghi/masterRobin Voetter
spirv: push constants and small fixes
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-26std.Target: Make DynamicLinker.standard() much stricter.Alex Rønne Petersen
Its semantics are now documented in terms of DynamicLinker.kind(os.tag). The idea here is two-fold: * The term "standard" actually means something; we shouldn't return a valid dynamic linker path for a triple for which it hasn't *actually* been standardized. That's just incorrect. For example, previously, this function would happily return a path for x86_64-linux-androideabi, csky-macos-gnu, or aarch64-hurd-msvc, and other such obvious nonsense. * Callers that use the return value from this function to do host probing (such as std.zig.system.detectAbiAndDynamicLinker()) can now do so with greater confidence because DynamicLinker.standard() will eagerly reject nonsensical target triples.
2024-10-26std.Target: Remove hasDynamicLinker() in favor of DynamicLinker.kind().Alex Rønne Petersen
hasDynamicLinker() was just kind of lying in the case of Darwin platforms for the benefit of std.zig.system.detectAbiAndDynamicLinker(). A better name would have been hasElfDynamicLinker() or something. It also got the answer wrong for a bunch of platforms that don't actually use ELF. Anyway, this was clearly the wrong layer to do this at, so remove this function and instead use DynamicLinker.kind() + an isDarwin() check in detectAbiAndDynamicLinker().
2024-10-26std.Target: Implement DynamicLinker.kind() function.Alex Rønne Petersen
This helps callers of DynamicLinker.standard() make informed decisions about the usefulness of the returned value.
2024-10-26std.Target: Pick better baseline CPU models for darwin and ps4/ps5 on x86_64.Alex Rønne Petersen
These are sourced from getX86TargetCPU() in Clang.
2024-10-26std.Target: Use explicit baseline CPU models for bpf, m68k, msp430, and xcore.Alex Rønne Petersen
This makes no difference presently, but if LLVM ever starts modeling features for these, we would not get them by default for our baseline if we use the generic model.
2024-10-26std.Target: Use mips32r2/mips64r2 as the baseline CPU models for mips/mips64.Alex Rønne Petersen
This matches Clang's defaults. That also means these CPU models tend to get more testing, so they're a safer baseline choice. Anecdotally, the oldest MIPS hardware that I've seen anyone run Zig on was also r2.
2024-10-26std.Target: Use sm_52 as the baseline CPU model for nvptx.Alex Rønne Petersen
This matches Clang's default.
2024-10-26std.Target: Use gfx906 as the baseline CPU model for amdgcn.Alex Rønne Petersen
This matches Clang's default.
2024-10-26std.Target: Use gfx600 as the generic CPU model for amdgcn.Alex Rønne Petersen
This is the first model that was actually in the GCN family.
2024-10-26std.Target: Use ppc64 as the generic CPU model for powerpc64le.Alex Rønne Petersen
ppc64le remains the baseline CPU model. Note that there's nothing about little endian, 64-bit PowerPC that requires the features in the ppc64le model; the reason it exists is that 64-bit PowerPC wasn't really used in little endian mode prior to those features being commonplace. That makes the ppc64le model a good baseline model, but not the right choice for a generic model.
2024-10-26std.Target: Use avr1 as the generic CPU model for avr.Alex Rønne Petersen
avr2 remains the baseline CPU model.
2024-10-26std.Target: Use v11 as the baseline CPU model for lanai.Alex Rønne Petersen
2024-10-26std.Target: Use ck810 as the baseline CPU model for csky.Alex Rønne Petersen
2024-10-26std.Target: Add doc comments for Cpu.Arch.generic() and baseline().Alex Rønne Petersen
2024-10-19std.Target: correct C callconv on hardfloat ARMmlugg
2024-10-19std.Target: rename `defaultCCallingConvention` and `Cpu.Arch.fromCallconv`mlugg
2024-10-19test: update for `CallingConvention` changesmlugg
This also includes some compiler and std changes to correct error messages which weren't properly updated before.
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-18std.Target: Make Abi.default() more smarter.Alex Rønne Petersen
This builds on 221bd829bcb4318be941a93029b9c12d8317845d with more research I did for test/llvm_targets.zig.
2024-10-16std.Target: Rename OS version range functions to drop the "get" prefix.Alex Rønne Petersen
2024-10-16std.Target: Remove isBpfFreestanding().Alex Rønne Petersen
The only use of this has nothing to do with the OS tag.
2024-10-16std.Target: Move isLib{C,Cxx}LibName() to std.zig.target.Alex Rønne Petersen
These are really answering questions about the Zig compiler's capacity to provide a libc/libc++ implementation. As such, std.zig.target seems like a more fitting place for these.
2024-10-16std.Target: Only consider libxnet to be a libc library name for musl.Alex Rønne Petersen
glibc has never had this.
2024-10-16std.Target: Ignore case for all Darwin platforms in isLibCLibName().Alex Rønne Petersen
Matches isLibCxxLibName() behavior.
2024-10-16std.Target: Rename is_lib{c,cxx}_lib_name() to isLib{C,Cxx}LibName().Alex Rønne Petersen
2024-10-16std.Target: Move the elfiamcu check under the x86 prong in toElfMachine().Alex Rønne Petersen
2024-10-16Merge pull request #21715 from alexrp/loongarch-portingAlex Rønne Petersen
Some miscellaneous LoongArch port work
2024-10-16std.Target: Fix loongarch32 handling in C type alignment calculation.Alex Rønne Petersen
2024-10-16std.Target: Make Cpu.baseline() pick a better CPU for Apple targets.Alex Rønne Petersen
2024-10-16std.Target: Change Cpu.baseline() to also be able to take OS into consideration.Alex Rønne Petersen
2024-10-07Merge pull request #21611 from alexrp/target-abi-defaultAlex Rønne Petersen
`std.Target`: Rewrite `Abi.default()` to have better defaults across the board.
2024-10-07Merge pull request #21614 from alexrp/target-avr-alignAlex Rønne Petersen
`std.Target`: Fix `cTypePreferredAlignment()` to always return 1 for avr.
2024-10-06std.Target: Rewrite Abi.default() to have better defaults across the board.Alex Rønne Petersen