mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 05:22:04 +00:00
remove a few DOUTs here and there.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79832 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -243,13 +243,13 @@ static void *CreateArgv(LLVMContext &C, ExecutionEngine *EE,
|
||||
unsigned PtrSize = EE->getTargetData()->getPointerSize();
|
||||
char *Result = new char[(InputArgv.size()+1)*PtrSize];
|
||||
|
||||
DOUT << "JIT: ARGV = " << (void*)Result << "\n";
|
||||
DEBUG(errs() << "JIT: ARGV = " << (void*)Result << "\n");
|
||||
const Type *SBytePtr = PointerType::getUnqual(Type::getInt8Ty(C));
|
||||
|
||||
for (unsigned i = 0; i != InputArgv.size(); ++i) {
|
||||
unsigned Size = InputArgv[i].size()+1;
|
||||
char *Dest = new char[Size];
|
||||
DOUT << "JIT: ARGV[" << i << "] = " << (void*)Dest << "\n";
|
||||
DEBUG(errs() << "JIT: ARGV[" << i << "] = " << (void*)Dest << "\n");
|
||||
|
||||
std::copy(InputArgv[i].begin(), InputArgv[i].end(), Dest);
|
||||
Dest[Size-1] = 0;
|
||||
@@ -899,7 +899,7 @@ void ExecutionEngine::LoadValueFromMemory(GenericValue &Result,
|
||||
// specified memory location...
|
||||
//
|
||||
void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) {
|
||||
DOUT << "JIT: Initializing " << Addr << " ";
|
||||
DEBUG(errs() << "JIT: Initializing " << Addr << " ");
|
||||
DEBUG(Init->dump());
|
||||
if (isa<UndefValue>(Init)) {
|
||||
return;
|
||||
|
||||
@@ -269,8 +269,8 @@ void *JITResolver::getExternalFunctionStub(void *FnAddr) {
|
||||
Stub = TheJIT->getJITInfo().emitFunctionStub(0, FnAddr,
|
||||
*TheJIT->getCodeEmitter());
|
||||
|
||||
DOUT << "JIT: Stub emitted at [" << Stub
|
||||
<< "] for external function at '" << FnAddr << "'\n";
|
||||
DEBUG(errs() << "JIT: Stub emitted at [" << Stub
|
||||
<< "] for external function at '" << FnAddr << "'\n");
|
||||
return Stub;
|
||||
}
|
||||
|
||||
@@ -279,7 +279,8 @@ unsigned JITResolver::getGOTIndexForAddr(void* addr) {
|
||||
if (!idx) {
|
||||
idx = ++nextGOTIndex;
|
||||
revGOTMap[addr] = idx;
|
||||
DOUT << "JIT: Adding GOT entry " << idx << " for addr [" << addr << "]\n";
|
||||
DEBUG(errs() << "JIT: Adding GOT entry " << idx << " for addr ["
|
||||
<< addr << "]\n");
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
@@ -508,7 +509,7 @@ namespace {
|
||||
MemMgr = JMM ? JMM : JITMemoryManager::CreateDefaultMemManager();
|
||||
if (jit.getJITInfo().needsGOT()) {
|
||||
MemMgr->AllocateGOT();
|
||||
DOUT << "JIT is managing a GOT\n";
|
||||
DEBUG(errs() << "JIT is managing a GOT\n");
|
||||
}
|
||||
|
||||
if (DwarfExceptionHandling) DE = new JITDwarfEmitter(jit);
|
||||
@@ -556,8 +557,8 @@ namespace {
|
||||
if (MBBLocations.size() <= (unsigned)MBB->getNumber())
|
||||
MBBLocations.resize((MBB->getNumber()+1)*2);
|
||||
MBBLocations[MBB->getNumber()] = getCurrentPCValue();
|
||||
DOUT << "JIT: Emitting BB" << MBB->getNumber() << " at ["
|
||||
<< (void*) getCurrentPCValue() << "]\n";
|
||||
DEBUG(errs() << "JIT: Emitting BB" << MBB->getNumber() << " at ["
|
||||
<< (void*) getCurrentPCValue() << "]\n");
|
||||
}
|
||||
|
||||
virtual uintptr_t getConstantPoolEntryAddress(unsigned Entry) const;
|
||||
@@ -756,7 +757,7 @@ unsigned JITEmitter::addSizeOfGlobal(const GlobalVariable *GV, unsigned Size) {
|
||||
size_t GVSize = (size_t)TheJIT->getTargetData()->getTypeAllocSize(ElTy);
|
||||
size_t GVAlign =
|
||||
(size_t)TheJIT->getTargetData()->getPreferredAlignment(GV);
|
||||
DOUT << "JIT: Adding in size " << GVSize << " alignment " << GVAlign;
|
||||
DEBUG(errs() << "JIT: Adding in size " << GVSize << " alignment " << GVAlign);
|
||||
DEBUG(GV->dump());
|
||||
// Assume code section ends with worst possible alignment, so first
|
||||
// variable needs maximal padding.
|
||||
@@ -884,7 +885,7 @@ unsigned JITEmitter::GetSizeOfGlobalsInBytes(MachineFunction &MF) {
|
||||
}
|
||||
}
|
||||
}
|
||||
DOUT << "JIT: About to look through initializers\n";
|
||||
DEBUG(errs() << "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 (SmallPtrSet<const GlobalVariable *, 8>::iterator I = GVSet.begin();
|
||||
@@ -905,7 +906,7 @@ void JITEmitter::startFunction(MachineFunction &F) {
|
||||
// Set the memory writable, if it's not already
|
||||
MemMgr->setMemoryWritable();
|
||||
if (MemMgr->NeedsExactSize()) {
|
||||
DOUT << "JIT: ExactSize\n";
|
||||
DEBUG(errs() << "JIT: ExactSize\n");
|
||||
const TargetInstrInfo* TII = F.getTarget().getInstrInfo();
|
||||
MachineJumpTableInfo *MJTI = F.getJumpTableInfo();
|
||||
MachineConstantPool *MCP = F.getConstantPool();
|
||||
@@ -932,12 +933,12 @@ void JITEmitter::startFunction(MachineFunction &F) {
|
||||
// Add the function size
|
||||
ActualSize += TII->GetFunctionSizeInBytes(F);
|
||||
|
||||
DOUT << "JIT: ActualSize before globals " << ActualSize << "\n";
|
||||
DEBUG(errs() << "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 << "JIT: ActualSize after globals " << ActualSize << "\n";
|
||||
DEBUG(errs() << "JIT: ActualSize after globals " << ActualSize << "\n");
|
||||
} else if (SizeEstimate > 0) {
|
||||
// SizeEstimate will be non-zero on reallocation attempts.
|
||||
ActualSize = SizeEstimate;
|
||||
@@ -994,8 +995,8 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
|
||||
if (MR.isExternalSymbol()) {
|
||||
ResultPtr = TheJIT->getPointerToNamedFunction(MR.getExternalSymbol(),
|
||||
false);
|
||||
DOUT << "JIT: Map \'" << MR.getExternalSymbol() << "\' to ["
|
||||
<< ResultPtr << "]\n";
|
||||
DEBUG(errs() << "JIT: Map \'" << MR.getExternalSymbol() << "\' to ["
|
||||
<< ResultPtr << "]\n");
|
||||
|
||||
// If the target REALLY wants a stub for this function, emit it now.
|
||||
if (!MR.doesntNeedStub()) {
|
||||
@@ -1036,9 +1037,9 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
|
||||
unsigned idx = Resolver.getGOTIndexForAddr(ResultPtr);
|
||||
MR.setGOTIndex(idx);
|
||||
if (((void**)MemMgr->getGOTBase())[idx] != ResultPtr) {
|
||||
DOUT << "JIT: GOT was out of date for " << ResultPtr
|
||||
<< " pointing at " << ((void**)MemMgr->getGOTBase())[idx]
|
||||
<< "\n";
|
||||
DEBUG(errs() << "JIT: GOT was out of date for " << ResultPtr
|
||||
<< " pointing at " << ((void**)MemMgr->getGOTBase())[idx]
|
||||
<< "\n");
|
||||
((void**)MemMgr->getGOTBase())[idx] = ResultPtr;
|
||||
}
|
||||
}
|
||||
@@ -1053,8 +1054,9 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
|
||||
if (MemMgr->isManagingGOT()) {
|
||||
unsigned idx = Resolver.getGOTIndexForAddr((void*)BufferBegin);
|
||||
if (((void**)MemMgr->getGOTBase())[idx] != (void*)BufferBegin) {
|
||||
DOUT << "JIT: GOT was out of date for " << (void*)BufferBegin
|
||||
<< " pointing at " << ((void**)MemMgr->getGOTBase())[idx] << "\n";
|
||||
DEBUG(errs() << "JIT: GOT was out of date for " << (void*)BufferBegin
|
||||
<< " pointing at " << ((void**)MemMgr->getGOTBase())[idx]
|
||||
<< "\n");
|
||||
((void**)MemMgr->getGOTBase())[idx] = (void*)BufferBegin;
|
||||
}
|
||||
}
|
||||
@@ -1092,39 +1094,36 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
|
||||
// Mark code region readable and executable if it's not so already.
|
||||
MemMgr->setMemoryExecutable();
|
||||
|
||||
#ifndef NDEBUG
|
||||
{
|
||||
DEBUG(
|
||||
if (sys::hasDisassembler()) {
|
||||
DOUT << "JIT: Disassembled code:\n";
|
||||
DOUT << sys::disassembleBuffer(FnStart, FnEnd-FnStart, (uintptr_t)FnStart);
|
||||
errs() << "JIT: Disassembled code:\n";
|
||||
errs() << sys::disassembleBuffer(FnStart, FnEnd-FnStart,
|
||||
(uintptr_t)FnStart);
|
||||
} else {
|
||||
DOUT << "JIT: Binary code:\n";
|
||||
DOUT << std::hex;
|
||||
errs() << "JIT: Binary code:\n";
|
||||
uint8_t* q = FnStart;
|
||||
for (int i = 0; q < FnEnd; q += 4, ++i) {
|
||||
if (i == 4)
|
||||
i = 0;
|
||||
if (i == 0)
|
||||
DOUT << "JIT: " << std::setw(8) << std::setfill('0')
|
||||
<< (long)(q - FnStart) << ": ";
|
||||
errs() << "JIT: " << (long)(q - FnStart) << ": ";
|
||||
bool Done = false;
|
||||
for (int j = 3; j >= 0; --j) {
|
||||
if (q + j >= FnEnd)
|
||||
Done = true;
|
||||
else
|
||||
DOUT << std::setw(2) << std::setfill('0') << (unsigned short)q[j];
|
||||
errs() << (unsigned short)q[j];
|
||||
}
|
||||
if (Done)
|
||||
break;
|
||||
DOUT << ' ';
|
||||
errs() << ' ';
|
||||
if (i == 3)
|
||||
DOUT << '\n';
|
||||
errs() << '\n';
|
||||
}
|
||||
DOUT << std::dec;
|
||||
DOUT<< '\n';
|
||||
errs()<< '\n';
|
||||
}
|
||||
}
|
||||
#endif
|
||||
);
|
||||
|
||||
if (DwarfExceptionHandling) {
|
||||
uintptr_t ActualSize = 0;
|
||||
SavedBufferBegin = BufferBegin;
|
||||
@@ -1155,7 +1154,7 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
|
||||
}
|
||||
|
||||
void JITEmitter::retryWithMoreMemory(MachineFunction &F) {
|
||||
DOUT << "JIT: Ran out of space for native code. Reattempting.\n";
|
||||
DEBUG(errs() << "JIT: Ran out of space for native code. Reattempting.\n");
|
||||
Relocations.clear(); // Clear the old relocations or we'll reapply them.
|
||||
ConstPoolAddresses.clear();
|
||||
++NumRetries;
|
||||
@@ -1190,7 +1189,7 @@ void JITEmitter::deallocateMemForFunction(const Function *F) {
|
||||
// in the JITResolver. Were there a memory manager deallocateStub routine,
|
||||
// we could call that at this point too.
|
||||
if (FnRefs.empty()) {
|
||||
DOUT << "\nJIT: Invalidated Stub at [" << Stub << "]\n";
|
||||
DEBUG(errs() << "\nJIT: Invalidated Stub at [" << Stub << "]\n");
|
||||
StubFnRefs.erase(Stub);
|
||||
|
||||
// Invalidate the stub. If it is a GV stub, update the JIT's global
|
||||
@@ -1245,8 +1244,8 @@ void JITEmitter::emitConstantPool(MachineConstantPool *MCP) {
|
||||
|
||||
if (ConstantPoolBase == 0) return; // Buffer overflow.
|
||||
|
||||
DOUT << "JIT: Emitted constant pool at [" << ConstantPoolBase
|
||||
<< "] (size: " << Size << ", alignment: " << Align << ")\n";
|
||||
DEBUG(errs() << "JIT: Emitted constant pool at [" << ConstantPoolBase
|
||||
<< "] (size: " << Size << ", alignment: " << Align << ")\n");
|
||||
|
||||
// Initialize the memory for all of the constant pool entries.
|
||||
unsigned Offset = 0;
|
||||
@@ -1263,8 +1262,8 @@ void JITEmitter::emitConstantPool(MachineConstantPool *MCP) {
|
||||
"entry has not been implemented!");
|
||||
}
|
||||
TheJIT->InitializeMemory(CPE.Val.ConstVal, (void*)CAddr);
|
||||
DOUT << "JIT: CP" << i << " at [0x"
|
||||
<< std::hex << CAddr << std::dec << "]\n";
|
||||
DEBUG(errs() << "JIT: CP" << i << " at [0x";
|
||||
errs().write_hex(CAddr) << "]\n");
|
||||
|
||||
const Type *Ty = CPE.Val.ConstVal->getType();
|
||||
Offset += TheJIT->getTargetData()->getTypeAllocSize(Ty);
|
||||
|
||||
@@ -357,7 +357,7 @@ namespace {
|
||||
// another block of memory and add it to the free list.
|
||||
if (largest < ActualSize ||
|
||||
largest <= FreeRangeHeader::getMinBlockSize()) {
|
||||
DOUT << "JIT: Allocating another slab of memory for function.";
|
||||
DEBUG(errs() << "JIT: Allocating another slab of memory for function.");
|
||||
candidateBlock = allocateNewCodeSlab((size_t)ActualSize);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,9 +50,9 @@ OProfileJITEventListener::OProfileJITEventListener()
|
||||
: Agent(op_open_agent()) {
|
||||
if (Agent == NULL) {
|
||||
const std::string err_str = sys::StrError();
|
||||
DOUT << "Failed to connect to OProfile agent: " << err_str << "\n";
|
||||
DEBUG(errs() << "Failed to connect to OProfile agent: " << err_str << "\n");
|
||||
} else {
|
||||
DOUT << "Connected to OProfile agent.\n";
|
||||
DEBUG(errs() << "Connected to OProfile agent.\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,9 +60,10 @@ OProfileJITEventListener::~OProfileJITEventListener() {
|
||||
if (Agent != NULL) {
|
||||
if (op_close_agent(Agent) == -1) {
|
||||
const std::string err_str = sys::StrError();
|
||||
DOUT << "Failed to disconnect from OProfile agent: " << err_str << "\n";
|
||||
DEBUG(errs() << "Failed to disconnect from OProfile agent: "
|
||||
<< err_str << "\n");
|
||||
} else {
|
||||
DOUT << "Disconnected from OProfile agent.\n";
|
||||
DEBUG(errs() << "Disconnected from OProfile agent.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,8 +100,8 @@ static debug_line_info LineStartToOProfileFormat(
|
||||
const DebugLocTuple& tuple = MF.getDebugLocTuple(Loc);
|
||||
Result.lineno = tuple.Line;
|
||||
Result.filename = Filenames.getFilename(tuple.CompileUnit);
|
||||
DOUT << "Mapping " << reinterpret_cast<void*>(Result.vma) << " to "
|
||||
<< Result.filename << ":" << Result.lineno << "\n";
|
||||
DEBUG(errs() << "Mapping " << reinterpret_cast<void*>(Result.vma) << " to "
|
||||
<< Result.filename << ":" << Result.lineno << "\n");
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user