mirror of
https://github.com/yuzu-emu/sirit.git
synced 2024-11-21 23:55:37 +01:00
Add Phi support
This commit is contained in:
parent
1f7b70730d
commit
c374bfd9fd
@ -232,6 +232,12 @@ public:
|
||||
|
||||
// Flow
|
||||
|
||||
/**
|
||||
* The SSA phi function.
|
||||
* @param operands An immutable span of variable, parent block pairs
|
||||
*/
|
||||
Id OpPhi(Id result_type, std::span<const Id> operands);
|
||||
|
||||
/// Declare a structured loop.
|
||||
Id OpLoopMerge(Id merge_block, Id continue_target, spv::LoopControlMask loop_control,
|
||||
std::span<const Id> literals = {});
|
||||
|
@ -12,6 +12,12 @@
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
Id Module::OpPhi(Id result_type, std::span<const Id> operands) {
|
||||
assert(operands.size() % 2 == 0);
|
||||
code->Reserve(3 + operands.size());
|
||||
return *code << OpId{spv::Op::OpPhi, result_type} << operands << EndOp{};
|
||||
}
|
||||
|
||||
Id Module::OpLoopMerge(Id merge_block, Id continue_target, spv::LoopControlMask loop_control,
|
||||
std::span<const Id> literals) {
|
||||
code->Reserve(4 + literals.size());
|
||||
|
Loading…
Reference in New Issue
Block a user