0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
zig/lib/std/Target.zig

3506 lines
108 KiB

2023-12-04 15:26:57 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 15:26:57 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2025-08-29 00:18:12 +02:00
2025-08-20 22:53:36 +02:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2025-08-29 00:18:12 +02:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2025-08-20 22:53:36 +02:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2025-02-22 17:03:24 -08:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2025-08-29 00:18:12 +02:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2025-08-20 22:53:36 +02:00
2025-08-20 22:53:36 +02:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2025-08-20 22:53:36 +02:00
2025-08-29 00:18:12 +02:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2025-06-17 09:21:33 +03:30
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2025-06-17 09:21:33 +03:30
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
std.Target: Remove `sparcel` architecture tag. 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-30 02:31:25 +02:00
2023-12-04 12:14:58 -07:00
2025-06-17 09:21:33 +03:30
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
compiler: implement analysis-local comptime-mutable memory This commit changes how we represent comptime-mutable memory (`comptime var`) in the compiler in order to implement the intended behavior that references to such memory can only exist at comptime. It does *not* clean up the representation of mutable values, improve the representation of comptime-known pointers, or fix the many bugs in the comptime pointer access code. These will be future enhancements. Comptime memory lives for the duration of a single Sema, and is not permitted to escape that one analysis, either by becoming runtime-known or by becoming comptime-known to other analyses. These restrictions mean that we can represent comptime allocations not via Decl, but with state local to Sema - specifically, the new `Sema.comptime_allocs` field. All comptime-mutable allocations, as well as any comptime-known const allocs containing references to such memory, live in here. This allows for relatively fast checking of whether a value references any comptime-mtuable memory, since we need only traverse values up to pointers: pointers to Decls can never reference comptime-mutable memory, and pointers into `Sema.comptime_allocs` always do. This change exposed some faulty pointer access logic in `Value.zig`. I've fixed the important cases, but there are some TODOs I've put in which are definitely possible to hit with sufficiently esoteric code. I plan to resolve these by auditing all direct accesses to pointers (most of them ought to use Sema to perform the pointer access!), but for now this is sufficient for all realistic code and to get tests passing. This change eliminates `Zcu.tmp_hack_arena`, instead using the Sema arena for comptime memory mutations, which is possible since comptime memory is now local to the current Sema. This change should allow `Decl` to store only an `InternPool.Index` rather than a full-blown `ty: Type, val: Value`. This commit does not perform this refactor.
2024-03-22 23:39:44 +00:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2025-07-07 11:38:15 -07:00
2025-06-17 09:21:33 +03:30
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2025-08-20 22:53:36 +02:00
2025-08-20 22:53:36 +02:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2025-08-29 00:18:12 +02:00
2025-08-20 22:53:36 +02:00
2023-12-04 12:14:58 -07:00
2023-12-04 15:26:57 -07:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 15:26:57 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2025-08-29 00:18:12 +02:00
2025-08-20 22:53:36 +02:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2025-08-20 22:53:36 +02:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2024-04-14 15:24:01 -04:00
2025-08-29 00:18:12 +02:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 15:26:57 -07:00
2023-12-04 15:26:57 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 15:26:57 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 15:26:57 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 15:26:57 -07:00
2023-12-04 15:26:57 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2024-02-01 15:48:51 +03:30
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2025-08-20 22:53:36 +02:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2025-08-29 00:18:12 +02:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00
2024-04-14 15:24:01 -04:00
2023-12-04 12:14:58 -07:00
2025-06-17 09:21:33 +03:30
2023-12-04 12:14:58 -07:00
2023-12-04 12:14:58 -07:00