summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-10-20 07:07:24 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-10-20 07:07:24 +0000
commite0fc4dfc2275a2c36583e5800854e64d5f5e3255 (patch)
tree6a3d057b6742055ed3a3592e58421a7b41b42f1e /llvm/lib/ExecutionEngine
parent5d417e35bc36094f2e6519866fd25f4d0db6c551 (diff)
downloadbcm5719-llvm-e0fc4dfc2275a2c36583e5800854e64d5f5e3255.tar.gz
bcm5719-llvm-e0fc4dfc2275a2c36583e5800854e64d5f5e3255.zip
For PR950:
This patch implements the first increment for the Signless Types feature. All changes pertain to removing the ConstantSInt and ConstantUInt classes in favor of just using ConstantInt. llvm-svn: 31063
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r--llvm/lib/ExecutionEngine/ExecutionEngine.cpp26
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/Execution.cpp4
-rw-r--r--llvm/lib/ExecutionEngine/JIT/JIT.cpp24
3 files changed, 27 insertions, 27 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
index 067f24de8b4..f61369cd505 100644
--- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -390,19 +390,19 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
}
switch (C->getType()->getTypeID()) {
-#define GET_CONST_VAL(TY, CTY, CLASS) \
- case Type::TY##TyID: Result.TY##Val = (CTY)cast<CLASS>(C)->getValue(); break
- GET_CONST_VAL(Bool , bool , ConstantBool);
- GET_CONST_VAL(UByte , unsigned char , ConstantUInt);
- GET_CONST_VAL(SByte , signed char , ConstantSInt);
- GET_CONST_VAL(UShort , unsigned short, ConstantUInt);
- GET_CONST_VAL(Short , signed short , ConstantSInt);
- GET_CONST_VAL(UInt , unsigned int , ConstantUInt);
- GET_CONST_VAL(Int , signed int , ConstantSInt);
- GET_CONST_VAL(ULong , uint64_t , ConstantUInt);
- GET_CONST_VAL(Long , int64_t , ConstantSInt);
- GET_CONST_VAL(Float , float , ConstantFP);
- GET_CONST_VAL(Double , double , ConstantFP);
+#define GET_CONST_VAL(TY, CTY, CLASS, GETMETH) \
+ case Type::TY##TyID: Result.TY##Val = (CTY)cast<CLASS>(C)->GETMETH(); break
+ GET_CONST_VAL(Bool , bool , ConstantBool, getValue);
+ GET_CONST_VAL(UByte , unsigned char , ConstantInt, getZExtValue);
+ GET_CONST_VAL(SByte , signed char , ConstantInt, getSExtValue);
+ GET_CONST_VAL(UShort , unsigned short, ConstantInt, getZExtValue);
+ GET_CONST_VAL(Short , signed short , ConstantInt, getSExtValue);
+ GET_CONST_VAL(UInt , unsigned int , ConstantInt, getZExtValue);
+ GET_CONST_VAL(Int , signed int , ConstantInt, getSExtValue);
+ GET_CONST_VAL(ULong , uint64_t , ConstantInt, getZExtValue);
+ GET_CONST_VAL(Long , int64_t , ConstantInt, getSExtValue);
+ GET_CONST_VAL(Float , float , ConstantFP, getValue);
+ GET_CONST_VAL(Double , double , ConstantFP, getValue);
#undef GET_CONST_VAL
case Type::PointerTyID:
if (isa<ConstantPointerNull>(C))
diff --git a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
index 4104ff36365..8c812f82d4d 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -735,8 +735,8 @@ GenericValue Interpreter::executeGEPOperation(Value *Ptr, gep_type_iterator I,
if (const StructType *STy = dyn_cast<StructType>(*I)) {
const StructLayout *SLO = TD.getStructLayout(STy);
- const ConstantUInt *CPU = cast<ConstantUInt>(I.getOperand());
- unsigned Index = unsigned(CPU->getValue());
+ const ConstantInt *CPU = cast<ConstantInt>(I.getOperand());
+ unsigned Index = unsigned(CPU->getZExtValue());
Total += (PointerTy)SLO->MemberOffsets[Index];
} else {
diff --git a/llvm/lib/ExecutionEngine/JIT/JIT.cpp b/llvm/lib/ExecutionEngine/JIT/JIT.cpp
index 0a5423ef9dc..9795eb79351 100644
--- a/llvm/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/JIT.cpp
@@ -196,22 +196,22 @@ GenericValue JIT::runFunction(Function *F,
switch (ArgTy->getTypeID()) {
default: assert(0 && "Unknown argument type for function call!");
case Type::BoolTyID: C = ConstantBool::get(AV.BoolVal); break;
- case Type::SByteTyID: C = ConstantSInt::get(ArgTy, AV.SByteVal); break;
- case Type::UByteTyID: C = ConstantUInt::get(ArgTy, AV.UByteVal); break;
- case Type::ShortTyID: C = ConstantSInt::get(ArgTy, AV.ShortVal); break;
- case Type::UShortTyID: C = ConstantUInt::get(ArgTy, AV.UShortVal); break;
- case Type::IntTyID: C = ConstantSInt::get(ArgTy, AV.IntVal); break;
- case Type::UIntTyID: C = ConstantUInt::get(ArgTy, AV.UIntVal); break;
- case Type::LongTyID: C = ConstantSInt::get(ArgTy, AV.LongVal); break;
- case Type::ULongTyID: C = ConstantUInt::get(ArgTy, AV.ULongVal); break;
- case Type::FloatTyID: C = ConstantFP ::get(ArgTy, AV.FloatVal); break;
- case Type::DoubleTyID: C = ConstantFP ::get(ArgTy, AV.DoubleVal); break;
+ case Type::SByteTyID: C = ConstantInt::get(ArgTy, AV.SByteVal); break;
+ case Type::UByteTyID: C = ConstantInt::get(ArgTy, AV.UByteVal); break;
+ case Type::ShortTyID: C = ConstantInt::get(ArgTy, AV.ShortVal); break;
+ case Type::UShortTyID: C = ConstantInt::get(ArgTy, AV.UShortVal); break;
+ case Type::IntTyID: C = ConstantInt::get(ArgTy, AV.IntVal); break;
+ case Type::UIntTyID: C = ConstantInt::get(ArgTy, AV.UIntVal); break;
+ case Type::LongTyID: C = ConstantInt::get(ArgTy, AV.LongVal); break;
+ case Type::ULongTyID: C = ConstantInt::get(ArgTy, AV.ULongVal); break;
+ case Type::FloatTyID: C = ConstantFP ::get(ArgTy, AV.FloatVal); break;
+ case Type::DoubleTyID: C = ConstantFP ::get(ArgTy, AV.DoubleVal); break;
case Type::PointerTyID:
void *ArgPtr = GVTOP(AV);
if (sizeof(void*) == 4) {
- C = ConstantSInt::get(Type::IntTy, (int)(intptr_t)ArgPtr);
+ C = ConstantInt::get(Type::IntTy, (int)(intptr_t)ArgPtr);
} else {
- C = ConstantSInt::get(Type::LongTy, (intptr_t)ArgPtr);
+ C = ConstantInt::get(Type::LongTy, (intptr_t)ArgPtr);
}
C = ConstantExpr::getCast(C, ArgTy); // Cast the integer to pointer
break;
OpenPOWER on IntegriCloud