Abstract llvm::Type usage.

Bug swiftshader:10

Change-Id: I86b80cb03ff48ff7273aaf23a8e4995b3436f825
Reviewed-on: https://swiftshader-review.googlesource.com/7274
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/Nucleus.cpp b/src/Reactor/Nucleus.cpp
index 7f7bf00..ab9a151 100644
--- a/src/Reactor/Nucleus.cpp
+++ b/src/Reactor/Nucleus.cpp
@@ -75,6 +75,20 @@
 
 	Optimization optimization[10] = {InstructionCombining, Disabled};
 
+	class Type : public llvm::Type
+	{
+	};
+
+	inline Type *T(llvm::Type *t)
+	{
+		return reinterpret_cast<Type*>(t);
+	}
+
+	inline std::vector<llvm::Type*> &T(std::vector<Type*> &t)
+	{
+		return reinterpret_cast<std::vector<llvm::Type*>&>(t);
+	}
+
 	Nucleus::Nucleus()
 	{
 		codegenMutex.lock();   // Reactor and LLVM are currently not thread safe
@@ -143,7 +157,7 @@
 	{
 		if(::builder->GetInsertBlock()->empty() || !::builder->GetInsertBlock()->back().isTerminator())
 		{
-			Type *type = ::function->getReturnType();
+			llvm::Type *type = ::function->getReturnType();
 
 			if(type->isVoidTy())
 			{
@@ -265,9 +279,9 @@
 		return *pred_begin(basicBlock);
 	}
 
-	void Nucleus::createFunction(llvm::Type *ReturnType, std::vector<llvm::Type*> &Params)
+	void Nucleus::createFunction(Type *ReturnType, std::vector<Type*> &Params)
 	{
-		llvm::FunctionType *functionType = llvm::FunctionType::get(ReturnType, Params, false);
+		llvm::FunctionType *functionType = llvm::FunctionType::get(ReturnType, T(Params), false);
 		::function = llvm::Function::Create(functionType, llvm::GlobalValue::InternalLinkage, "", ::module);
 		::function->setCallingConv(llvm::CallingConv::C);
 
@@ -714,7 +728,7 @@
 		return shuffle;
 	}
 
-	llvm::Constant *Nucleus::createConstantPointer(const void *address, llvm::Type *Ty, bool isConstant, unsigned int Align)
+	llvm::Constant *Nucleus::createConstantPointer(const void *address, Type *Ty, bool isConstant, unsigned int Align)
 	{
 		const GlobalValue *existingGlobal = ::executionEngine->getGlobalValueAtAddress(const_cast<void*>(address));   // FIXME: Const
 
@@ -723,7 +737,8 @@
 			return (llvm::Constant*)existingGlobal;
 		}
 
-		GlobalValue *global = new GlobalVariable(*::module, Ty, isConstant, GlobalValue::ExternalLinkage, 0, "");
+		llvm::GlobalValue *global = new llvm::GlobalVariable(*::module, Ty, isConstant, llvm::GlobalValue::ExternalLinkage, 0, "");
+
 		global->setAlignment(Align);
 
 		::executionEngine->addGlobalMapping(global, const_cast<void*>(address));
@@ -731,12 +746,12 @@
 		return global;
 	}
 
-	llvm::Type *Nucleus::getPointerType(llvm::Type *ElementType)
+	Type *Nucleus::getPointerType(Type *ElementType)
 	{
-		return llvm::PointerType::get(ElementType, 0);
+		return T(llvm::PointerType::get(ElementType, 0));
 	}
 
-	llvm::Constant *Nucleus::createNullValue(llvm::Type *Ty)
+	llvm::Constant *Nucleus::createNullValue(Type *Ty)
 	{
 		return llvm::Constant::getNullValue(Ty);
 	}
@@ -786,7 +801,7 @@
 		return ConstantFP::get(Float::getType(), x);
 	}
 
-	llvm::Value *Nucleus::createNullPointer(llvm::Type *Ty)
+	llvm::Value *Nucleus::createNullPointer(Type *Ty)
 	{
 		return llvm::ConstantPointerNull::get(llvm::PointerType::get(Ty, 0));
 	}
@@ -798,10 +813,10 @@
 
 	Type *Void::getType()
 	{
-		return Type::getVoidTy(*::context);
+		return T(llvm::Type::getVoidTy(*::context));
 	}
 
-	LValue::LValue(llvm::Type *type, int arraySize)
+	LValue::LValue(Type *type, int arraySize)
 	{
 		address = Nucleus::allocateStackVariable(type, arraySize);
 	}
@@ -834,7 +849,7 @@
 
 	Type *MMX::getType()
 	{
-		return Type::getX86_MMXTy(*::context);
+		return T(llvm::Type::getX86_MMXTy(*::context));
 	}
 
 	Bool::Bool(Argument<Bool> argument)
@@ -908,7 +923,7 @@
 
 	Type *Bool::getType()
 	{
-		return Type::getInt1Ty(*::context);
+		return T(llvm::Type::getInt1Ty(*::context));
 	}
 
 	Byte::Byte(Argument<Byte> argument)
@@ -1174,7 +1189,7 @@
 
 	Type *Byte::getType()
 	{
-		return Type::getInt8Ty(*::context);
+		return T(llvm::Type::getInt8Ty(*::context));
 	}
 
 	SByte::SByte(Argument<SByte> argument)
@@ -1428,7 +1443,7 @@
 
 	Type *SByte::getType()
 	{
-		return Type::getInt8Ty(*::context);
+		return T(llvm::Type::getInt8Ty(*::context));
 	}
 
 	Short::Short(Argument<Short> argument)
@@ -1675,7 +1690,7 @@
 
 	Type *Short::getType()
 	{
-		return Type::getInt16Ty(*::context);
+		return T(llvm::Type::getInt16Ty(*::context));
 	}
 
 	UShort::UShort(Argument<UShort> argument)
@@ -1929,13 +1944,13 @@
 
 	Type *UShort::getType()
 	{
-		return Type::getInt16Ty(*::context);
+		return T(llvm::Type::getInt16Ty(*::context));
 	}
 
 	Type *Byte4::getType()
 	{
 		#if 0
-			return VectorType::get(Byte::getType(), 4);
+			return T(VectorType::get(Byte::getType(), 4));
 		#else
 			return UInt::getType();   // FIXME: LLVM doesn't manipulate it as one 32-bit block
 		#endif
@@ -1944,7 +1959,7 @@
 	Type *SByte4::getType()
 	{
 		#if 0
-			return VectorType::get(SByte::getType(), 4);
+			return T(VectorType::get(SByte::getType(), 4));
 		#else
 			return Int::getType();   // FIXME: LLVM doesn't manipulate it as one 32-bit block
 		#endif
@@ -2283,7 +2298,7 @@
 		}
 		else
 		{
-			return VectorType::get(Byte::getType(), 8);
+			return T(VectorType::get(Byte::getType(), 8));
 		}
 	}
 
@@ -2591,7 +2606,7 @@
 		}
 		else
 		{
-			return VectorType::get(SByte::getType(), 8);
+			return T(VectorType::get(SByte::getType(), 8));
 		}
 	}
 
@@ -2643,12 +2658,12 @@
 
 	Type *Byte16::getType()
 	{
-		return VectorType::get(Byte::getType(), 16);
+		return T(VectorType::get(Byte::getType(), 16));
 	}
 
 	Type *SByte16::getType()
 	{
-		return VectorType::get(SByte::getType(), 16);
+		return T( VectorType::get(SByte::getType(), 16));
 	}
 
 	Short4::Short4(RValue<Int> cast)
@@ -3210,7 +3225,7 @@
 		}
 		else
 		{
-			return VectorType::get(Short::getType(), 4);
+			return T(VectorType::get(Short::getType(), 4));
 		}
 	}
 
@@ -3400,7 +3415,6 @@
 		}
 	}
 
-
 	RValue<UShort4> operator*(RValue<UShort4> lhs, RValue<UShort4> rhs)
 	{
 		if(CPUID::supportsMMX2())
@@ -3516,7 +3530,7 @@
 		}
 		else
 		{
-			return VectorType::get(UShort::getType(), 4);
+			return T(VectorType::get(UShort::getType(), 4));
 		}
 	}
 
@@ -3610,7 +3624,7 @@
 
 	Type *Short8::getType()
 	{
-		return VectorType::get(Short::getType(), 8);
+		return T(VectorType::get(Short::getType(), 8));
 	}
 
 	UShort8::UShort8(unsigned short c0, unsigned short c1, unsigned short c2, unsigned short c3, unsigned short c4, unsigned short c5, unsigned short c6, unsigned short c7)
@@ -3777,7 +3791,7 @@
 
 	Type *UShort8::getType()
 	{
-		return VectorType::get(UShort::getType(), 8);
+		return T(VectorType::get(UShort::getType(), 8));
 	}
 
 	Int::Int(Argument<Int> argument)
@@ -4131,13 +4145,11 @@
 
 	Type *Int::getType()
 	{
-		return Type::getInt32Ty(*::context);
+		return T(llvm::Type::getInt32Ty(*::context));
 	}
 
 	Long::Long(RValue<Int> cast)
 	{
-
-
 		Value *integer = Nucleus::createSExt(cast.value, Long::getType());
 
 		storeValue(integer);
@@ -4214,7 +4226,7 @@
 
 	Type *Long::getType()
 	{
-		return Type::getInt64Ty(*::context);
+		return T(llvm::Type::getInt64Ty(*::context));
 	}
 
 	Long1::Long1(const RValue<UInt> cast)
@@ -4238,7 +4250,7 @@
 		}
 		else
 		{
-			return VectorType::get(Long::getType(), 1);
+			return T(VectorType::get(Long::getType(), 1));
 		}
 	}
 
@@ -4255,7 +4267,7 @@
 
 	Type *Long2::getType()
 	{
-		return VectorType::get(Long::getType(), 2);
+		return T(VectorType::get(Long::getType(), 2));
 	}
 
 	UInt::UInt(Argument<UInt> argument)
@@ -4600,7 +4612,7 @@
 
 	Type *UInt::getType()
 	{
-		return Type::getInt32Ty(*::context);
+		return T(llvm::Type::getInt32Ty(*::context));
 	}
 
 //	Int2::Int2(RValue<Int> cast)
@@ -4681,7 +4693,7 @@
 			shuffle[0] = Nucleus::createConstantInt(0);
 			shuffle[1] = Nucleus::createConstantInt(1);
 
-			Value *packed = Nucleus::createShuffleVector(Nucleus::createBitCast(lo.value, VectorType::get(Int::getType(), 1)), Nucleus::createBitCast(hi.value, VectorType::get(Int::getType(), 1)), Nucleus::createConstantVector(shuffle, 2));
+			Value *packed = Nucleus::createShuffleVector(Nucleus::createBitCast(lo.value, T(VectorType::get(Int::getType(), 1))), Nucleus::createBitCast(hi.value, T(VectorType::get(Int::getType(), 1))), Nucleus::createConstantVector(shuffle, 2));
 
 			storeValue(Nucleus::createBitCast(packed, Int2::getType()));
 		}
@@ -4941,7 +4953,7 @@
 		{
 			if(i == 0)
 			{
-				return RValue<Int>(Nucleus::createExtractElement(Nucleus::createBitCast(val.value, VectorType::get(Int::getType(), 2)), 0));
+				return RValue<Int>(Nucleus::createExtractElement(Nucleus::createBitCast(val.value, T(VectorType::get(Int::getType(), 2))), 0));
 			}
 			else
 			{
@@ -4954,7 +4966,7 @@
 
 	RValue<Int2> Insert(RValue<Int2> val, RValue<Int> element, int i)
 	{
-		return RValue<Int2>(Nucleus::createBitCast(Nucleus::createInsertElement(Nucleus::createBitCast(val.value, VectorType::get(Int::getType(), 2)), element.value, i), Int2::getType()));
+		return RValue<Int2>(Nucleus::createBitCast(Nucleus::createInsertElement(Nucleus::createBitCast(val.value, T(VectorType::get(Int::getType(), 2))), element.value, i), Int2::getType()));
 	}
 
 	Type *Int2::getType()
@@ -4965,7 +4977,7 @@
 		}
 		else
 		{
-			return VectorType::get(Int::getType(), 2);
+			return T(VectorType::get(Int::getType(), 2));
 		}
 	}
 
@@ -5225,7 +5237,7 @@
 		}
 		else
 		{
-			return VectorType::get(UInt::getType(), 2);
+			return T(VectorType::get(UInt::getType(), 2));
 		}
 	}
 
@@ -5789,7 +5801,7 @@
 
 	Type *Int4::getType()
 	{
-		return VectorType::get(Int::getType(), 4);
+		return T(VectorType::get(Int::getType(), 4));
 	}
 
 	UInt4::UInt4(RValue<Float4> cast)
@@ -6130,7 +6142,7 @@
 
 	Type *UInt4::getType()
 	{
-		return VectorType::get(UInt::getType(), 4);
+		return T(VectorType::get(UInt::getType(), 4));
 	}
 
 	Float::Float(RValue<Int> cast)
@@ -6371,7 +6383,7 @@
 
 	Type *Float::getType()
 	{
-		return Type::getFloatTy(*::context);
+		return T(llvm::Type::getFloatTy(*::context));
 	}
 
 	Float2::Float2(RValue<Float4> cast)
@@ -6387,7 +6399,7 @@
 
 	Type *Float2::getType()
 	{
-		return VectorType::get(Float::getType(), 2);
+		return T(VectorType::get(Float::getType(), 2));
 	}
 
 	Float4::Float4(RValue<Byte4> cast)
@@ -6900,7 +6912,7 @@
 
 	Type *Float4::getType()
 	{
-		return VectorType::get(Float::getType(), 4);
+		return T(VectorType::get(Float::getType(), 4));
 	}
 
 	RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, int offset)
diff --git a/src/Reactor/Nucleus.hpp b/src/Reactor/Nucleus.hpp
index c9ed831..2a6edf0 100644
--- a/src/Reactor/Nucleus.hpp
+++ b/src/Reactor/Nucleus.hpp
@@ -30,7 +30,6 @@
 
 namespace llvm
 {
-	class Type;
 	class Value;
 	class Constant;
 	class BasicBlock;
@@ -38,6 +37,8 @@
 
 namespace sw
 {
+	class Type;
+
 	enum Optimization
 	{
 		Disabled             = 0,
@@ -69,13 +70,13 @@
 
 		Routine *acquireRoutine(const wchar_t *name, bool runOptimizations = true);
 
-		static llvm::Value *allocateStackVariable(llvm::Type *type, int arraySize = 0);
+		static llvm::Value *allocateStackVariable(Type *type, int arraySize = 0);
 		static llvm::BasicBlock *createBasicBlock();
 		static llvm::BasicBlock *getInsertBlock();
 		static void setInsertBlock(llvm::BasicBlock *basicBlock);
 		static llvm::BasicBlock *getPredecessor(llvm::BasicBlock *basicBlock);
 
-		static void createFunction(llvm::Type *ReturnType, std::vector<llvm::Type*> &Params);
+		static void createFunction(Type *ReturnType, std::vector<Type*> &Params);
 		static llvm::Value *getArgument(unsigned int index);
 
 		// Terminators
@@ -117,18 +118,18 @@
 		static llvm::Value *createAtomicAdd(llvm::Value *ptr, llvm::Value *value);
 
 		// Cast/Conversion Operators
-		static llvm::Value *createTrunc(llvm::Value *V, llvm::Type *destType);
-		static llvm::Value *createZExt(llvm::Value *V, llvm::Type *destType);
-		static llvm::Value *createSExt(llvm::Value *V, llvm::Type *destType);
-		static llvm::Value *createFPToSI(llvm::Value *V, llvm::Type *destType);
-		static llvm::Value *createUIToFP(llvm::Value *V, llvm::Type *destType);
-		static llvm::Value *createSIToFP(llvm::Value *V, llvm::Type *destType);
-		static llvm::Value *createFPTrunc(llvm::Value *V, llvm::Type *destType);
-		static llvm::Value *createFPExt(llvm::Value *V, llvm::Type *destType);
-		static llvm::Value *createPtrToInt(llvm::Value *V, llvm::Type *destType);
-		static llvm::Value *createIntToPtr(llvm::Value *V, llvm::Type *destType);
-		static llvm::Value *createBitCast(llvm::Value *V, llvm::Type *destType);
-		static llvm::Value *createIntCast(llvm::Value *V, llvm::Type *destType, bool isSigned);
+		static llvm::Value *createTrunc(llvm::Value *V, Type *destType);
+		static llvm::Value *createZExt(llvm::Value *V, Type *destType);
+		static llvm::Value *createSExt(llvm::Value *V, Type *destType);
+		static llvm::Value *createFPToSI(llvm::Value *V, Type *destType);
+		static llvm::Value *createUIToFP(llvm::Value *V, Type *destType);
+		static llvm::Value *createSIToFP(llvm::Value *V, Type *destType);
+		static llvm::Value *createFPTrunc(llvm::Value *V, Type *destType);
+		static llvm::Value *createFPExt(llvm::Value *V, Type *destType);
+		static llvm::Value *createPtrToInt(llvm::Value *V, Type *destType);
+		static llvm::Value *createIntToPtr(llvm::Value *V, Type *destType);
+		static llvm::Value *createBitCast(llvm::Value *V, Type *destType);
+		static llvm::Value *createIntCast(llvm::Value *V, Type *destType, bool isSigned);
 
 		// Compare instructions
 		static llvm::Value *createICmpEQ(llvm::Value *lhs, llvm::Value *rhs);
@@ -179,7 +180,7 @@
 		static llvm::Value *createMask(llvm::Value *lhs, llvm::Value *rhs, unsigned char select);
 
 		// Constant values
-		static llvm::Constant *createNullValue(llvm::Type *Ty);
+		static llvm::Constant *createNullValue(Type *Ty);
 		static llvm::Constant *createConstantInt(int64_t i);
 		static llvm::Constant *createConstantInt(int i);
 		static llvm::Constant *createConstantInt(unsigned int i);
@@ -189,11 +190,11 @@
 		static llvm::Constant *createConstantShort(short i);
 		static llvm::Constant *createConstantShort(unsigned short i);
 		static llvm::Constant *createConstantFloat(float x);
-		static llvm::Value *createNullPointer(llvm::Type *Ty);
+		static llvm::Value *createNullPointer(Type *Ty);
 		static llvm::Value *createConstantVector(llvm::Constant *const *Vals, unsigned NumVals);
-		static llvm::Constant *createConstantPointer(const void *external, llvm::Type *Ty, bool isConstant, unsigned int Align);
+		static llvm::Constant *createConstantPointer(const void *external, Type *Ty, bool isConstant, unsigned int Align);
 
-		static llvm::Type *getPointerType(llvm::Type *ElementType);
+		static Type *getPointerType(Type *ElementType);
 
 	private:
 		void optimize();
@@ -231,7 +232,7 @@
 	class Void
 	{
 	public:
-		static llvm::Type *getType();
+		static Type *getType();
 
 		static bool isVoid()
 		{
@@ -250,7 +251,7 @@
 	class LValue
 	{
 	public:
-		LValue(llvm::Type *type, int arraySize = 0);
+		LValue(Type *type, int arraySize = 0);
 
 		static bool isVoid()
 		{
@@ -371,7 +372,7 @@
 		RValue<Bool> operator=(const Bool &rhs) const;
 		RValue<Bool> operator=(const Reference<Bool> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 	RValue<Bool> operator!(RValue<Bool> val);
@@ -399,7 +400,7 @@
 		RValue<Byte> operator=(const Byte &rhs) const;
 		RValue<Byte> operator=(const Reference<Byte> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 	RValue<Byte> operator+(RValue<Byte> lhs, RValue<Byte> rhs);
@@ -455,7 +456,7 @@
 		RValue<SByte> operator=(const SByte &rhs) const;
 		RValue<SByte> operator=(const Reference<SByte> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 	RValue<SByte> operator+(RValue<SByte> lhs, RValue<SByte> rhs);
@@ -510,7 +511,7 @@
 		RValue<Short> operator=(const Short &rhs) const;
 		RValue<Short> operator=(const Reference<Short> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 	RValue<Short> operator+(RValue<Short> lhs, RValue<Short> rhs);
@@ -566,7 +567,7 @@
 		RValue<UShort> operator=(const UShort &rhs) const;
 		RValue<UShort> operator=(const Reference<UShort> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 	RValue<UShort> operator+(RValue<UShort> lhs, RValue<UShort> rhs);
@@ -616,7 +617,7 @@
 	//	RValue<Byte4> operator=(const Byte4 &rhs) const;
 	//	RValue<Byte4> operator=(const Reference<Byte4> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 //	RValue<Byte4> operator+(RValue<Byte4> lhs, RValue<Byte4> rhs);
@@ -660,7 +661,7 @@
 	//	RValue<SByte4> operator=(const SByte4 &rhs) const;
 	//	RValue<SByte4> operator=(const Reference<SByte4> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 //	RValue<SByte4> operator+(RValue<SByte4> lhs, RValue<SByte4> rhs);
@@ -705,7 +706,7 @@
 		RValue<Byte8> operator=(const Byte8 &rhs) const;
 		RValue<Byte8> operator=(const Reference<Byte8> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 	RValue<Byte8> operator+(RValue<Byte8> lhs, RValue<Byte8> rhs);
@@ -759,7 +760,7 @@
 		RValue<SByte8> operator=(const SByte8 &rhs) const;
 		RValue<SByte8> operator=(const Reference<SByte8> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 	RValue<SByte8> operator+(RValue<SByte8> lhs, RValue<SByte8> rhs);
@@ -811,7 +812,7 @@
 		RValue<Byte16> operator=(const Byte16 &rhs) const;
 		RValue<Byte16> operator=(const Reference<Byte16> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 //	RValue<Byte16> operator+(RValue<Byte16> lhs, RValue<Byte16> rhs);
@@ -855,7 +856,7 @@
 	//	RValue<SByte16> operator=(const SByte16 &rhs) const;
 	//	RValue<SByte16> operator=(const Reference<SByte16> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 //	RValue<SByte16> operator+(RValue<SByte16> lhs, RValue<SByte16> rhs);
@@ -911,7 +912,7 @@
 		RValue<Short4> operator=(const UShort4 &rhs) const;
 		RValue<Short4> operator=(const Reference<UShort4> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 	RValue<Short4> operator+(RValue<Short4> lhs, RValue<Short4> rhs);
@@ -991,7 +992,7 @@
 		RValue<UShort4> operator=(const Short4 &rhs) const;
 		RValue<UShort4> operator=(const Reference<Short4> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 	RValue<UShort4> operator+(RValue<UShort4> lhs, RValue<UShort4> rhs);
@@ -1048,7 +1049,7 @@
 	//	RValue<Short8> operator=(const Short8 &rhs) const;
 	//	RValue<Short8> operator=(const Reference<Short8> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 	RValue<Short8> operator+(RValue<Short8> lhs, RValue<Short8> rhs);
@@ -1105,7 +1106,7 @@
 		RValue<UShort8> operator=(const UShort8 &rhs) const;
 		RValue<UShort8> operator=(const Reference<UShort8> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 	RValue<UShort8> operator+(RValue<UShort8> lhs, RValue<UShort8> rhs);
@@ -1177,7 +1178,7 @@
 		RValue<Int> operator=(const Reference<Int> &rhs) const;
 		RValue<Int> operator=(const Reference<UInt> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 	RValue<Int> operator+(RValue<Int> lhs, RValue<Int> rhs);
@@ -1247,7 +1248,7 @@
 	//	RValue<Long> operator=(const ULong &rhs) const;
 	//	RValue<Long> operator=(const Reference<ULong> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 	RValue<Long> operator+(RValue<Long> lhs, RValue<Long> rhs);
@@ -1315,7 +1316,7 @@
 	//	RValue<Long1> operator=(const ULong1 &rhs) const;
 	//	RValue<Long1> operator=(const Reference<ULong1> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 //	RValue<Long1> operator+(RValue<Long1> lhs, RValue<Long1> rhs);
@@ -1370,7 +1371,7 @@
 	//	RValue<Long2> operator=(const Long2 &rhs) const;
 	//	RValue<Long2> operator=(const Reference<Long2 &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 //	RValue<Long2> operator+(RValue<Long2> lhs, RValue<Long2> rhs);
@@ -1444,7 +1445,7 @@
 		RValue<UInt> operator=(const Reference<UInt> &rhs) const;
 		RValue<UInt> operator=(const Reference<Int> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 	RValue<UInt> operator+(RValue<UInt> lhs, RValue<UInt> rhs);
@@ -1503,7 +1504,7 @@
 		RValue<Int2> operator=(const Int2 &rhs) const;
 		RValue<Int2> operator=(const Reference<Int2> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 	RValue<Int2> operator+(RValue<Int2> lhs, RValue<Int2> rhs);
@@ -1563,7 +1564,7 @@
 		RValue<UInt2> operator=(const UInt2 &rhs) const;
 		RValue<UInt2> operator=(const Reference<UInt2> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 	RValue<UInt2> operator+(RValue<UInt2> lhs, RValue<UInt2> rhs);
@@ -1635,7 +1636,7 @@
 		RValue<Int4> operator=(const Int4 &rhs) const;
 		RValue<Int4> operator=(const Reference<Int4> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 
 	private:
 		void constant(int x, int y, int z, int w);
@@ -1715,7 +1716,7 @@
 		RValue<UInt4> operator=(const UInt4 &rhs) const;
 		RValue<UInt4> operator=(const Reference<UInt4> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 
 	private:
 		void constant(int x, int y, int z, int w);
@@ -1856,7 +1857,7 @@
 		template<int T>
 		RValue<Float> operator=(const SwizzleMask1Float4<T> &rhs) const;
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 	RValue<Float> operator+(RValue<Float> lhs, RValue<Float> rhs);
@@ -1921,7 +1922,7 @@
 	//	template<int T>
 	//	RValue<Float2> operator=(const SwizzleMask1Float4<T> &rhs);
 
-		static llvm::Type *getType();
+		static Type *getType();
 	};
 
 //	RValue<Float2> operator+(RValue<Float2> lhs, RValue<Float2> rhs);
@@ -1991,7 +1992,7 @@
 		template<int T>
 		RValue<Float4> operator=(const SwizzleFloat4<T> &rhs);
 
-		static llvm::Type *getType();
+		static Type *getType();
 
 		union
 		{
@@ -2415,7 +2416,7 @@
 		Reference<T> operator[](int index);
 		Reference<T> operator[](RValue<Int> index);
 
-		static llvm::Type *getType();
+		static Type *getType();
 
 	private:
 		const int alignment;
@@ -2503,7 +2504,7 @@
 
 	protected:
 		Nucleus *core;
-		std::vector<llvm::Type*> arguments;
+		std::vector<Type*> arguments;
 	};
 
 	template<typename Return>
@@ -2847,7 +2848,7 @@
 	}
 
 	template<class T>
-	llvm::Type *Pointer<T>::getType()
+	Type *Pointer<T>::getType()
 	{
 		return Nucleus::getPointerType(T::getType());
 	}
@@ -2947,8 +2948,8 @@
 	{
 		core = new Nucleus();
 
-		llvm::Type *types[] = {Arguments::getType()...};
-		for(llvm::Type *type : types)
+		Type *types[] = {Arguments::getType()...};
+		for(Type *type : types)
 		{
 			if(type != Void::getType())
 			{