aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGPUCode <[email protected]>2022-11-20 13:01:05 +0200
committerGPUCode <[email protected]>2023-05-09 22:51:50 +0300
commit18c37509fa44b8c6e4543b5d429fbae5d8fe4e5d (patch)
tree2f7269d62d5cc3c8bb0b82de587e3fb43ce3a1fb
parentd75e3198d0c6a17c3d798ad5daf3133a52579f93 (diff)
downloadsirit-18c37509fa44b8c6e4543b5d429fbae5d8fe4e5d.tar.gz
sirit-18c37509fa44b8c6e4543b5d429fbae5d8fe4e5d.zip
Support variadic arguments for OpPhi
-rw-r--r--include/sirit/sirit.h6
-rw-r--r--src/stream.h2
2 files changed, 7 insertions, 1 deletions
diff --git a/include/sirit/sirit.h b/include/sirit/sirit.h
index 0a9fce9..dc3c567 100644
--- a/include/sirit/sirit.h
+++ b/include/sirit/sirit.h
@@ -256,6 +256,12 @@ public:
*/
Id OpPhi(Id result_type, std::span<const Id> operands);
+ template <typename... Ts>
+ requires(...&& std::is_convertible_v<Ts, Id>) Id
+ OpPhi(Id result_type, Ts&&... operands) {
+ return OpPhi(result_type, std::span<const Id>({operands...}));
+ }
+
/**
* The SSA phi function. This instruction will be revisited when patching phi nodes.
*
diff --git a/src/stream.h b/src/stream.h
index 42e2041..bf9e48a 100644
--- a/src/stream.h
+++ b/src/stream.h
@@ -7,11 +7,11 @@
#pragma once
#include <bit>
-#include <span>
#include <cassert>
#include <concepts>
#include <cstddef>
#include <functional>
+#include <span>
#include <string_view>
#include <unordered_map>
#include <variant>