summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp2
-rw-r--r--lib/MC/SubtargetFeature.cpp21
-rw-r--r--lib/Support/Statistic.cpp13
-rw-r--r--lib/Support/Timer.cpp16
-rw-r--r--lib/VMCore/PassManager.cpp2
5 files changed, 24 insertions, 30 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index d9d0d2709c..632b6146ac 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -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:
diff --git a/lib/MC/SubtargetFeature.cpp b/lib/MC/SubtargetFeature.cpp
index 348cd4c9ab..4f23a85d62 100644
--- a/lib/MC/SubtargetFeature.cpp
+++ b/lib/MC/SubtargetFeature.cpp
@@ -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);
}
diff --git a/lib/Support/Statistic.cpp b/lib/Support/Statistic.cpp
index 1e733d92e6..04a44a0f71 100644
--- a/lib/Support/Statistic.cpp
+++ b/lib/Support/Statistic.cpp
@@ -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();
diff --git a/lib/Support/Timer.cpp b/lib/Support/Timer.cpp
index a9ed5eecfa..03ac9632f0 100644
--- a/lib/Support/Timer.cpp
+++ b/lib/Support/Timer.cpp
@@ -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())
diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp
index ecedb1db66..1aaf765ca4 100644
--- a/lib/VMCore/PassManager.cpp
+++ b/lib/VMCore/PassManager.cpp
@@ -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);