Implement Pointer<> support for Subzero.
Bug swiftshader:11
Change-Id: I794ef54a7c2ecde71ee6344c63955d2f838ff189
Reviewed-on: https://swiftshader-review.googlesource.com/7331
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/Reactor/LLVMReactor.cpp b/src/Reactor/LLVMReactor.cpp
index 4069523..47518ec 100644
--- a/src/Reactor/LLVMReactor.cpp
+++ b/src/Reactor/LLVMReactor.cpp
@@ -448,8 +448,9 @@
return V(::builder->CreateNot(v));
}
- Value *Nucleus::createLoad(Value *ptr, bool isVolatile, unsigned int align)
+ Value *Nucleus::createLoad(Value *ptr, Type *type, bool isVolatile, unsigned int align)
{
+ assert(ptr->getType()->getContainedType(0) == type);
return V(::builder->Insert(new LoadInst(ptr, "", isVolatile, align)));
}
@@ -809,14 +810,14 @@
return T(llvm::Type::getVoidTy(*::context));
}
- LValue::LValue(Type *type, int arraySize)
+ LValue::LValue(Type *type, int arraySize) : type(type)
{
address = Nucleus::allocateStackVariable(type, arraySize);
}
Value *LValue::loadValue(unsigned int alignment) const
{
- return Nucleus::createLoad(address, false, alignment);
+ return Nucleus::createLoad(address, type, false, alignment);
}
Value *LValue::storeValue(Value *value, unsigned int alignment) const