Reactor: Add Traits for Reference types
ReactorType<Reference<T>> will now resolve to T.
This also enables support of ValueOf(ReactorType<Reference<T>>).
Required for Coroutines.
Bug: b/131672705
Change-Id: Icbc95488f5299b8d70e72142e44af9ed1af598d1
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/30569
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Reactor/Reactor.hpp b/src/Reactor/Reactor.hpp
index d201904..c151ffa 100644
--- a/src/Reactor/Reactor.hpp
+++ b/src/Reactor/Reactor.hpp
@@ -161,6 +161,8 @@
class Reference
{
public:
+ using reference_underlying_type = T;
+
explicit Reference(Value *pointer, int alignment = 1);
RValue<T> operator=(RValue<T> rhs) const;
@@ -2402,7 +2404,8 @@
void branch(RValue<Bool> cmp, BasicBlock *bodyBB, BasicBlock *endBB);
- // ValueOf returns a rr::Value* for the given C-type, RValue<T>, or LValue<T>.
+ // ValueOf returns a rr::Value* for the given C-type, RValue<T>, LValue<T>
+ // or Reference<T>.
template <typename T>
inline Value* ValueOf(const T &v)
{