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

Misha Brukman brukman at cs.uiuc.edu
Mon Mar 1 18:02:27 PST 2004


Changes in directory llvm/lib/ExecutionEngine:

ExecutionEngine.cpp updated: 1.45 -> 1.45.2.1

---
Log message:

Merge from trunk

---
Diffs of the changes:  (+17 -8)

Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.45 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.45.2.1
--- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.45	Wed Dec 31 14:21:04 2003
+++ llvm/lib/ExecutionEngine/ExecutionEngine.cpp	Mon Mar  1 17:58:13 2004
@@ -130,11 +130,17 @@
     EE = JIT::create(MP, IL);
 
   // If we can't make a JIT, make an interpreter instead.
-  try {
-    if (EE == 0)
-      EE = Interpreter::create(MP->materializeModule(), IL);
-  } catch (...) {
-    EE = 0;
+  if (EE == 0) {
+    try {
+      Module *M = MP->materializeModule();
+      try {
+        EE = Interpreter::create(M, IL);
+      } catch (...) {
+        std::cerr << "Error creating the interpreter!\n";
+      }
+    } catch (...) {
+      std::cerr << "Error reading the bytecode file!\n";
+    }
   }
 
   if (EE == 0) delete IL;
@@ -400,6 +406,10 @@
     GenericValue Val = getConstantValue(Init);
     StoreValueToMemory(Val, (GenericValue*)Addr, Init->getType());
     return;
+  } else if (isa<ConstantAggregateZero>(Init)) {
+    unsigned Size = getTargetData().getTypeSize(Init->getType());
+    memset(Addr, 0, Size);
+    return;
   }
 
   switch (Init->getType()->getPrimitiveID()) {
@@ -448,9 +458,6 @@
       // Allocate some memory for it!
       unsigned Size = TD.getTypeSize(Ty);
       addGlobalMapping(I, new char[Size]);
-
-      DEBUG(std::cerr << "Global '" << I->getName() << "' -> "
-                      << getPointerToGlobal(I) << "\n");
     } else {
       // External variable reference. Try to use the dynamic loader to
       // get a pointer to it.
@@ -476,6 +483,8 @@
 // already in the map.
 void ExecutionEngine::EmitGlobalVariable(const GlobalVariable *GV) {
   void *GA = getPointerToGlobalIfAvailable(GV);
+  DEBUG(std::cerr << "Global '" << GV->getName() << "' -> " << GA << "\n");
+
   const Type *ElTy = GV->getType()->getElementType();
   if (GA == 0) {
     // If it's not already specified, allocate memory for the global.





More information about the llvm-commits mailing list