[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Nov 19 00:44:19 PST 2004



Changes in directory llvm/lib/ExecutionEngine:

ExecutionEngine.cpp updated: 1.61 -> 1.62
---
Log message:

This is a horrible hack to work around libstdc++ bugs :(


---
Diffs of the changes:  (+6 -2)

Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.61 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.62
--- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.61	Tue Oct 26 00:35:14 2004
+++ llvm/lib/ExecutionEngine/ExecutionEngine.cpp	Fri Nov 19 02:44:07 2004
@@ -442,6 +442,9 @@
 //
 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 @@
   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;
 }






More information about the llvm-commits mailing list