mirror of
https://git.suyu.dev/suyu/sirit.git
synced 2024-12-23 04:32:04 +00:00
Add OpLoopMerge
This commit is contained in:
parent
2bafba1a17
commit
136dcf88a7
2 changed files with 14 additions and 0 deletions
|
@ -154,6 +154,10 @@ public:
|
||||||
|
|
||||||
// Flow
|
// Flow
|
||||||
|
|
||||||
|
/// Declare a structured loop.
|
||||||
|
Ref LoopMerge(Ref merge_block, Ref continue_target, spv::LoopControlMask loop_control,
|
||||||
|
const std::vector<Ref>& literals = {});
|
||||||
|
|
||||||
/// 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();
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,16 @@
|
||||||
|
|
||||||
namespace Sirit {
|
namespace Sirit {
|
||||||
|
|
||||||
|
Ref Module::LoopMerge(Ref merge_block, Ref continue_target, spv::LoopControlMask loop_control,
|
||||||
|
const std::vector<Ref>& literals) {
|
||||||
|
Op* op{new Op(spv::Op::OpLoopMerge)};
|
||||||
|
op->Add(merge_block);
|
||||||
|
op->Add(continue_target);
|
||||||
|
AddEnum(op, loop_control);
|
||||||
|
op->Add(literals);
|
||||||
|
return AddCode(op);
|
||||||
|
}
|
||||||
|
|
||||||
Ref Module::Label() {
|
Ref Module::Label() {
|
||||||
return AddCode(spv::Op::OpLabel, bound++);
|
return AddCode(spv::Op::OpLabel, bound++);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue