| ... | @@ -586,7 +586,23 @@ pub const DeclGen = struct { | ... | @@ -586,7 +586,23 @@ pub const DeclGen = struct { |
| 586 | try self.genDeclRef(decl_result_id, decl_index); | 586 | try self.genDeclRef(decl_result_id, decl_index); |
| 587 | try self.variable(.global, result_id, result_ty_ref, decl_result_id); | 587 | try self.variable(.global, result_id, result_ty_ref, decl_result_id); |
| 588 | }, | 588 | }, |
| 589 | else => return self.todo("constant pointer of value type {s}", .{@tagName(val.tag())}), | 589 | .slice => { |
| | 590 | const slice = val.castTag(.slice).?.data; |
| | 591 | var buf: Type.SlicePtrFieldTypeBuffer = undefined; |
| | 592 | |
| | 593 | const ptr_id = self.spv.allocId(); |
| | 594 | try self.genConstant(ptr_id, ty.slicePtrFieldType(&buf), slice.ptr, .indirect); |
| | 595 | const len_id = self.spv.allocId(); |
| | 596 | try self.genConstant(len_id, Type.usize, slice.len, .indirect); |
| | 597 | |
| | 598 | const constituents = [_]IdRef{ ptr_id, len_id }; |
| | 599 | try section.emit(self.spv.gpa, .OpSpecConstantComposite, .{ |
| | 600 | .id_result_type = result_ty_id, |
| | 601 | .id_result = result_id, |
| | 602 | .constituents = &constituents, |
| | 603 | }); |
| | 604 | }, |
| | 605 | else => return self.todo("pointer of value type {s}", .{@tagName(val.tag())}), |
| 590 | }, | 606 | }, |
| 591 | .Fn => switch (repr) { | 607 | .Fn => switch (repr) { |
| 592 | .direct => unreachable, | 608 | .direct => unreachable, |