Fixes #35769
Fixes #31925
Fixes #31521
Passing behavior tests increased from %45 to %50
-
SPIR-V backend used to be an exception along with LLVM because it was designed to generate everything in one thread.
Now it can be parallelized but this comes with some more work during linkage, because a valid SPIR-V object must not have duplicate types.
So the prune_unused and dedup_types ISels are back. There are no performance improvements or regressions and
I'm not focusing on that anytime soon as it isn't a priority. The main motivation for this change was the bugs and workarounds
rooted in in Sema/Codegen scheduling and lazy analyzing.
-
Multi-object linking! We can now do things like:
// a.zigexternfnadd(a:f32,b:f32)f32;exportfnmain()callconv(.kernel)void{_=add(1,2);}
// b.zigexportfnadd(a:f32,b:f32)f32{returna+b;}
zig build-obj b.zig -target spirv32-vulkan
zig build-exe a.zig b.spv -target spirv32-vulkan
# or
zig build-obj a.zig -target spirv32-vulkan
zig build-obj b.zig -target spirv32-vulkan
zig build-exe a.spv b.spv -target spirv32-vulkan
Note that this is a breaking change.
If you have been using build-obj or b.addObject(...) to produce the final program,
change that to build-exe or b.addExecutable(...) because object mode emits OpCapability Linkage
which is forbidden by Vulkan, for example.
-
Composite/Big ints constants + some operations
-
Ranged Switches
-
Packed Struct field pointer access
-
Flat decoration for @extern builtin:
@extern(*addrspace(.input)constu32,.{.name="flags",.decoration=.{.flat=2}});
-
Various fixes and enhancements are also included from @quint's PRs (#35174, #35201, #35262, #35198)
Sorry for the messy commit history!
Fixes #35769
Fixes #31925
Fixes #31521
Passing behavior tests increased from %45 to %50
- SPIR-V backend used to be an exception along with LLVM because it was designed to generate everything in one thread.
Now it can be parallelized but this comes with some more work during linkage, because a valid SPIR-V object must not have duplicate types.
So the `prune_unused` and `dedup_types` **ISel**s are back. There are no performance improvements or regressions and
I'm not focusing on that anytime soon as it isn't a priority. The main motivation for this change was the bugs and workarounds
rooted in in Sema/Codegen scheduling and lazy analyzing.
- Multi-object linking! We can now do things like:
```zig
// a.zig
extern fn add(a: f32, b: f32) f32;
export fn main() callconv(.kernel) void {
_ = add(1, 2);
}
```
```zig
// b.zig
export fn add(a: f32, b: f32) f32 {
return a + b;
}
```
```sh
zig build-obj b.zig -target spirv32-vulkan
zig build-exe a.zig b.spv -target spirv32-vulkan
# or
zig build-obj a.zig -target spirv32-vulkan
zig build-obj b.zig -target spirv32-vulkan
zig build-exe a.spv b.spv -target spirv32-vulkan
```
Note that this is a breaking change.
If you have been using build-obj or `b.addObject(...)` to produce the final program,
change that to build-exe or `b.addExecutable(...)` because object mode emits `OpCapability Linkage`
which is forbidden by Vulkan, for example.
- Composite/Big ints constants + some operations
- Ranged Switches
- Packed Struct field pointer access
- Flat decoration for `@extern` builtin:
```zig
@extern(*addrspace(.input) const u32, .{ .name = "flags", .decoration = .{ .flat = 2 } });
```
- Various fixes and enhancements are also included from @quint's PRs (#35174, #35201, #35262, #35198)
Sorry for the messy commit history!