Make Function arguments type-safe.
Change-Id: I3d4262ea4be0c7b1128b2ca410e985cc6f58c9c9
Reviewed-on: https://swiftshader-review.googlesource.com/1970
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 094481b..2325c7f 100644
--- a/src/Reactor/Nucleus.cpp
+++ b/src/Reactor/Nucleus.cpp
@@ -294,7 +294,7 @@
return function;
}
- llvm::Argument *Nucleus::getArgument(llvm::Function *function, unsigned int index)
+ llvm::Value *Nucleus::getArgument(llvm::Function *function, unsigned int index)
{
llvm::Function::arg_iterator args = function->arg_begin();
@@ -847,9 +847,9 @@
return Type::getX86_MMXTy(*Nucleus::getContext());
}
- Bool::Bool(Argument *argument)
+ Bool::Bool(Argument<Bool> argument)
{
- storeValue(argument);
+ storeValue(argument.value);
}
Bool::Bool()
@@ -921,9 +921,9 @@
return Type::getInt1Ty(*Nucleus::getContext());
}
- Byte::Byte(Argument *argument)
+ Byte::Byte(Argument<Byte> argument)
{
- storeValue(argument);
+ storeValue(argument.value);
}
Byte::Byte(RValue<Int> cast)
@@ -1187,9 +1187,9 @@
return Type::getInt8Ty(*Nucleus::getContext());
}
- SByte::SByte(Argument *argument)
+ SByte::SByte(Argument<SByte> argument)
{
- storeValue(argument);
+ storeValue(argument.value);
}
SByte::SByte(RValue<Int> cast)
@@ -1441,9 +1441,9 @@
return Type::getInt8Ty(*Nucleus::getContext());
}
- Short::Short(Argument *argument)
+ Short::Short(Argument<Short> argument)
{
- storeValue(argument);
+ storeValue(argument.value);
}
Short::Short(RValue<Int> cast)
@@ -1688,9 +1688,9 @@
return Type::getInt16Ty(*Nucleus::getContext());
}
- UShort::UShort(Argument *argument)
+ UShort::UShort(Argument<UShort> argument)
{
- storeValue(argument);
+ storeValue(argument.value);
}
UShort::UShort(RValue<UInt> cast)
@@ -3747,9 +3747,9 @@
return VectorType::get(UShort::getType(), 8);
}
- Int::Int(Argument *argument)
+ Int::Int(Argument<Int> argument)
{
- storeValue(argument);
+ storeValue(argument.value);
}
Int::Int(RValue<Byte> cast)
@@ -4225,9 +4225,9 @@
return VectorType::get(Long::getType(), 2);
}
- UInt::UInt(Argument *argument)
+ UInt::UInt(Argument<UInt> argument)
{
- storeValue(argument);
+ storeValue(argument.value);
}
UInt::UInt(RValue<UShort> cast)
@@ -6765,62 +6765,62 @@
return VectorType::get(Float::getType(), 4);
}
- RValue<Pointer<Byte> > operator+(RValue<Pointer<Byte> > lhs, int offset)
+ RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, int offset)
{
- return RValue<Pointer<Byte> >(Nucleus::createGEP(lhs.value, Nucleus::createConstantInt(offset)));
+ return RValue<Pointer<Byte>>(Nucleus::createGEP(lhs.value, Nucleus::createConstantInt(offset)));
}
- RValue<Pointer<Byte> > operator+(RValue<Pointer<Byte> > lhs, RValue<Int> offset)
+ 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, offset.value));
}
- RValue<Pointer<Byte> > operator+(RValue<Pointer<Byte> > lhs, RValue<UInt> offset)
+ 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, offset.value));
}
- RValue<Pointer<Byte> > operator+=(const Pointer<Byte> &lhs, int offset)
+ RValue<Pointer<Byte>> operator+=(const Pointer<Byte> &lhs, int offset)
{
return lhs = lhs + offset;
}
- RValue<Pointer<Byte> > operator+=(const Pointer<Byte> &lhs, RValue<Int> offset)
+ RValue<Pointer<Byte>> operator+=(const Pointer<Byte> &lhs, RValue<Int> offset)
{
return lhs = lhs + offset;
}
- RValue<Pointer<Byte> > operator+=(const Pointer<Byte> &lhs, RValue<UInt> offset)
+ RValue<Pointer<Byte>> operator+=(const Pointer<Byte> &lhs, RValue<UInt> offset)
{
return lhs = lhs + offset;
}
- RValue<Pointer<Byte> > operator-(RValue<Pointer<Byte> > lhs, int offset)
+ RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, int offset)
{
return lhs + -offset;
}
- RValue<Pointer<Byte> > operator-(RValue<Pointer<Byte> > lhs, RValue<Int> offset)
+ RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, RValue<Int> offset)
{
return lhs + -offset;
}
- RValue<Pointer<Byte> > operator-(RValue<Pointer<Byte> > lhs, RValue<UInt> offset)
+ RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, RValue<UInt> offset)
{
return lhs + -offset;
}
- RValue<Pointer<Byte> > operator-=(const Pointer<Byte> &lhs, int offset)
+ RValue<Pointer<Byte>> operator-=(const Pointer<Byte> &lhs, int offset)
{
return lhs = lhs - offset;
}
- RValue<Pointer<Byte> > operator-=(const Pointer<Byte> &lhs, RValue<Int> offset)
+ RValue<Pointer<Byte>> operator-=(const Pointer<Byte> &lhs, RValue<Int> offset)
{
return lhs = lhs - offset;
}
- RValue<Pointer<Byte> > operator-=(const Pointer<Byte> &lhs, RValue<UInt> offset)
+ RValue<Pointer<Byte>> operator-=(const Pointer<Byte> &lhs, RValue<UInt> offset)
{
return lhs = lhs - offset;
}
@@ -7761,7 +7761,7 @@
return RValue<Int>(Nucleus::createCall(pmovmskb, As<MMX>(x).value));
}
- //RValue<Int2> movd(RValue<Pointer<Int> > x)
+ //RValue<Int2> movd(RValue<Pointer<Int>> x)
//{
// Value *element = Nucleus::createLoad(x.value);