mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-19 10:53:55 +00:00
Let printf do the formatting instead aligning strings ourselves.
While at it, merge some format strings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142140 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
47b8798c0b
commit
962bad70f4
@ -6592,7 +6592,7 @@ static void DumpNodesr(raw_ostream &OS, const SDNode *N, unsigned indent,
|
||||
return;
|
||||
|
||||
// Dump the current SDNode, but don't end the line yet.
|
||||
OS << std::string(indent, ' ');
|
||||
OS.indent(indent);
|
||||
N->printr(OS, G);
|
||||
|
||||
// Having printed this SDNode, walk the children:
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "llvm/MC/SubtargetFeature.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/Format.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include <algorithm>
|
||||
@ -154,21 +155,19 @@ static void Help(const SubtargetFeatureKV *CPUTable, size_t CPUTableSize,
|
||||
// Print the CPU table.
|
||||
errs() << "Available CPUs for this target:\n\n";
|
||||
for (size_t i = 0; i != CPUTableSize; i++)
|
||||
errs() << " " << CPUTable[i].Key
|
||||
<< std::string(MaxCPULen - std::strlen(CPUTable[i].Key), ' ')
|
||||
<< " - " << CPUTable[i].Desc << ".\n";
|
||||
errs() << "\n";
|
||||
|
||||
errs() << format(" %-*s - %s.\n",
|
||||
MaxCPULen, CPUTable[i].Key, CPUTable[i].Desc);
|
||||
errs() << '\n';
|
||||
|
||||
// Print the Feature table.
|
||||
errs() << "Available features for this target:\n\n";
|
||||
for (size_t i = 0; i != FeatTableSize; i++)
|
||||
errs() << " " << FeatTable[i].Key
|
||||
<< std::string(MaxFeatLen - std::strlen(FeatTable[i].Key), ' ')
|
||||
<< " - " << FeatTable[i].Desc << ".\n";
|
||||
errs() << "\n";
|
||||
|
||||
errs() << format(" %-*s - %s.\n",
|
||||
MaxFeatLen, FeatTable[i].Key, FeatTable[i].Desc);
|
||||
errs() << '\n';
|
||||
|
||||
errs() << "Use +feature to enable a feature, or -feature to disable it.\n"
|
||||
<< "For example, llc -mcpu=mycpu -mattr=+feature1,-feature2\n";
|
||||
"For example, llc -mcpu=mycpu -mattr=+feature1,-feature2\n";
|
||||
std::exit(1);
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/Format.h"
|
||||
#include "llvm/Support/ManagedStatic.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Support/Mutex.h"
|
||||
@ -126,13 +127,11 @@ void llvm::PrintStatistics(raw_ostream &OS) {
|
||||
<< "===" << std::string(73, '-') << "===\n\n";
|
||||
|
||||
// Print all of the statistics.
|
||||
for (size_t i = 0, e = Stats.Stats.size(); i != e; ++i) {
|
||||
std::string CountStr = utostr(Stats.Stats[i]->getValue());
|
||||
OS << std::string(MaxValLen-CountStr.size(), ' ')
|
||||
<< CountStr << " " << Stats.Stats[i]->getName()
|
||||
<< std::string(MaxNameLen-std::strlen(Stats.Stats[i]->getName()), ' ')
|
||||
<< " - " << Stats.Stats[i]->getDesc() << "\n";
|
||||
}
|
||||
for (size_t i = 0, e = Stats.Stats.size(); i != e; ++i)
|
||||
OS << format("%*u %-*s - %s\n",
|
||||
MaxValLen, Stats.Stats[i]->getValue(),
|
||||
MaxNameLen, Stats.Stats[i]->getName(),
|
||||
Stats.Stats[i]->getDesc());
|
||||
|
||||
OS << '\n'; // Flush the output stream.
|
||||
OS.flush();
|
||||
|
@ -168,10 +168,8 @@ void Timer::stopTimer() {
|
||||
static void printVal(double Val, double Total, raw_ostream &OS) {
|
||||
if (Total < 1e-7) // Avoid dividing by zero.
|
||||
OS << " ----- ";
|
||||
else {
|
||||
OS << " " << format("%7.4f", Val) << " (";
|
||||
OS << format("%5.1f", Val*100/Total) << "%)";
|
||||
}
|
||||
else
|
||||
OS << format(" %7.4f (%5.1f%%)", Val, Val*100/Total);
|
||||
}
|
||||
|
||||
void TimeRecord::print(const TimeRecord &Total, raw_ostream &OS) const {
|
||||
@ -186,7 +184,7 @@ void TimeRecord::print(const TimeRecord &Total, raw_ostream &OS) const {
|
||||
OS << " ";
|
||||
|
||||
if (Total.getMemUsed())
|
||||
OS << format("%9lld", (long long)getMemUsed()) << " ";
|
||||
OS << format("%9lld ", (long long)getMemUsed());
|
||||
}
|
||||
|
||||
|
||||
@ -332,11 +330,9 @@ void TimerGroup::PrintQueuedTimers(raw_ostream &OS) {
|
||||
// If this is not an collection of ungrouped times, print the total time.
|
||||
// Ungrouped timers don't really make sense to add up. We still print the
|
||||
// TOTAL line to make the percentages make sense.
|
||||
if (this != DefaultTimerGroup) {
|
||||
OS << " Total Execution Time: ";
|
||||
OS << format("%5.4f", Total.getProcessTime()) << " seconds (";
|
||||
OS << format("%5.4f", Total.getWallTime()) << " wall clock)\n";
|
||||
}
|
||||
if (this != DefaultTimerGroup)
|
||||
OS << format(" Total Execution Time: %5.4f seconds (%5.4f wall clock)\n",
|
||||
Total.getProcessTime(), Total.getWallTime());
|
||||
OS << '\n';
|
||||
|
||||
if (Total.getUserTime())
|
||||
|
@ -1474,7 +1474,7 @@ bool FunctionPassManagerImpl::run(Function &F) {
|
||||
char FPPassManager::ID = 0;
|
||||
/// Print passes managed by this manager
|
||||
void FPPassManager::dumpPassStructure(unsigned Offset) {
|
||||
llvm::dbgs() << std::string(Offset*2, ' ') << "FunctionPass Manager\n";
|
||||
dbgs().indent(Offset*2) << "FunctionPass Manager\n";
|
||||
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
|
||||
FunctionPass *FP = getContainedPass(Index);
|
||||
FP->dumpPassStructure(Offset + 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user