summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/bugpoint/ExtractFunction.cpp6
-rw-r--r--llvm/tools/bugpoint/OptimizerDriver.cpp8
-rw-r--r--llvm/tools/bugpoint/ToolRunner.cpp53
-rw-r--r--llvm/tools/lli/lli.cpp4
-rw-r--r--llvm/tools/llvm-dwarfdump/Statistics.cpp15
-rw-r--r--llvm/tools/llvm-mca/Backend.cpp8
-rw-r--r--llvm/tools/llvm-mca/Dispatch.cpp13
-rw-r--r--llvm/tools/llvm-mca/InstrBuilder.cpp22
-rw-r--r--llvm/tools/llvm-mca/LSUnit.cpp16
-rw-r--r--llvm/tools/llvm-mca/Scheduler.cpp19
-rw-r--r--llvm/tools/verify-uselistorder/verify-uselistorder.cpp42
11 files changed, 106 insertions, 100 deletions
diff --git a/llvm/tools/bugpoint/ExtractFunction.cpp b/llvm/tools/bugpoint/ExtractFunction.cpp
index 343ecd54b48..48f1575c25e 100644
--- a/llvm/tools/bugpoint/ExtractFunction.cpp
+++ b/llvm/tools/bugpoint/ExtractFunction.cpp
@@ -324,9 +324,9 @@ llvm::SplitFunctionsOutOfModule(Module *M, const std::vector<Function *> &F,
std::set<Function *> TestFunctions;
for (unsigned i = 0, e = F.size(); i != e; ++i) {
Function *TNOF = cast<Function>(VMap[F[i]]);
- DEBUG(errs() << "Removing function ");
- DEBUG(TNOF->printAsOperand(errs(), false));
- DEBUG(errs() << "\n");
+ LLVM_DEBUG(errs() << "Removing function ");
+ LLVM_DEBUG(TNOF->printAsOperand(errs(), false));
+ LLVM_DEBUG(errs() << "\n");
TestFunctions.insert(cast<Function>(NewVMap[TNOF]));
DeleteFunctionBody(TNOF); // Function is now external in this module!
}
diff --git a/llvm/tools/bugpoint/OptimizerDriver.cpp b/llvm/tools/bugpoint/OptimizerDriver.cpp
index 34f447831d0..bdb6c5f1941 100644
--- a/llvm/tools/bugpoint/OptimizerDriver.cpp
+++ b/llvm/tools/bugpoint/OptimizerDriver.cpp
@@ -226,10 +226,10 @@ bool BugDriver::runPasses(Module &Program,
Args.push_back(*ExtraArgs);
Args.push_back(nullptr);
- DEBUG(errs() << "\nAbout to run:\t";
- for (unsigned i = 0, e = Args.size() - 1; i != e; ++i) errs()
- << " " << Args[i];
- errs() << "\n";);
+ LLVM_DEBUG(errs() << "\nAbout to run:\t";
+ for (unsigned i = 0, e = Args.size() - 1; i != e; ++i) errs()
+ << " " << Args[i];
+ errs() << "\n";);
Optional<StringRef> Redirects[3] = {None, None, None};
// Redirect stdout and stderr to nowhere if SilencePasses is given.
diff --git a/llvm/tools/bugpoint/ToolRunner.cpp b/llvm/tools/bugpoint/ToolRunner.cpp
index ea0128d0e82..2fb9f93ad7d 100644
--- a/llvm/tools/bugpoint/ToolRunner.cpp
+++ b/llvm/tools/bugpoint/ToolRunner.cpp
@@ -194,10 +194,10 @@ Expected<int> LLI::ExecuteProgram(const std::string &Bitcode,
outs() << "<lli>";
outs().flush();
- DEBUG(errs() << "\nAbout to run:\t";
- for (unsigned i = 0, e = LLIArgs.size() - 1; i != e; ++i) errs()
- << " " << LLIArgs[i];
- errs() << "\n";);
+ LLVM_DEBUG(errs() << "\nAbout to run:\t";
+ for (unsigned i = 0, e = LLIArgs.size() - 1; i != e; ++i) errs()
+ << " " << LLIArgs[i];
+ errs() << "\n";);
return RunProgramWithTimeout(LLIPath, &LLIArgs[0], InputFile, OutputFile,
OutputFile, Timeout, MemoryLimit);
}
@@ -481,10 +481,10 @@ Expected<CC::FileType> LLC::OutputCode(const std::string &Bitcode,
outs() << (UseIntegratedAssembler ? "<llc-ia>" : "<llc>");
outs().flush();
- DEBUG(errs() << "\nAbout to run:\t";
- for (unsigned i = 0, e = LLCArgs.size() - 1; i != e; ++i) errs()
- << " " << LLCArgs[i];
- errs() << "\n";);
+ LLVM_DEBUG(errs() << "\nAbout to run:\t";
+ for (unsigned i = 0, e = LLCArgs.size() - 1; i != e; ++i) errs()
+ << " " << LLCArgs[i];
+ errs() << "\n";);
if (RunProgramWithTimeout(LLCPath, &LLCArgs[0], "", "", "", Timeout,
MemoryLimit))
return ProcessFailure(LLCPath, &LLCArgs[0], Timeout, MemoryLimit);
@@ -601,11 +601,11 @@ Expected<int> JIT::ExecuteProgram(const std::string &Bitcode,
outs() << "<jit>";
outs().flush();
- DEBUG(errs() << "\nAbout to run:\t";
- for (unsigned i = 0, e = JITArgs.size() - 1; i != e; ++i) errs()
- << " " << JITArgs[i];
- errs() << "\n";);
- DEBUG(errs() << "\nSending output to " << OutputFile << "\n");
+ LLVM_DEBUG(errs() << "\nAbout to run:\t";
+ for (unsigned i = 0, e = JITArgs.size() - 1; i != e; ++i) errs()
+ << " " << JITArgs[i];
+ errs() << "\n";);
+ LLVM_DEBUG(errs() << "\nSending output to " << OutputFile << "\n");
return RunProgramWithTimeout(LLIPath, &JITArgs[0], InputFile, OutputFile,
OutputFile, Timeout, MemoryLimit);
}
@@ -710,10 +710,10 @@ Expected<int> CC::ExecuteProgram(const std::string &ProgramFile,
outs() << "<CC>";
outs().flush();
- DEBUG(errs() << "\nAbout to run:\t";
- for (unsigned i = 0, e = CCArgs.size() - 1; i != e; ++i) errs()
- << " " << CCArgs[i];
- errs() << "\n";);
+ LLVM_DEBUG(errs() << "\nAbout to run:\t";
+ for (unsigned i = 0, e = CCArgs.size() - 1; i != e; ++i) errs()
+ << " " << CCArgs[i];
+ errs() << "\n";);
if (RunProgramWithTimeout(CCPath, &CCArgs[0], "", "", ""))
return ProcessFailure(CCPath, &CCArgs[0]);
@@ -758,15 +758,16 @@ Expected<int> CC::ExecuteProgram(const std::string &ProgramFile,
// Now that we have a binary, run it!
outs() << "<program>";
outs().flush();
- DEBUG(errs() << "\nAbout to run:\t";
- for (unsigned i = 0, e = ProgramArgs.size() - 1; i != e; ++i) errs()
- << " " << ProgramArgs[i];
- errs() << "\n";);
+ LLVM_DEBUG(
+ errs() << "\nAbout to run:\t";
+ for (unsigned i = 0, e = ProgramArgs.size() - 1; i != e; ++i) errs()
+ << " " << ProgramArgs[i];
+ errs() << "\n";);
FileRemover OutputBinaryRemover(OutputBinary.str(), !SaveTemps);
if (RemoteClientPath.empty()) {
- DEBUG(errs() << "<run locally>");
+ LLVM_DEBUG(errs() << "<run locally>");
std::string Error;
int ExitCode = RunProgramWithTimeout(OutputBinary.str(), &ProgramArgs[0],
InputFile, OutputFile, OutputFile,
@@ -855,10 +856,10 @@ Error CC::MakeSharedObject(const std::string &InputFile, FileType fileType,
outs() << "<CC>";
outs().flush();
- DEBUG(errs() << "\nAbout to run:\t";
- for (unsigned i = 0, e = CCArgs.size() - 1; i != e; ++i) errs()
- << " " << CCArgs[i];
- errs() << "\n";);
+ LLVM_DEBUG(errs() << "\nAbout to run:\t";
+ for (unsigned i = 0, e = CCArgs.size() - 1; i != e; ++i) errs()
+ << " " << CCArgs[i];
+ errs() << "\n";);
if (RunProgramWithTimeout(CCPath, &CCArgs[0], "", "", ""))
return ProcessFailure(CCPath, &CCArgs[0]);
return Error::success();
diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp
index c24c1de383b..17957c97e2c 100644
--- a/llvm/tools/lli/lli.cpp
+++ b/llvm/tools/lli/lli.cpp
@@ -637,8 +637,8 @@ int main(int argc, char **argv, char * const *envp) {
// FIXME: argv and envp handling.
JITTargetAddress Entry = EE->getFunctionAddress(EntryFn->getName().str());
EE->finalizeObject();
- DEBUG(dbgs() << "Executing '" << EntryFn->getName() << "' at 0x"
- << format("%llx", Entry) << "\n");
+ LLVM_DEBUG(dbgs() << "Executing '" << EntryFn->getName() << "' at 0x"
+ << format("%llx", Entry) << "\n");
Result = ExitOnErr(R->callIntVoid(Entry));
// Like static constructors, the remote target MCJIT support doesn't handle
diff --git a/llvm/tools/llvm-dwarfdump/Statistics.cpp b/llvm/tools/llvm-dwarfdump/Statistics.cpp
index 9a7454a5262..5a274e1935d 100644
--- a/llvm/tools/llvm-dwarfdump/Statistics.cpp
+++ b/llvm/tools/llvm-dwarfdump/Statistics.cpp
@@ -165,11 +165,11 @@ static void collectStatsRecursive(DWARFDie Die, std::string Prefix,
/// \{
static void printDatum(raw_ostream &OS, const char *Key, StringRef Value) {
OS << ",\"" << Key << "\":\"" << Value << '"';
- DEBUG(llvm::dbgs() << Key << ": " << Value << '\n');
+ LLVM_DEBUG(llvm::dbgs() << Key << ": " << Value << '\n');
}
static void printDatum(raw_ostream &OS, const char *Key, uint64_t Value) {
OS << ",\"" << Key << "\":" << Value;
- DEBUG(llvm::dbgs() << Key << ": " << Value << '\n');
+ LLVM_DEBUG(llvm::dbgs() << Key << ": " << Value << '\n');
}
/// \}
@@ -206,8 +206,9 @@ bool collectStatsForObjectFile(ObjectFile &Obj, DWARFContext &DICtx,
VarWithLoc += Stats.TotalVarWithLoc + Constants;
VarTotal += TotalVars + Constants;
VarUnique += Stats.VarsInFunction.size();
- DEBUG(for (auto V : Stats.VarsInFunction)
- llvm::dbgs() << Entry.getKey() << ": " << V << "\n");
+ LLVM_DEBUG(for (auto V
+ : Stats.VarsInFunction) llvm::dbgs()
+ << Entry.getKey() << ": " << V << "\n");
NumFunctions += Stats.IsFunction;
NumInlinedFunctions += Stats.IsFunction * Stats.NumFnInlined;
}
@@ -215,8 +216,8 @@ bool collectStatsForObjectFile(ObjectFile &Obj, DWARFContext &DICtx,
// Print summary.
OS.SetBufferSize(1024);
OS << "{\"version\":\"" << Version << '"';
- DEBUG(llvm::dbgs() << "Variable location quality metrics\n";
- llvm::dbgs() << "---------------------------------\n");
+ LLVM_DEBUG(llvm::dbgs() << "Variable location quality metrics\n";
+ llvm::dbgs() << "---------------------------------\n");
printDatum(OS, "file", Filename.str());
printDatum(OS, "format", FormatName);
printDatum(OS, "source functions", NumFunctions);
@@ -228,7 +229,7 @@ bool collectStatsForObjectFile(ObjectFile &Obj, DWARFContext &DICtx,
GlobalStats.ScopeBytesFromFirstDefinition);
printDatum(OS, "scope bytes covered", GlobalStats.ScopeBytesCovered);
OS << "}\n";
- DEBUG(
+ LLVM_DEBUG(
llvm::dbgs() << "Total Availability: "
<< (int)std::round((VarWithLoc * 100.0) / VarTotal) << "%\n";
llvm::dbgs() << "PC Ranges covered: "
diff --git a/llvm/tools/llvm-mca/Backend.cpp b/llvm/tools/llvm-mca/Backend.cpp
index de345108fae..4e6ec482eef 100644
--- a/llvm/tools/llvm-mca/Backend.cpp
+++ b/llvm/tools/llvm-mca/Backend.cpp
@@ -48,7 +48,7 @@ void Backend::runCycle(unsigned Cycle) {
}
void Backend::notifyCycleBegin(unsigned Cycle) {
- DEBUG(dbgs() << "[E] Cycle begin: " << Cycle << '\n');
+ LLVM_DEBUG(dbgs() << "[E] Cycle begin: " << Cycle << '\n');
for (HWEventListener *Listener : Listeners)
Listener->onCycleBegin();
@@ -67,8 +67,8 @@ void Backend::notifyStallEvent(const HWStallEvent &Event) {
}
void Backend::notifyResourceAvailable(const ResourceRef &RR) {
- DEBUG(dbgs() << "[E] Resource Available: [" << RR.first << '.' << RR.second
- << "]\n");
+ LLVM_DEBUG(dbgs() << "[E] Resource Available: [" << RR.first << '.'
+ << RR.second << "]\n");
for (HWEventListener *Listener : Listeners)
Listener->onResourceAvailable(RR);
}
@@ -84,7 +84,7 @@ void Backend::notifyReleasedBuffers(ArrayRef<unsigned> Buffers) {
}
void Backend::notifyCycleEnd(unsigned Cycle) {
- DEBUG(dbgs() << "[E] Cycle end: " << Cycle << "\n\n");
+ LLVM_DEBUG(dbgs() << "[E] Cycle end: " << Cycle << "\n\n");
for (HWEventListener *Listener : Listeners)
Listener->onCycleEnd();
}
diff --git a/llvm/tools/llvm-mca/Dispatch.cpp b/llvm/tools/llvm-mca/Dispatch.cpp
index b077f0af21d..2c0227d33a9 100644
--- a/llvm/tools/llvm-mca/Dispatch.cpp
+++ b/llvm/tools/llvm-mca/Dispatch.cpp
@@ -176,7 +176,7 @@ void RegisterFile::collectWrites(SmallVectorImpl<WriteState *> &Writes,
assert(RegID && RegID < RegisterMappings.size());
WriteState *WS = RegisterMappings[RegID].first;
if (WS) {
- DEBUG(dbgs() << "Found a dependent use of RegID=" << RegID << '\n');
+ LLVM_DEBUG(dbgs() << "Found a dependent use of RegID=" << RegID << '\n');
Writes.push_back(WS);
}
@@ -184,8 +184,8 @@ void RegisterFile::collectWrites(SmallVectorImpl<WriteState *> &Writes,
for (MCSubRegIterator I(RegID, &MRI); I.isValid(); ++I) {
WS = RegisterMappings[*I].first;
if (WS && std::find(Writes.begin(), Writes.end(), WS) == Writes.end()) {
- DEBUG(dbgs() << "Found a dependent use of subReg " << *I << " (part of "
- << RegID << ")\n");
+ LLVM_DEBUG(dbgs() << "Found a dependent use of subReg " << *I
+ << " (part of " << RegID << ")\n");
Writes.push_back(WS);
}
}
@@ -254,12 +254,12 @@ void RegisterFile::dump() const {
void DispatchUnit::notifyInstructionDispatched(const InstRef &IR,
ArrayRef<unsigned> UsedRegs) {
- DEBUG(dbgs() << "[E] Instruction Dispatched: " << IR << '\n');
+ LLVM_DEBUG(dbgs() << "[E] Instruction Dispatched: " << IR << '\n');
Owner->notifyInstructionEvent(HWInstructionDispatchedEvent(IR, UsedRegs));
}
void DispatchUnit::notifyInstructionRetired(const InstRef &IR) {
- DEBUG(dbgs() << "[E] Instruction Retired: " << IR << '\n');
+ LLVM_DEBUG(dbgs() << "[E] Instruction Retired: " << IR << '\n');
SmallVector<unsigned, 4> FreedRegs(RAT->getNumRegisterFiles());
for (const std::unique_ptr<WriteState> &WS : IR.getInstruction()->getDefs())
RAT->invalidateRegisterMapping(*WS.get(), FreedRegs);
@@ -302,7 +302,8 @@ void DispatchUnit::updateRAWDependencies(ReadState &RS,
collectWrites(DependentWrites, RS.getRegisterID());
RS.setDependentWrites(DependentWrites.size());
- DEBUG(dbgs() << "Found " << DependentWrites.size() << " dependent writes\n");
+ LLVM_DEBUG(dbgs() << "Found " << DependentWrites.size()
+ << " dependent writes\n");
// We know that this read depends on all the writes in DependentWrites.
// For each write, check if we have ReadAdvance information, and use it
// to figure out in how many cycles this read becomes available.
diff --git a/llvm/tools/llvm-mca/InstrBuilder.cpp b/llvm/tools/llvm-mca/InstrBuilder.cpp
index 7b4ad38d865..bca3e4bc0d7 100644
--- a/llvm/tools/llvm-mca/InstrBuilder.cpp
+++ b/llvm/tools/llvm-mca/InstrBuilder.cpp
@@ -113,7 +113,7 @@ static void initializeUsedResources(InstrDesc &ID,
}
}
- DEBUG({
+ LLVM_DEBUG({
for (const std::pair<uint64_t, ResourceUsage> &R : ID.Resources)
dbgs() << "\t\tMask=" << R.first << ", cy=" << R.second.size() << '\n';
for (const uint64_t R : ID.Buffers)
@@ -259,7 +259,7 @@ static void populateWrites(InstrDesc &ID, const MCInst &MCI,
}
Write.FullyUpdatesSuperRegs = FullyUpdatesSuperRegisters;
Write.IsOptionalDef = false;
- DEBUG({
+ LLVM_DEBUG({
dbgs() << "\t\tOpIdx=" << Write.OpIndex << ", Latency=" << Write.Latency
<< ", WriteResourceID=" << Write.SClassOrWriteResourceID << '\n';
});
@@ -290,10 +290,10 @@ static void populateWrites(InstrDesc &ID, const MCInst &MCI,
Write.IsOptionalDef = false;
assert(Write.RegisterID != 0 && "Expected a valid phys register!");
- DEBUG(dbgs() << "\t\tOpIdx=" << Write.OpIndex << ", PhysReg="
- << Write.RegisterID << ", Latency=" << Write.Latency
- << ", WriteResourceID=" << Write.SClassOrWriteResourceID
- << '\n');
+ LLVM_DEBUG(dbgs() << "\t\tOpIdx=" << Write.OpIndex << ", PhysReg="
+ << Write.RegisterID << ", Latency=" << Write.Latency
+ << ", WriteResourceID=" << Write.SClassOrWriteResourceID
+ << '\n');
}
if (MCDesc.hasOptionalDef()) {
@@ -352,7 +352,7 @@ static void populateReads(InstrDesc &ID, const MCInst &MCI,
Read.UseIndex = CurrentUse;
Read.HasReadAdvanceEntries = HasReadAdvanceEntries;
Read.SchedClassID = SchedClassID;
- DEBUG(dbgs() << "\t\tOpIdx=" << Read.OpIndex);
+ LLVM_DEBUG(dbgs() << "\t\tOpIdx=" << Read.OpIndex);
}
for (unsigned CurrentUse = 0; CurrentUse < NumImplicitUses; ++CurrentUse) {
@@ -362,8 +362,8 @@ static void populateReads(InstrDesc &ID, const MCInst &MCI,
Read.RegisterID = MCDesc.getImplicitUses()[CurrentUse];
Read.HasReadAdvanceEntries = HasReadAdvanceEntries;
Read.SchedClassID = SchedClassID;
- DEBUG(dbgs() << "\t\tOpIdx=" << Read.OpIndex
- << ", RegisterID=" << Read.RegisterID << '\n');
+ LLVM_DEBUG(dbgs() << "\t\tOpIdx=" << Read.OpIndex
+ << ", RegisterID=" << Read.RegisterID << '\n');
}
}
@@ -413,8 +413,8 @@ const InstrDesc &InstrBuilder::createInstrDescImpl(const MCInst &MCI) {
populateWrites(*ID, MCI, MCDesc, SCDesc, STI);
populateReads(*ID, MCI, MCDesc, SCDesc, STI);
- DEBUG(dbgs() << "\t\tMaxLatency=" << ID->MaxLatency << '\n');
- DEBUG(dbgs() << "\t\tNumMicroOps=" << ID->NumMicroOps << '\n');
+ LLVM_DEBUG(dbgs() << "\t\tMaxLatency=" << ID->MaxLatency << '\n');
+ LLVM_DEBUG(dbgs() << "\t\tNumMicroOps=" << ID->NumMicroOps << '\n');
// Now add the new descriptor.
Descriptors[Opcode] = std::move(ID);
diff --git a/llvm/tools/llvm-mca/LSUnit.cpp b/llvm/tools/llvm-mca/LSUnit.cpp
index 1b6d8485cfe..dfd3e53fb49 100644
--- a/llvm/tools/llvm-mca/LSUnit.cpp
+++ b/llvm/tools/llvm-mca/LSUnit.cpp
@@ -36,8 +36,8 @@ void LSUnit::assignLQSlot(unsigned Index) {
assert(!isLQFull());
assert(LoadQueue.count(Index) == 0);
- DEBUG(dbgs() << "[LSUnit] - AssignLQSlot <Idx=" << Index
- << ",slot=" << LoadQueue.size() << ">\n");
+ LLVM_DEBUG(dbgs() << "[LSUnit] - AssignLQSlot <Idx=" << Index
+ << ",slot=" << LoadQueue.size() << ">\n");
LoadQueue.insert(Index);
}
@@ -45,8 +45,8 @@ void LSUnit::assignSQSlot(unsigned Index) {
assert(!isSQFull());
assert(StoreQueue.count(Index) == 0);
- DEBUG(dbgs() << "[LSUnit] - AssignSQSlot <Idx=" << Index
- << ",slot=" << StoreQueue.size() << ">\n");
+ LLVM_DEBUG(dbgs() << "[LSUnit] - AssignSQSlot <Idx=" << Index
+ << ",slot=" << StoreQueue.size() << ">\n");
StoreQueue.insert(Index);
}
@@ -123,15 +123,15 @@ void LSUnit::onInstructionExecuted(const InstRef &IR) {
const unsigned Index = IR.getSourceIndex();
std::set<unsigned>::iterator it = LoadQueue.find(Index);
if (it != LoadQueue.end()) {
- DEBUG(dbgs() << "[LSUnit]: Instruction idx=" << Index
- << " has been removed from the load queue.\n");
+ LLVM_DEBUG(dbgs() << "[LSUnit]: Instruction idx=" << Index
+ << " has been removed from the load queue.\n");
LoadQueue.erase(it);
}
it = StoreQueue.find(Index);
if (it != StoreQueue.end()) {
- DEBUG(dbgs() << "[LSUnit]: Instruction idx=" << Index
- << " has been removed from the store queue.\n");
+ LLVM_DEBUG(dbgs() << "[LSUnit]: Instruction idx=" << Index
+ << " has been removed from the store queue.\n");
StoreQueue.erase(it);
}
diff --git a/llvm/tools/llvm-mca/Scheduler.cpp b/llvm/tools/llvm-mca/Scheduler.cpp
index 5df677d741b..4abdc97bb0e 100644
--- a/llvm/tools/llvm-mca/Scheduler.cpp
+++ b/llvm/tools/llvm-mca/Scheduler.cpp
@@ -245,7 +245,8 @@ void Scheduler::scheduleInstruction(InstRef &IR) {
// If necessary, reserve queue entries in the load-store unit (LSU).
bool Reserved = LSU->reserve(IR);
if (!IR.getInstruction()->isReady() || (Reserved && !LSU->isReady(IR))) {
- DEBUG(dbgs() << "[SCHEDULER] Adding " << Idx << " to the Wait Queue\n");
+ LLVM_DEBUG(dbgs() << "[SCHEDULER] Adding " << Idx
+ << " to the Wait Queue\n");
WaitQueue[Idx] = IR.getInstruction();
return;
}
@@ -266,12 +267,14 @@ void Scheduler::scheduleInstruction(InstRef &IR) {
// resources (i.e. BufferSize=1) is consumed.
if (!IsZeroLatency && !Resources->mustIssueImmediately(Desc)) {
- DEBUG(dbgs() << "[SCHEDULER] Adding " << IR << " to the Ready Queue\n");
+ LLVM_DEBUG(dbgs() << "[SCHEDULER] Adding " << IR
+ << " to the Ready Queue\n");
ReadyQueue[IR.getSourceIndex()] = IR.getInstruction();
return;
}
- DEBUG(dbgs() << "[SCHEDULER] Instruction " << IR << " issued immediately\n");
+ LLVM_DEBUG(dbgs() << "[SCHEDULER] Instruction " << IR
+ << " issued immediately\n");
// Release buffered resources and issue MCIS to the underlying pipelines.
issueInstruction(IR);
}
@@ -441,8 +444,8 @@ void Scheduler::updateIssuedQueue(SmallVectorImpl<InstRef> &Executed) {
++I;
IssuedQueue.erase(ToRemove);
} else {
- DEBUG(dbgs() << "[SCHEDULER]: Instruction " << Entry.first
- << " is still executing.\n");
+ LLVM_DEBUG(dbgs() << "[SCHEDULER]: Instruction " << Entry.first
+ << " is still executing.\n");
++I;
}
}
@@ -450,7 +453,7 @@ void Scheduler::updateIssuedQueue(SmallVectorImpl<InstRef> &Executed) {
void Scheduler::notifyInstructionIssued(
const InstRef &IR, ArrayRef<std::pair<ResourceRef, double>> Used) {
- DEBUG({
+ LLVM_DEBUG({
dbgs() << "[E] Instruction Issued: " << IR << '\n';
for (const std::pair<ResourceRef, unsigned> &Resource : Used) {
dbgs() << "[E] Resource Used: [" << Resource.first.first << '.'
@@ -463,14 +466,14 @@ void Scheduler::notifyInstructionIssued(
void Scheduler::notifyInstructionExecuted(const InstRef &IR) {
LSU->onInstructionExecuted(IR);
- DEBUG(dbgs() << "[E] Instruction Executed: " << IR << '\n');
+ LLVM_DEBUG(dbgs() << "[E] Instruction Executed: " << IR << '\n');
Owner->notifyInstructionEvent(
HWInstructionEvent(HWInstructionEvent::Executed, IR));
DU->onInstructionExecuted(IR.getInstruction()->getRCUTokenID());
}
void Scheduler::notifyInstructionReady(const InstRef &IR) {
- DEBUG(dbgs() << "[E] Instruction Ready: " << IR << '\n');
+ LLVM_DEBUG(dbgs() << "[E] Instruction Ready: " << IR << '\n');
Owner->notifyInstructionEvent(
HWInstructionEvent(HWInstructionEvent::Ready, IR));
}
diff --git a/llvm/tools/verify-uselistorder/verify-uselistorder.cpp b/llvm/tools/verify-uselistorder/verify-uselistorder.cpp
index d0d6f01551f..99c7007e4e9 100644
--- a/llvm/tools/verify-uselistorder/verify-uselistorder.cpp
+++ b/llvm/tools/verify-uselistorder/verify-uselistorder.cpp
@@ -107,7 +107,7 @@ struct ValueMapping {
bool TempFile::init(const std::string &Ext) {
SmallVector<char, 64> Vector;
- DEBUG(dbgs() << " - create-temp-file\n");
+ LLVM_DEBUG(dbgs() << " - create-temp-file\n");
if (auto EC = sys::fs::createTemporaryFile("uselistorder", Ext, Vector)) {
errs() << "verify-uselistorder: error: " << EC.message() << "\n";
return true;
@@ -122,7 +122,7 @@ bool TempFile::init(const std::string &Ext) {
}
bool TempFile::writeBitcode(const Module &M) const {
- DEBUG(dbgs() << " - write bitcode\n");
+ LLVM_DEBUG(dbgs() << " - write bitcode\n");
std::error_code EC;
raw_fd_ostream OS(Filename, EC, sys::fs::F_None);
if (EC) {
@@ -135,7 +135,7 @@ bool TempFile::writeBitcode(const Module &M) const {
}
bool TempFile::writeAssembly(const Module &M) const {
- DEBUG(dbgs() << " - write assembly\n");
+ LLVM_DEBUG(dbgs() << " - write assembly\n");
std::error_code EC;
raw_fd_ostream OS(Filename, EC, sys::fs::F_Text);
if (EC) {
@@ -148,7 +148,7 @@ bool TempFile::writeAssembly(const Module &M) const {
}
std::unique_ptr<Module> TempFile::readBitcode(LLVMContext &Context) const {
- DEBUG(dbgs() << " - read bitcode\n");
+ LLVM_DEBUG(dbgs() << " - read bitcode\n");
ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOr =
MemoryBuffer::getFile(Filename);
if (!BufferOr) {
@@ -169,7 +169,7 @@ std::unique_ptr<Module> TempFile::readBitcode(LLVMContext &Context) const {
}
std::unique_ptr<Module> TempFile::readAssembly(LLVMContext &Context) const {
- DEBUG(dbgs() << " - read assembly\n");
+ LLVM_DEBUG(dbgs() << " - read assembly\n");
SMDiagnostic Err;
std::unique_ptr<Module> M = parseAssemblyFile(Filename, Err, Context);
if (!M.get())
@@ -288,9 +288,9 @@ static void debugSizeMismatch(const ValueMapping &L, const ValueMapping &R) {
#endif
static bool matches(const ValueMapping &LM, const ValueMapping &RM) {
- DEBUG(dbgs() << "compare value maps\n");
+ LLVM_DEBUG(dbgs() << "compare value maps\n");
if (LM.Values.size() != RM.Values.size()) {
- DEBUG(debugSizeMismatch(LM, RM));
+ LLVM_DEBUG(debugSizeMismatch(LM, RM));
return false;
}
@@ -317,22 +317,22 @@ static bool matches(const ValueMapping &LM, const ValueMapping &RM) {
while (LU != LE) {
if (RU == RE) {
- DEBUG(debugUserMismatch(LM, RM, I));
+ LLVM_DEBUG(debugUserMismatch(LM, RM, I));
return false;
}
if (LM.lookup(LU->getUser()) != RM.lookup(RU->getUser())) {
- DEBUG(debugUserMismatch(LM, RM, I));
+ LLVM_DEBUG(debugUserMismatch(LM, RM, I));
return false;
}
if (LU->getOperandNo() != RU->getOperandNo()) {
- DEBUG(debugUserMismatch(LM, RM, I));
+ LLVM_DEBUG(debugUserMismatch(LM, RM, I));
return false;
}
skipUnmappedUsers(++LU, LE, LM);
skipUnmappedUsers(++RU, RE, RM);
}
if (RU != RE) {
- DEBUG(debugUserMismatch(LM, RM, I));
+ LLVM_DEBUG(debugUserMismatch(LM, RM, I));
return false;
}
}
@@ -397,7 +397,7 @@ static void shuffleValueUseLists(Value *V, std::minstd_rand0 &Gen,
// Generate random numbers between 10 and 99, which will line up nicely in
// debug output. We're not worried about collisons here.
- DEBUG(dbgs() << "V = "; V->dump());
+ LLVM_DEBUG(dbgs() << "V = "; V->dump());
std::uniform_int_distribution<short> Dist(10, 99);
SmallDenseMap<const Use *, short, 16> Order;
auto compareUses =
@@ -406,16 +406,16 @@ static void shuffleValueUseLists(Value *V, std::minstd_rand0 &Gen,
for (const Use &U : V->uses()) {
auto I = Dist(Gen);
Order[&U] = I;
- DEBUG(dbgs() << " - order: " << I << ", op = " << U.getOperandNo()
- << ", U = ";
- U.getUser()->dump());
+ LLVM_DEBUG(dbgs() << " - order: " << I << ", op = " << U.getOperandNo()
+ << ", U = ";
+ U.getUser()->dump());
}
} while (std::is_sorted(V->use_begin(), V->use_end(), compareUses));
- DEBUG(dbgs() << " => shuffle\n");
+ LLVM_DEBUG(dbgs() << " => shuffle\n");
V->sortUseList(compareUses);
- DEBUG({
+ LLVM_DEBUG({
for (const Use &U : V->uses()) {
dbgs() << " - order: " << Order.lookup(&U)
<< ", op = " << U.getOperandNo() << ", U = ";
@@ -437,7 +437,7 @@ static void reverseValueUseLists(Value *V, DenseSet<Value *> &Seen) {
// Nothing to shuffle for 0 or 1 users.
return;
- DEBUG({
+ LLVM_DEBUG({
dbgs() << "V = ";
V->dump();
for (const Use &U : V->uses()) {
@@ -449,7 +449,7 @@ static void reverseValueUseLists(Value *V, DenseSet<Value *> &Seen) {
V->reverseUseList();
- DEBUG({
+ LLVM_DEBUG({
for (const Use &U : V->uses()) {
dbgs() << " - order: op = " << U.getOperandNo() << ", U = ";
U.getUser()->dump();
@@ -515,13 +515,13 @@ static void shuffleUseLists(Module &M, unsigned SeedOffset) {
std::minstd_rand0 Gen(std::minstd_rand0::default_seed + SeedOffset);
DenseSet<Value *> Seen;
changeUseLists(M, [&](Value *V) { shuffleValueUseLists(V, Gen, Seen); });
- DEBUG(dbgs() << "\n");
+ LLVM_DEBUG(dbgs() << "\n");
}
static void reverseUseLists(Module &M) {
DenseSet<Value *> Seen;
changeUseLists(M, [&](Value *V) { reverseValueUseLists(V, Seen); });
- DEBUG(dbgs() << "\n");
+ LLVM_DEBUG(dbgs() << "\n");
}
int main(int argc, char **argv) {
OpenPOWER on IntegriCloud