Fixed InitializeMemory to handle ConstantPacked.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25481 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Robert Bocchino 2006-01-20 18:18:40 +00:00
parent f690bc8c07
commit 7c2b7c7c75

View File

@ -457,6 +457,12 @@ GenericValue ExecutionEngine::LoadValueFromMemory(GenericValue *Ptr,
void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) {
if (isa<UndefValue>(Init)) {
return;
} else if (const ConstantPacked *CP = dyn_cast<ConstantPacked>(Init)) {
unsigned ElementSize =
getTargetData().getTypeSize(CP->getType()->getElementType());
for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i)
InitializeMemory(CP->getOperand(i), (char*)Addr+i*ElementSize);
return;
} else if (Init->getType()->isFirstClassType()) {
GenericValue Val = getConstantValue(Init);
StoreValueToMemory(Val, (GenericValue*)Addr, Init->getType());