Add OpUnreachable

This commit is contained in:
ReinUsesLisp 2021-03-29 16:10:15 -03:00
parent 84fab90024
commit f1cccfd0f3
2 changed files with 8 additions and 0 deletions

View file

@ -292,6 +292,9 @@ public:
/// Returns with no value from a function with void return type.
void OpReturn();
/// Behavior is undefined if this instruction is executed.
void OpUnreachable();
/// Return a value from a function.
Id OpReturnValue(Id value);

View file

@ -67,6 +67,11 @@ void Module::OpReturn() {
*code << spv::Op::OpReturn << EndOp{};
}
void Module::OpUnreachable() {
code->Reserve(1);
*code << spv::Op::OpUnreachable << EndOp{};
}
Id Module::OpReturnValue(Id value) {
code->Reserve(2);
return *code << spv::Op::OpReturnValue << value << EndOp{};