summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-03-03 06:18:03 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-03-03 06:18:03 +0000
commit815f8dd2255d5aad953d00b391d5ad6aa22536ec (patch)
treeea85ed4c190f117bd07a75d139dd84d0ba8d1fe6 /llvm/lib/ExecutionEngine
parent1a7d44696350474793c0d9db184057bebc473e11 (diff)
downloadbcm5719-llvm-815f8dd2255d5aad953d00b391d5ad6aa22536ec.tar.gz
bcm5719-llvm-815f8dd2255d5aad953d00b391d5ad6aa22536ec.zip
Implement loading and storing of APInt values from memory.
llvm-svn: 34874
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r--llvm/lib/ExecutionEngine/ExecutionEngine.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
index 47266bf5920..55793219bcf 100644
--- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -425,7 +425,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
else if (BitWidth <= 64)
Result.Int64Val = (uint64_t )cast<ConstantInt>(C)->getZExtValue();
else
- assert(0 && "Integers with > 64-bits not implemented");
+ Result.APIntVal = const_cast<APInt*>(&cast<ConstantInt>(C)->getValue());
break;
}
@@ -481,8 +481,12 @@ void ExecutionEngine::StoreValueToMemory(GenericValue Val, GenericValue *Ptr,
Ptr->Untyped[5] = (unsigned char)(TmpVal.Int64Val >> 40);
Ptr->Untyped[6] = (unsigned char)(TmpVal.Int64Val >> 48);
Ptr->Untyped[7] = (unsigned char)(TmpVal.Int64Val >> 56);
- } else
- assert(0 && "Integer types > 64 bits not supported");
+ } else {
+ uint64_t *Dest = (uint64_t*)Ptr;
+ const uint64_t *Src = Val.APIntVal->getRawData();
+ for (uint32_t i = 0; i < Val.APIntVal->getNumWords(); ++i)
+ Dest[i] = Src[i];
+ }
break;
}
Store4BytesLittleEndian:
@@ -537,8 +541,12 @@ Store4BytesLittleEndian:
Ptr->Untyped[2] = (unsigned char)(TmpVal.Int64Val >> 40);
Ptr->Untyped[1] = (unsigned char)(TmpVal.Int64Val >> 48);
Ptr->Untyped[0] = (unsigned char)(TmpVal.Int64Val >> 56);
- } else
- assert(0 && "Integer types > 64 bits not supported");
+ } else {
+ uint64_t *Dest = (uint64_t*)Ptr;
+ const uint64_t *Src = Val.APIntVal->getRawData();
+ for (uint32_t i = 0; i < Val.APIntVal->getNumWords(); ++i)
+ Dest[i] = Src[i];
+ }
break;
}
Store4BytesBigEndian:
@@ -597,7 +605,7 @@ GenericValue ExecutionEngine::LoadValueFromMemory(GenericValue *Ptr,
((uint64_t)Ptr->Untyped[6] << 48) |
((uint64_t)Ptr->Untyped[7] << 56);
} else
- assert(0 && "Integer types > 64 bits not supported");
+ Result.APIntVal = new APInt(BitWidth, BitWidth/64, (uint64_t*)Ptr);
break;
}
Load4BytesLittleEndian:
@@ -628,7 +636,7 @@ GenericValue ExecutionEngine::LoadValueFromMemory(GenericValue *Ptr,
} else {
switch (Ty->getTypeID()) {
case Type::IntegerTyID: {
- unsigned BitWidth = cast<IntegerType>(Ty)->getBitWidth();
+ uint32_t BitWidth = cast<IntegerType>(Ty)->getBitWidth();
if (BitWidth <= 8)
Result.Int8Val = Ptr->Untyped[0];
else if (BitWidth <= 16) {
@@ -649,7 +657,7 @@ GenericValue ExecutionEngine::LoadValueFromMemory(GenericValue *Ptr,
((uint64_t)Ptr->Untyped[1] << 48) |
((uint64_t)Ptr->Untyped[0] << 56);
} else
- assert(0 && "Integer types > 64 bits not supported");
+ Result.APIntVal = new APInt(BitWidth, BitWidth/64, (uint64_t*)Ptr);
break;
}
Load4BytesBigEndian:
OpenPOWER on IntegriCloud