Implement support for arrays.

Bug swiftshader:6

Change-Id: I9ffcca588014466acb7f13a3df551a696ada8a91
Reviewed-on: https://swiftshader-review.googlesource.com/7755
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-on: https://swiftshader-review.googlesource.com/8136
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Reactor/SubzeroReactor.cpp b/src/Reactor/SubzeroReactor.cpp
index 52fca8b..6b0f406 100644
--- a/src/Reactor/SubzeroReactor.cpp
+++ b/src/Reactor/SubzeroReactor.cpp
@@ -446,14 +446,13 @@
 
 	Value *Nucleus::allocateStackVariable(Type *t, int arraySize)
 	{
-		assert(arraySize == 0 && "UNIMPLEMENTED");
-
 		Ice::Type type = T(t);
-		int size = Ice::typeWidthInBytes(type);
+		int typeSize = Ice::typeWidthInBytes(type);
+		int totalSize = typeSize * (arraySize ? arraySize : 1);
 
-		auto bytes = Ice::ConstantInteger32::create(::context, type, size);
+		auto bytes = Ice::ConstantInteger32::create(::context, type, totalSize);
 		auto address = ::function->makeVariable(T(getPointerType(t)));
-		auto alloca = Ice::InstAlloca::create(::function, address, bytes, size);
+		auto alloca = Ice::InstAlloca::create(::function, address, bytes, typeSize);
 		::function->getEntryNode()->getInsts().push_front(alloca);
 
 		return V(address);