diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-11-06 17:46:04 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-11-06 17:46:04 +0000 |
commit | eb5d95a22df7ab88815f35bdc8b6e5d3a6a1119d (patch) | |
tree | 0f215190ec44f48bd1006bb57ec4f4a83b7873c6 /lib/ExecutionEngine | |
parent | 274c6a614577cb41d784149eb7fcf6cb2ed2398f (diff) | |
download | external_llvm-eb5d95a22df7ab88815f35bdc8b6e5d3a6a1119d.zip external_llvm-eb5d95a22df7ab88815f35bdc8b6e5d3a6a1119d.tar.gz external_llvm-eb5d95a22df7ab88815f35bdc8b6e5d3a6a1119d.tar.bz2 |
Improve JIT debugging outputs format consistency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58807 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine')
-rw-r--r-- | lib/ExecutionEngine/ExecutionEngine.cpp | 9 | ||||
-rw-r--r-- | lib/ExecutionEngine/JIT/JITEmitter.cpp | 25 |
2 files changed, 18 insertions, 16 deletions
diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index 18d4481..7cc9b93 100644 --- a/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/lib/ExecutionEngine/ExecutionEngine.cpp @@ -94,7 +94,7 @@ Function *ExecutionEngine::FindFunctionNamed(const char *FnName) { 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 @@ static void *CreateArgv(ExecutionEngine *EE, 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 @@ void ExecutionEngine::LoadValueFromMemory(GenericValue &Result, // 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 @@ void ExecutionEngine::emitGlobals() { // 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. diff --git a/lib/ExecutionEngine/JIT/JITEmitter.cpp b/lib/ExecutionEngine/JIT/JITEmitter.cpp index 60c9cd0..51efcad 100644 --- a/lib/ExecutionEngine/JIT/JITEmitter.cpp +++ b/lib/ExecutionEngine/JIT/JITEmitter.cpp @@ -226,7 +226,7 @@ unsigned JITResolver::getGOTIndexForAddr(void* addr) { 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 @@ unsigned JITEmitter::addSizeOfGlobal(const GlobalVariable *GV, unsigned Size) { 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 @@ unsigned JITEmitter::GetSizeOfGlobalsInBytes(MachineFunction &MF) { } } } - 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 @@ unsigned JITEmitter::GetSizeOfGlobalsInBytes(MachineFunction &MF) { } 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 @@ void JITEmitter::startFunction(MachineFunction &F) { // 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 @@ bool JITEmitter::finishFunction(MachineFunction &F) { 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 @@ bool JITEmitter::finishFunction(MachineFunction &F) { 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 @@ bool JITEmitter::finishFunction(MachineFunction &F) { #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'; |