This allows `@TypeOf(@as([*c]T, null).*.x)` to (continue to) work.
In the long term these are probably not the semantics we want, unwrapping
a comptime-known `null` pointer should always result in `unreachable`.
Also adds missing runtime safety checks for loading null C pointers.
- Emitting `OpCapability` and `OpExtension` from assembly is no longer allowed (tbh it never was because we silently ignored them).
They now `fail` with a message pointing users at `-mcpu`.
- `tools/gen_spirv_spec.zig` now also emits `Extension` and the `Capability.dependencies()`.
Also To keep the feature set a reasonable size, the generator filters to an allowlist of `KHR` and `EXT` entries.
We can decide which vendors to allow later if a use-case is found.
- `tools/update_cpu_features.zig` now uses the generated `spec.zig` and emits a feature for every
capability and extension, with the capability's `.deps` populated from `Capability.dependencies()`.
- `Module.finalize`, `Module.entryPoints`, `Module.addCapability`, `Module.addExtension`
and `sections.capabilities`/`sections.extensions` are deleted.
- Linker now verifies that an `.spv` object declares the `Linkage` capability
These ILP32 ABIs are now about as well supported as their LP64 counterparts.
mips64(el)-linux-muslabin32 with dynamic linking is still marked as extra, in
line with other dynamically-linked musl targets.
It's a 32-bit pointer and passed on the stack; the upper 32 bits of the stack
slot are garbage. This means that we ask the kernel to write to some random
64-bit location, which it will just silently fail to do (the process is in x32
mode; nothing can be mapped up there), and consequently, the thread's child_tid
field will never be populated, causing a later join() to hang.
mq test-cases
mq compile obj llvm_targets Debug mipsel-psx-eabi failure
error: warning: MIPS-I support is experimental
This can be added back once this LLVM warning is removed.
LLVM requires frontends to lower i128 to <2 x i64> in IR to get the correct
__int128 ABI on x86_64-windows; this is what Clang does. I'm guessing our LLVM
backend didn't do this in the past, which made these hacks necessary. But it
does do so now, so just get rid of this stuff.
Adds target info for the PSX. Builds fine with the following:
```zig
const target = b.resolveTargetQuery(.{
.os_tag = .psx,
.cpu_arch = .mipsel,
});
```
the only "problem" being that it spits out an error from LLVM even
though generating an object file succeeds:
```sh
❯ zig build
install
└─ install generated to main.o
└─ compile obj obj Debug mipsel-psx failure
error: warning: MIPS-I support is experimental
```
composite integers (wider than usize) are represented in as `[N]u32` arrays.
however, no operations were implemented before.
following operations are implemented:
- bitwise (and, or, xor, not)
- comparison (eq/neq)
- add/sub/mul/shl/shr
- `@abs`, `@intCast`
this removes 36 SPIR-V behavior test skips.
also fixed `derivePtr` to use `OpAccessChain` instead of `OpBitcast`
for array pointer casts (e.g. `*[100]u8` to `*u8`) in logical addressing
mode, where pointer bitcasts are not valid.
Eleven arithmetic/comparison/reduce paths panicked on big-int
operands. Replace each with cg.todo so unsupported widths surface
as compile errors instead of crashes.
resolveType called Module.intType for any integer width, which
asserted backing_bits <= 64 for big-int types. Reject these widths
in resolveType with a fail() so users get a diagnostic instead of
a compiler panic.
Exposes OpControlBarrier and OpMemoryBarrier so compute kernels do not
need to hand-roll inline asm for workgroup synchronisation. Scope and
MemorySemantics mirror the SPIRV-Headers unified1 grammar bit-for-bit;
workgroupBarrier() matches the semantics of GLSL barrier().
Co-authored-by: Quint Daenen <quint@daenen.email>
The SPIR-V backend previously ran codegen single-threaded in the linker thread.
Now each codegen job creates an `Mir` like other self-hosted backends.
Other changes:
- Bring back `dedup_types.zig` and `prune_unused.zig` **ISel**s which were originaly
removed because codegen was single-threaded at that time and therefor had no use
- Clean up `BinaryModule.zig`
- Remove `checkLogicalPtrOperation` from `elemPtrOneLayerOnly` in `Sema.zig`.
Element access uses `OpAccessChain`, which works on all logical address spaces
without `VariablePointers`. the check is only needed for pointer arithmetic.
Right now, when an undefined tuple value is passed to zirArrayCat, it
will call `elemValue`, which will incorrectly try to produce a undef
value of the child type (of which there is none) and then panics.
This adds a check for an undef value first to produce an undef elem
value of the correct resolved type.
If one overrides `SelfInfo` in their `root.debug`, it is no longer possible
to refer to the default `SelfInfo` that the std.debug uses.
This allows the developer to still refer to the std's default without
copying the SelfInfo zig files to their project.