| ... | @@ -239,12 +239,17 @@ fn todo(self: *Assembler, comptime fmt: []const u8, args: anytype) Error { | ... | @@ -239,12 +239,17 @@ fn todo(self: *Assembler, comptime fmt: []const u8, args: anytype) Error { |
| 239 | /// If this function returns `error.AssembleFail`, an explanatory | 239 | /// If this function returns `error.AssembleFail`, an explanatory |
| 240 | /// error message has already been emitted into `self.errors`. | 240 | /// error message has already been emitted into `self.errors`. |
| 241 | fn processInstruction(self: *Assembler) !void { | 241 | fn processInstruction(self: *Assembler) !void { |
| 242 | const result = switch (self.inst.opcode.class()) { | 242 | const result = switch (self.inst.opcode) { |
| 243 | .TypeDeclaration => try self.processTypeInstruction(), | 243 | .OpEntryPoint => { |
| 244 | else => if (try self.processGenericInstruction()) |result| | 244 | return self.fail(0, "cannot export entry points via OpEntryPoint, export the kernel using callconv(.Kernel)", .{}); |
| 245 | result | 245 | }, |
| 246 | else | 246 | else => switch (self.inst.opcode.class()) { |
| 247 | return, | 247 | .TypeDeclaration => try self.processTypeInstruction(), |
| | 248 | else => if (try self.processGenericInstruction()) |result| |
| | 249 | result |
| | 250 | else |
| | 251 | return, |
| | 252 | }, |
| 248 | }; | 253 | }; |
| 249 | | 254 | |
| 250 | const result_ref = self.inst.result().?; | 255 | const result_ref = self.inst.result().?; |
| ... | @@ -435,8 +440,7 @@ fn processGenericInstruction(self: *Assembler) !?AsmValue { | ... | @@ -435,8 +440,7 @@ fn processGenericInstruction(self: *Assembler) !?AsmValue { |
| 435 | .Annotation => &self.spv.sections.annotations, | 440 | .Annotation => &self.spv.sections.annotations, |
| 436 | .TypeDeclaration => unreachable, // Handled elsewhere. | 441 | .TypeDeclaration => unreachable, // Handled elsewhere. |
| 437 | else => switch (self.inst.opcode) { | 442 | else => switch (self.inst.opcode) { |
| 438 | // TODO: This should emit a proper entry point. | 443 | .OpEntryPoint => unreachable, |
| 439 | .OpEntryPoint => unreachable, // &self.spv.sections.entry_points, | | |
| 440 | .OpExecutionMode, .OpExecutionModeId => &self.spv.sections.execution_modes, | 444 | .OpExecutionMode, .OpExecutionModeId => &self.spv.sections.execution_modes, |
| 441 | .OpVariable => switch (@intToEnum(spec.StorageClass, operands[2].value)) { | 445 | .OpVariable => switch (@intToEnum(spec.StorageClass, operands[2].value)) { |
| 442 | .Function => &self.func.prologue, | 446 | .Function => &self.func.prologue, |