mirror of
https://github.com/yuzu-emu/sirit
synced 2024-11-22 22:24:00 +00:00
Add OpBranch
This commit is contained in:
parent
48ddaf4913
commit
cdeeb9127c
2 changed files with 9 additions and 0 deletions
|
@ -164,6 +164,9 @@ public:
|
||||||
/// The block label instruction: Any reference to a block is through this ref.
|
/// The block label instruction: Any reference to a block is through this ref.
|
||||||
Ref Label();
|
Ref Label();
|
||||||
|
|
||||||
|
/// Unconditional jump to label.
|
||||||
|
Ref Branch(Ref target_label);
|
||||||
|
|
||||||
/// Returns with no value from a function with void return type.
|
/// Returns with no value from a function with void return type.
|
||||||
Ref Return();
|
Ref Return();
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,12 @@ Ref Module::Label() {
|
||||||
return AddCode(spv::Op::OpLabel, bound++);
|
return AddCode(spv::Op::OpLabel, bound++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ref Module::Branch(Ref target_label) {
|
||||||
|
Op* op{new Op(spv::Op::OpBranch)};
|
||||||
|
op->Add(target_label);
|
||||||
|
return AddCode(op);
|
||||||
|
}
|
||||||
|
|
||||||
Ref Module::Return() {
|
Ref Module::Return() {
|
||||||
return AddCode(spv::Op::OpReturn);
|
return AddCode(spv::Op::OpReturn);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue