[llvm-commits] [llvm] r58807 - in /llvm/trunk/lib/ExecutionEngine: ExecutionEngine.cpp JIT/JITEmitter.cpp

Evan Cheng evan.cheng at apple.com
Thu Nov 6 09:46:05 PST 2008


Author: evancheng
Date: Thu Nov  6 11:46:04 2008
New Revision: 58807

URL: http://llvm.org/viewvc/llvm-project?rev=58807&view=rev
Log:
Improve JIT debugging outputs format consistency.

Modified:
    llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
    llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp

Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=58807&r1=58806&r2=58807&view=diff

==============================================================================
--- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Thu Nov  6 11:46:04 2008
@@ -94,7 +94,7 @@
 void ExecutionEngine::addGlobalMapping(const GlobalValue *GV, void *Addr) {
   MutexGuard locked(lock);
 
-  DOUT << "Map \'" << GV->getNameStart() << "\' to " << Addr << "\n";  
+  DOUT << "JIT: Map \'" << GV->getNameStart() << "\' to " << Addr << "\n";  
   void *&CurVal = state.getGlobalAddressMap(locked)[GV];
   assert((CurVal == 0 || Addr == 0) && "GlobalMapping already established!");
   CurVal = Addr;
@@ -211,13 +211,13 @@
   unsigned PtrSize = EE->getTargetData()->getPointerSize();
   char *Result = new char[(InputArgv.size()+1)*PtrSize];
 
-  DOUT << "ARGV = " << (void*)Result << "\n";
+  DOUT << "JIT: ARGV = " << (void*)Result << "\n";
   const Type *SBytePtr = PointerType::getUnqual(Type::Int8Ty);
 
   for (unsigned i = 0; i != InputArgv.size(); ++i) {
     unsigned Size = InputArgv[i].size()+1;
     char *Dest = new char[Size];
-    DOUT << "ARGV[" << i << "] = " << (void*)Dest << "\n";
+    DOUT << "JIT: ARGV[" << i << "] = " << (void*)Dest << "\n";
 
     std::copy(InputArgv[i].begin(), InputArgv[i].end(), Dest);
     Dest[Size-1] = 0;
@@ -839,7 +839,7 @@
 // specified memory location...
 //
 void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) {
-  DOUT << "Initializing " << Addr << " ";
+  DOUT << "JIT: Initializing " << Addr << " ";
   DEBUG(Init->dump());
   if (isa<UndefValue>(Init)) {
     return;
@@ -989,7 +989,6 @@
 // already in the map.
 void ExecutionEngine::EmitGlobalVariable(const GlobalVariable *GV) {
   void *GA = getPointerToGlobalIfAvailable(GV);
-  DOUT << "Global '" << GV->getName() << "' -> " << GA << "\n";
 
   if (GA == 0) {
     // If it's not already specified, allocate memory for the global.

Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=58807&r1=58806&r2=58807&view=diff

==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Thu Nov  6 11:46:04 2008
@@ -226,7 +226,7 @@
   if (!idx) {
     idx = ++nextGOTIndex;
     revGOTMap[addr] = idx;
-    DOUT << "Adding GOT entry " << idx << " for addr " << addr << "\n";
+    DOUT << "JIT: Adding GOT entry " << idx << " for addr " << addr << "\n";
   }
   return idx;
 }
@@ -664,7 +664,7 @@
   size_t GVSize = (size_t)TheJIT->getTargetData()->getABITypeSize(ElTy);
   size_t GVAlign = 
       (size_t)TheJIT->getTargetData()->getPreferredAlignment(GV);
-  DOUT << "Adding in size " << GVSize << " alignment " << GVAlign;
+  DOUT << "JIT: Adding in size " << GVSize << " alignment " << GVAlign;
   DEBUG(GV->dump());
   // Assume code section ends with worst possible alignment, so first
   // variable needs maximal padding.
@@ -787,7 +787,7 @@
       }
     }
   }
-  DOUT << "About to look through initializers\n";
+  DOUT << "JIT: About to look through initializers\n";
   // Look for more globals that are referenced only from initializers.
   // GVSet.end is computed each time because the set can grow as we go.
   for (std::set<const GlobalVariable *>::iterator I = GVSet.begin(); 
@@ -801,11 +801,14 @@
 }
 
 void JITEmitter::startFunction(MachineFunction &F) {
+  DOUT << "JIT: Starting CodeGen of Function "
+       << F.getFunction()->getName() << "\n";
+
   uintptr_t ActualSize = 0;
   // Set the memory writable, if it's not already
   MemMgr->setMemoryWritable();
   if (MemMgr->NeedsExactSize()) {
-    DOUT << "ExactSize\n";
+    DOUT << "JIT: ExactSize\n";
     const TargetInstrInfo* TII = F.getTarget().getInstrInfo();
     MachineJumpTableInfo *MJTI = F.getJumpTableInfo();
     MachineConstantPool *MCP = F.getConstantPool();
@@ -833,12 +836,12 @@
     // Add the function size
     ActualSize += TII->GetFunctionSizeInBytes(F);
 
-    DOUT << "ActualSize before globals " << ActualSize << "\n";
+    DOUT << "JIT: ActualSize before globals " << ActualSize << "\n";
     // Add the size of the globals that will be allocated after this function.
     // These are all the ones referenced from this function that were not
     // previously allocated.
     ActualSize += GetSizeOfGlobalsInBytes(F);
-    DOUT << "ActualSize after globals " << ActualSize << "\n";
+    DOUT << "JIT: ActualSize after globals " << ActualSize << "\n";
   }
 
   BufferBegin = CurBufferPtr = MemMgr->startFunctionBody(F.getFunction(),
@@ -912,7 +915,7 @@
         unsigned idx = Resolver.getGOTIndexForAddr(ResultPtr);
         MR.setGOTIndex(idx);
         if (((void**)MemMgr->getGOTBase())[idx] != ResultPtr) {
-          DOUT << "GOT was out of date for " << ResultPtr
+          DOUT << "JIT: GOT was out of date for " << ResultPtr
                << " pointing at " << ((void**)MemMgr->getGOTBase())[idx]
                << "\n";
           ((void**)MemMgr->getGOTBase())[idx] = ResultPtr;
@@ -928,7 +931,7 @@
   if (MemMgr->isManagingGOT()) {
     unsigned idx = Resolver.getGOTIndexForAddr((void*)BufferBegin);
     if (((void**)MemMgr->getGOTBase())[idx] != (void*)BufferBegin) {
-      DOUT << "GOT was out of date for " << (void*)BufferBegin
+      DOUT << "JIT: GOT was out of date for " << (void*)BufferBegin
            << " pointing at " << ((void**)MemMgr->getGOTBase())[idx] << "\n";
       ((void**)MemMgr->getGOTBase())[idx] = (void*)BufferBegin;
     }
@@ -958,16 +961,16 @@
 
 #ifndef NDEBUG
   {
+    DOUT << "JIT: Disassembled code:\n";
     if (sys::hasDisassembler())
-      DOUT << "Disassembled code:\n"
-           << sys::disassembleBuffer(FnStart, FnEnd-FnStart, (uintptr_t)FnStart);
+      DOUT << sys::disassembleBuffer(FnStart, FnEnd-FnStart, (uintptr_t)FnStart);
     else {
       DOUT << std::hex;
       int i;
       unsigned char* q = FnStart;
       for (i=1; q!=FnEnd; q++, i++) {
         if (i%8==1)
-          DOUT << "0x" << (long)q << ": ";
+          DOUT << "JIT: 0x" << (long)q << ": ";
         DOUT<< std::setw(2) << std::setfill('0') << (unsigned short)*q << " ";
         if (i%8==0)
           DOUT << '\n';





More information about the llvm-commits mailing list