diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-03-06 03:11:31 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-03-06 03:11:31 +0000 |
commit | 38f6a15df69c271c3bebf648642041b31380e31a (patch) | |
tree | 2ca38f3a21795e3434a359dc6c5cf0f37624139f /lib/ExecutionEngine | |
parent | f9536330d6271b242572eb1b8011b051b09e128c (diff) | |
download | external_llvm-38f6a15df69c271c3bebf648642041b31380e31a.zip external_llvm-38f6a15df69c271c3bebf648642041b31380e31a.tar.gz external_llvm-38f6a15df69c271c3bebf648642041b31380e31a.tar.bz2 |
Simplify code as a result of the change in GenericValue to have a single
integer field of type APInt instead of different sized integer fields.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34952 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine')
-rw-r--r-- | lib/ExecutionEngine/JIT/JIT.cpp | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp index 070947b..b7a0c9d 100644 --- a/lib/ExecutionEngine/JIT/JIT.cpp +++ b/lib/ExecutionEngine/JIT/JIT.cpp @@ -107,8 +107,9 @@ GenericValue JIT::runFunction(Function *F, // Call the function. GenericValue rv; - rv.Int32Val = PF(ArgValues[0].Int32Val, (char **)GVTOP(ArgValues[1]), - (const char **)GVTOP(ArgValues[2])); + rv.IntVal = APInt(32, PF(ArgValues[0].IntVal.getZExtValue(), + (char **)GVTOP(ArgValues[1]), + (const char **)GVTOP(ArgValues[2]))); return rv; } break; @@ -120,7 +121,8 @@ GenericValue JIT::runFunction(Function *F, // Call the function. GenericValue rv; - rv.Int32Val = PF(ArgValues[0].Int32Val, (char **)GVTOP(ArgValues[1])); + rv.IntVal = APInt(32, PF(ArgValues[0].IntVal.getZExtValue(), + (char **)GVTOP(ArgValues[1]))); return rv; } break; @@ -130,7 +132,7 @@ GenericValue JIT::runFunction(Function *F, FTy->getParamType(0) == Type::Int32Ty)) { GenericValue rv; int (*PF)(int) = (int(*)(int))(intptr_t)FPtr; - rv.Int32Val = PF(ArgValues[0].Int32Val); + rv.IntVal = APInt(32, PF(ArgValues[0].IntVal.getZExtValue())); return rv; } break; @@ -145,21 +147,21 @@ GenericValue JIT::runFunction(Function *F, case Type::IntegerTyID: { unsigned BitWidth = cast<IntegerType>(RetTy)->getBitWidth(); if (BitWidth == 1) - rv.Int1Val = ((bool(*)())(intptr_t)FPtr)(); + rv.IntVal = APInt(BitWidth, ((bool(*)())(intptr_t)FPtr)()); else if (BitWidth <= 8) - rv.Int8Val = ((char(*)())(intptr_t)FPtr)(); + rv.IntVal = APInt(BitWidth, ((char(*)())(intptr_t)FPtr)()); else if (BitWidth <= 16) - rv.Int16Val = ((short(*)())(intptr_t)FPtr)(); + rv.IntVal = APInt(BitWidth, ((short(*)())(intptr_t)FPtr)()); else if (BitWidth <= 32) - rv.Int32Val = ((int(*)())(intptr_t)FPtr)(); + rv.IntVal = APInt(BitWidth, ((int(*)())(intptr_t)FPtr)()); else if (BitWidth <= 64) - rv.Int64Val = ((int64_t(*)())(intptr_t)FPtr)(); + rv.IntVal = APInt(BitWidth, ((int64_t(*)())(intptr_t)FPtr)()); else assert(0 && "Integer types > 64 bits not supported"); return rv; } case Type::VoidTyID: - rv.Int32Val = ((int(*)())(intptr_t)FPtr)(); + rv.IntVal = APInt(32, ((int(*)())(intptr_t)FPtr)()); return rv; case Type::FloatTyID: rv.FloatVal = ((float(*)())(intptr_t)FPtr)(); @@ -194,24 +196,9 @@ GenericValue JIT::runFunction(Function *F, const GenericValue &AV = ArgValues[i]; switch (ArgTy->getTypeID()) { default: assert(0 && "Unknown argument type for function call!"); - case Type::IntegerTyID: { - unsigned BitWidth = cast<IntegerType>(ArgTy)->getBitWidth(); - if (BitWidth == 1) - C = ConstantInt::get(ArgTy, AV.Int1Val); - else if (BitWidth <= 8) - C = ConstantInt::get(ArgTy, AV.Int8Val); - else if (BitWidth <= 16) - C = ConstantInt::get(ArgTy, AV.Int16Val); - else if (BitWidth <= 32) - C = ConstantInt::get(ArgTy, AV.Int32Val); - else if (BitWidth <= 64) - C = ConstantInt::get(ArgTy, AV.Int64Val); - else - assert(0 && "Integer types > 64 bits not supported"); - break; - } - case Type::FloatTyID: C = ConstantFP ::get(ArgTy, AV.FloatVal); break; - case Type::DoubleTyID: C = ConstantFP ::get(ArgTy, AV.DoubleVal); break; + case Type::IntegerTyID: C = ConstantInt::get(AV.IntVal); 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) { |