summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-11-19 08:44:07 +0000
committerChris Lattner <sabre@nondot.org>2004-11-19 08:44:07 +0000
commitd215992b354e7bf9c35809341c8a91ec2f761857 (patch)
tree2adaf91ce4d60dacf2c9455ed809395c395e9e8b
parent488f4a4352e36e8cc9b0405145b21095a2e72b75 (diff)
downloadbcm5719-llvm-d215992b354e7bf9c35809341c8a91ec2f761857.tar.gz
bcm5719-llvm-d215992b354e7bf9c35809341c8a91ec2f761857.zip
This is a horrible hack to work around libstdc++ bugs :(
llvm-svn: 17988
-rw-r--r--llvm/lib/ExecutionEngine/ExecutionEngine.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
index 7fb4ad3ae81..812bec184d9 100644
--- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -442,6 +442,9 @@ GenericValue ExecutionEngine::LoadValueFromMemory(GenericValue *Ptr,
//
void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) {
if (isa<UndefValue>(Init)) {
+ // FIXME: THIS SHOULD NOT BE NEEDED.
+ unsigned Size = getTargetData().getTypeSize(Init->getType());
+ memset(Addr, 0, Size);
return;
} else if (Init->getType()->isFirstClassType()) {
GenericValue Val = getConstantValue(Init);
@@ -524,13 +527,14 @@ void ExecutionEngine::EmitGlobalVariable(const GlobalVariable *GV) {
DEBUG(std::cerr << "Global '" << GV->getName() << "' -> " << GA << "\n");
const Type *ElTy = GV->getType()->getElementType();
+ unsigned GVSize = getTargetData().getTypeSize(ElTy);
if (GA == 0) {
// If it's not already specified, allocate memory for the global.
- GA = new char[getTargetData().getTypeSize(ElTy)];
+ GA = new char[GVSize];
addGlobalMapping(GV, GA);
}
InitializeMemory(GV->getInitializer(), GA);
- NumInitBytes += getTargetData().getTypeSize(ElTy);
+ NumInitBytes += GVSize;
++NumGlobals;
}
OpenPOWER on IntegriCloud