diff options
| author | Robin Voetter <robin@voetter.nl> | 2023-05-20 18:02:30 +0200 |
|---|---|---|
| committer | Robin Voetter <robin@voetter.nl> | 2023-05-20 18:02:30 +0200 |
| commit | c92cc5798f0ea72ab1c77ae12c6124e5ab090730 (patch) | |
| tree | d94372b5d0575be57dde8bfb072d4fd519951490 /src/codegen/spirv/Module.zig | |
| parent | 65157d30ab90de01da583dd97ee2409d8ad8aeb0 (diff) | |
| download | zig-c92cc5798f0ea72ab1c77ae12c6124e5ab090730.tar.gz zig-c92cc5798f0ea72ab1c77ae12c6124e5ab090730.zip | |
spirv: make constant handle float, errorset, errorunion
This is in preparation of removing indirect lowering again. Also
modifies constant() to accept a repr so that both direct as well
as indirect representations can be generated. Indirect is not yet
used, but will be used for globals.
Diffstat (limited to 'src/codegen/spirv/Module.zig')
| -rw-r--r-- | src/codegen/spirv/Module.zig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/codegen/spirv/Module.zig b/src/codegen/spirv/Module.zig index 4bd6c834ce..5e7e6508fa 100644 --- a/src/codegen/spirv/Module.zig +++ b/src/codegen/spirv/Module.zig @@ -774,6 +774,16 @@ pub fn changePtrStorageClass(self: *Module, ptr_ty_ref: Type.Ref, new_storage_cl return try self.resolveType(Type.initPayload(&payload.base)); } +pub fn constComposite(self: *Module, ty_ref: Type.Ref, members: []const IdRef) !IdRef { + const result_id = self.allocId(); + try self.sections.types_globals_constants.emit(self.gpa, .OpSpecConstantComposite, .{ + .id_result_type = self.typeId(ty_ref), + .id_result = result_id, + .constituents = members, + }); + return result_id; +} + pub fn emitConstant( self: *Module, ty_id: IdRef, |
