Add type information to pointer arguments.

Unlike LLVM, Subzero does not store the type of value a pointer
references as part of the pointer's type information. So add a type
argument to createGEP(). Also add the type to createStore(), to
enable smaller types to be emulated by larger ones.

Bug swiftshader:11

Change-Id: I08173dd0ba07362d2b27baff4a8fba0ecce093d2
Reviewed-on: https://swiftshader-review.googlesource.com/7392
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/SubzeroReactor.cpp b/src/Reactor/SubzeroReactor.cpp
index d1fd3e2..bdb00d2 100644
--- a/src/Reactor/SubzeroReactor.cpp
+++ b/src/Reactor/SubzeroReactor.cpp
@@ -474,21 +474,21 @@
 		return V(value);
 	}
 
-	Value *Nucleus::createStore(Value *value, Value *ptr, bool isVolatile, unsigned int align)
+	Value *Nucleus::createStore(Value *value, Value *ptr, Type *type, bool isVolatile, unsigned int align)
 	{
 		auto store = Ice::InstStore::create(::function, value, ptr, align);
 		::basicBlock->appendInst(store);
 		return value;
 	}
 
-	Constant *Nucleus::createStore(Constant *constant, Value *ptr, bool isVolatile, unsigned int align)
+	Constant *Nucleus::createStore(Constant *constant, Value *ptr, Type *type, bool isVolatile, unsigned int align)
 	{
 		auto store = Ice::InstStore::create(::function, constant, ptr, align);
 		::basicBlock->appendInst(store);
 		return constant;
 	}
 
-	Value *Nucleus::createGEP(Value *ptr, Value *index)
+	Value *Nucleus::createGEP(Value *ptr, Type *type, Value *index)
 	{
 		assert(false && "UNIMPLEMENTED"); return nullptr;
 	}
@@ -1144,7 +1144,7 @@
 
 	Type *Byte::getType()
 	{
-		assert(false && "UNIMPLEMENTED"); return nullptr;
+		return T(Ice::IceType_i8);
 	}
 
 	SByte::SByte(Argument<SByte> argument)
@@ -5616,12 +5616,12 @@
 
 	RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, RValue<Int> offset)
 	{
-		return RValue<Pointer<Byte>>(Nucleus::createGEP(lhs.value, offset.value));
+		return RValue<Pointer<Byte>>(Nucleus::createGEP(lhs.value, Byte::getType(), offset.value));
 	}
 
 	RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, RValue<UInt> offset)
 	{
-		return RValue<Pointer<Byte>>(Nucleus::createGEP(lhs.value, offset.value));
+		return RValue<Pointer<Byte>>(Nucleus::createGEP(lhs.value, Byte::getType(), offset.value));
 	}
 
 	RValue<Pointer<Byte>> operator+=(const Pointer<Byte> &lhs, int offset)