mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
remove some uses of llvm/Support/Streams.h
llvm-svn: 79842
This commit is contained in:
parent
b0478019b4
commit
e22a1d941e
@ -19,12 +19,12 @@
|
|||||||
#include "llvm/System/Mutex.h"
|
#include "llvm/System/Mutex.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <iosfwd>
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
class TimerGroup;
|
class TimerGroup;
|
||||||
|
class raw_ostream;
|
||||||
|
|
||||||
/// Timer - This class is used to track the amount of time spent between
|
/// Timer - This class is used to track the amount of time spent between
|
||||||
/// invocations of it's startTimer()/stopTimer() methods. Given appropriate OS
|
/// invocations of it's startTimer()/stopTimer() methods. Given appropriate OS
|
||||||
@ -112,7 +112,7 @@ public:
|
|||||||
|
|
||||||
/// print - Print the current timer to standard error, and reset the "Started"
|
/// print - Print the current timer to standard error, and reset the "Started"
|
||||||
/// flag.
|
/// flag.
|
||||||
void print(const Timer &Total, std::ostream &OS);
|
void print(const Timer &Total, raw_ostream &OS);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class TimerGroup;
|
friend class TimerGroup;
|
||||||
|
@ -12,11 +12,8 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "llvm/Bitcode/Serialize.h"
|
#include "llvm/Bitcode/Serialize.h"
|
||||||
#include "string.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
|
#include <cstring>
|
||||||
#ifdef DEBUG_BACKPATCH
|
|
||||||
#include "llvm/Support/Streams.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -86,7 +83,7 @@ SerializedPtrID Serializer::getPtrId(const void* ptr) {
|
|||||||
if (I == PtrMap.end()) {
|
if (I == PtrMap.end()) {
|
||||||
unsigned id = PtrMap.size()+1;
|
unsigned id = PtrMap.size()+1;
|
||||||
#ifdef DEBUG_BACKPATCH
|
#ifdef DEBUG_BACKPATCH
|
||||||
llvm::cerr << "Registered PTR: " << ptr << " => " << id << "\n";
|
errs() << "Registered PTR: " << ptr << " => " << id << "\n";
|
||||||
#endif
|
#endif
|
||||||
PtrMap[ptr] = id;
|
PtrMap[ptr] = id;
|
||||||
return id;
|
return id;
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/Support/LeakDetector.h"
|
#include "llvm/Support/LeakDetector.h"
|
||||||
#include "llvm/Support/MathExtras.h"
|
#include "llvm/Support/MathExtras.h"
|
||||||
#include "llvm/Support/Streams.h"
|
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include "llvm/ADT/FoldingSet.h"
|
#include "llvm/ADT/FoldingSet.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/Support/Dwarf.h"
|
#include "llvm/Support/Dwarf.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/Support/Streams.h"
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
using namespace llvm::dwarf;
|
using namespace llvm::dwarf;
|
||||||
|
|
||||||
|
@ -2598,9 +2598,9 @@ SimpleRegisterCoalescing::lastRegisterUse(unsigned Start, unsigned End,
|
|||||||
|
|
||||||
void SimpleRegisterCoalescing::printRegName(unsigned reg) const {
|
void SimpleRegisterCoalescing::printRegName(unsigned reg) const {
|
||||||
if (TargetRegisterInfo::isPhysicalRegister(reg))
|
if (TargetRegisterInfo::isPhysicalRegister(reg))
|
||||||
cerr << tri_->getName(reg);
|
errs() << tri_->getName(reg);
|
||||||
else
|
else
|
||||||
cerr << "%reg" << reg;
|
errs() << "%reg" << reg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleRegisterCoalescing::releaseMemory() {
|
void SimpleRegisterCoalescing::releaseMemory() {
|
||||||
|
@ -259,11 +259,6 @@ bool VirtRegMap::FindUnusedRegisters(LiveIntervals* LIs) {
|
|||||||
return AnyUnused;
|
return AnyUnused;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VirtRegMap::print(std::ostream &OS, const Module* M) const {
|
|
||||||
raw_os_ostream RawOS(OS);
|
|
||||||
print(RawOS, M);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VirtRegMap::print(raw_ostream &OS, const Module* M) const {
|
void VirtRegMap::print(raw_ostream &OS, const Module* M) const {
|
||||||
const TargetRegisterInfo* TRI = MF->getTarget().getRegisterInfo();
|
const TargetRegisterInfo* TRI = MF->getTarget().getRegisterInfo();
|
||||||
|
|
||||||
@ -283,5 +278,5 @@ void VirtRegMap::print(raw_ostream &OS, const Module* M) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void VirtRegMap::dump() const {
|
void VirtRegMap::dump() const {
|
||||||
print(cerr);
|
print(errs());
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "llvm/ADT/IndexedMap.h"
|
#include "llvm/ADT/IndexedMap.h"
|
||||||
#include "llvm/ADT/SmallPtrSet.h"
|
#include "llvm/ADT/SmallPtrSet.h"
|
||||||
#include "llvm/ADT/SmallVector.h"
|
#include "llvm/ADT/SmallVector.h"
|
||||||
#include "llvm/Support/Streams.h"
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
@ -482,25 +481,10 @@ namespace llvm {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void print(std::ostream &OS, const Module* M = 0) const;
|
|
||||||
void print(std::ostream *OS) const { if (OS) print(*OS); }
|
|
||||||
void print(raw_ostream &OS, const Module* M = 0) const;
|
void print(raw_ostream &OS, const Module* M = 0) const;
|
||||||
void print(raw_ostream *OS) const { if (OS) print(*OS); }
|
|
||||||
void dump() const;
|
void dump() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::ostream *operator<<(std::ostream *OS, const VirtRegMap &VRM) {
|
|
||||||
VRM.print(OS);
|
|
||||||
return OS;
|
|
||||||
}
|
|
||||||
inline std::ostream &operator<<(std::ostream &OS, const VirtRegMap &VRM) {
|
|
||||||
VRM.print(OS);
|
|
||||||
return OS;
|
|
||||||
}
|
|
||||||
inline raw_ostream *operator<<(raw_ostream *OS, const VirtRegMap &VRM) {
|
|
||||||
VRM.print(OS);
|
|
||||||
return OS;
|
|
||||||
}
|
|
||||||
inline raw_ostream &operator<<(raw_ostream &OS, const VirtRegMap &VRM) {
|
inline raw_ostream &operator<<(raw_ostream &OS, const VirtRegMap &VRM) {
|
||||||
VRM.print(OS);
|
VRM.print(OS);
|
||||||
return OS;
|
return OS;
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include "llvm/Debugger/SourceFile.h"
|
#include "llvm/Debugger/SourceFile.h"
|
||||||
#include "llvm/Debugger/SourceLanguage.h"
|
#include "llvm/Debugger/SourceLanguage.h"
|
||||||
#include "llvm/Support/SlowOperationInformer.h"
|
#include "llvm/Support/SlowOperationInformer.h"
|
||||||
#include "llvm/Support/Streams.h"
|
|
||||||
#include "llvm/ADT/STLExtras.h"
|
#include "llvm/ADT/STLExtras.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -184,7 +183,7 @@ void SourceFunctionInfo::getSourceLocation(unsigned &RetLineNo,
|
|||||||
if (SD) { // We found the first stop point!
|
if (SD) { // We found the first stop point!
|
||||||
// This is just a sanity check.
|
// This is just a sanity check.
|
||||||
if (getSourceFile().getDescriptor() != SD)
|
if (getSourceFile().getDescriptor() != SD)
|
||||||
cout << "WARNING: first line of function is not in the"
|
outs() << "WARNING: first line of function is not in the"
|
||||||
<< " file that the function descriptor claims it is in.\n";
|
<< " file that the function descriptor claims it is in.\n";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,8 @@
|
|||||||
|
|
||||||
#include "llvm/Debugger/SourceLanguage.h"
|
#include "llvm/Debugger/SourceLanguage.h"
|
||||||
#include "llvm/Debugger/ProgramInfo.h"
|
#include "llvm/Debugger/ProgramInfo.h"
|
||||||
#include "llvm/Support/Streams.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <ostream>
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@ -132,7 +131,7 @@ SourceFunctionInfo *SLU::lookupFunction(const std::string &FunctionName,
|
|||||||
SourceFunctionInfo *Found = IP.first->second;
|
SourceFunctionInfo *Found = IP.first->second;
|
||||||
++IP.first;
|
++IP.first;
|
||||||
if (IP.first != IP.second)
|
if (IP.first != IP.second)
|
||||||
cout << "Whoa, found multiple functions with the same name. I should"
|
outs() << "Whoa, found multiple functions with the same name. I should"
|
||||||
<< " ask the user which one to use: FIXME!\n";
|
<< " ask the user which one to use: FIXME!\n";
|
||||||
return Found;
|
return Found;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/Config/config.h" // Detect libffi
|
#include "llvm/Config/config.h" // Detect libffi
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/Support/Streams.h"
|
|
||||||
#include "llvm/System/DynamicLibrary.h"
|
#include "llvm/System/DynamicLibrary.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
#include "llvm/Support/ManagedStatic.h"
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
@ -279,7 +278,7 @@ GenericValue Interpreter::callExternalFunction(Function *F,
|
|||||||
#endif // USE_LIBFFI
|
#endif // USE_LIBFFI
|
||||||
|
|
||||||
if (F->getName() == "__main")
|
if (F->getName() == "__main")
|
||||||
cerr << "Tried to execute an unknown external function: "
|
errs() << "Tried to execute an unknown external function: "
|
||||||
<< F->getType()->getDescription() << " __main\n";
|
<< F->getType()->getDescription() << " __main\n";
|
||||||
else
|
else
|
||||||
llvm_report_error("Tried to execute an unknown external function: " +
|
llvm_report_error("Tried to execute an unknown external function: " +
|
||||||
@ -393,7 +392,8 @@ GenericValue lle_X_sprintf(const FunctionType *FT,
|
|||||||
sprintf(Buffer, FmtBuf, (void*)GVTOP(Args[ArgNo++])); break;
|
sprintf(Buffer, FmtBuf, (void*)GVTOP(Args[ArgNo++])); break;
|
||||||
case 's':
|
case 's':
|
||||||
sprintf(Buffer, FmtBuf, (char*)GVTOP(Args[ArgNo++])); break;
|
sprintf(Buffer, FmtBuf, (char*)GVTOP(Args[ArgNo++])); break;
|
||||||
default: cerr << "<unknown printf code '" << *FmtStr << "'!>";
|
default:
|
||||||
|
errs() << "<unknown printf code '" << *FmtStr << "'!>";
|
||||||
ArgNo++; break;
|
ArgNo++; break;
|
||||||
}
|
}
|
||||||
strcpy(OutputBuffer, Buffer);
|
strcpy(OutputBuffer, Buffer);
|
||||||
@ -414,7 +414,7 @@ GenericValue lle_X_printf(const FunctionType *FT,
|
|||||||
NewArgs.push_back(PTOGV((void*)&Buffer[0]));
|
NewArgs.push_back(PTOGV((void*)&Buffer[0]));
|
||||||
NewArgs.insert(NewArgs.end(), Args.begin(), Args.end());
|
NewArgs.insert(NewArgs.end(), Args.begin(), Args.end());
|
||||||
GenericValue GV = lle_X_sprintf(FT, NewArgs);
|
GenericValue GV = lle_X_sprintf(FT, NewArgs);
|
||||||
cout << Buffer;
|
outs() << Buffer;
|
||||||
return GV;
|
return GV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
#include "JIT.h"
|
#include "JIT.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/Support/Streams.h"
|
|
||||||
#include "llvm/System/DynamicLibrary.h"
|
#include "llvm/System/DynamicLibrary.h"
|
||||||
#include "llvm/Config/config.h"
|
#include "llvm/Config/config.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
@ -851,13 +851,12 @@ size_t basic_parser_impl::getOptionWidth(const Option &O) const {
|
|||||||
//
|
//
|
||||||
void basic_parser_impl::printOptionInfo(const Option &O,
|
void basic_parser_impl::printOptionInfo(const Option &O,
|
||||||
size_t GlobalWidth) const {
|
size_t GlobalWidth) const {
|
||||||
cout << " -" << O.ArgStr;
|
outs() << " -" << O.ArgStr;
|
||||||
|
|
||||||
if (const char *ValName = getValueName())
|
if (const char *ValName = getValueName())
|
||||||
cout << "=<" << getValueStr(O, ValName) << ">";
|
outs() << "=<" << getValueStr(O, ValName) << '>';
|
||||||
|
|
||||||
cout << std::string(GlobalWidth-getOptionWidth(O), ' ') << " - "
|
outs().indent(GlobalWidth-getOptionWidth(O)) << " - " << O.HelpStr << '\n';
|
||||||
<< O.HelpStr << "\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -990,21 +989,21 @@ void generic_parser_base::printOptionInfo(const Option &O,
|
|||||||
size_t GlobalWidth) const {
|
size_t GlobalWidth) const {
|
||||||
if (O.hasArgStr()) {
|
if (O.hasArgStr()) {
|
||||||
size_t L = std::strlen(O.ArgStr);
|
size_t L = std::strlen(O.ArgStr);
|
||||||
cout << " -" << O.ArgStr << std::string(GlobalWidth-L-6, ' ')
|
outs() << " -" << O.ArgStr << std::string(GlobalWidth-L-6, ' ')
|
||||||
<< " - " << O.HelpStr << "\n";
|
<< " - " << O.HelpStr << '\n';
|
||||||
|
|
||||||
for (unsigned i = 0, e = getNumOptions(); i != e; ++i) {
|
for (unsigned i = 0, e = getNumOptions(); i != e; ++i) {
|
||||||
size_t NumSpaces = GlobalWidth-strlen(getOption(i))-8;
|
size_t NumSpaces = GlobalWidth-strlen(getOption(i))-8;
|
||||||
cout << " =" << getOption(i) << std::string(NumSpaces, ' ')
|
outs() << " =" << getOption(i) << std::string(NumSpaces, ' ')
|
||||||
<< " - " << getDescription(i) << "\n";
|
<< " - " << getDescription(i) << '\n';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (O.HelpStr[0])
|
if (O.HelpStr[0])
|
||||||
cout << " " << O.HelpStr << "\n";
|
outs() << " " << O.HelpStr << "\n";
|
||||||
for (unsigned i = 0, e = getNumOptions(); i != e; ++i) {
|
for (unsigned i = 0, e = getNumOptions(); i != e; ++i) {
|
||||||
size_t L = std::strlen(getOption(i));
|
size_t L = std::strlen(getOption(i));
|
||||||
cout << " -" << getOption(i) << std::string(GlobalWidth-L-8, ' ')
|
outs() << " -" << getOption(i) << std::string(GlobalWidth-L-8, ' ')
|
||||||
<< " - " << getDescription(i) << "\n";
|
<< " - " << getDescription(i) << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1063,9 +1062,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ProgramOverview)
|
if (ProgramOverview)
|
||||||
cout << "OVERVIEW: " << ProgramOverview << "\n";
|
outs() << "OVERVIEW: " << ProgramOverview << "\n";
|
||||||
|
|
||||||
cout << "USAGE: " << ProgramName << " [options]";
|
outs() << "USAGE: " << ProgramName << " [options]";
|
||||||
|
|
||||||
// Print out the positional options.
|
// Print out the positional options.
|
||||||
Option *CAOpt = 0; // The cl::ConsumeAfter option, if it exists...
|
Option *CAOpt = 0; // The cl::ConsumeAfter option, if it exists...
|
||||||
@ -1075,28 +1074,28 @@ public:
|
|||||||
|
|
||||||
for (size_t i = CAOpt != 0, e = PositionalOpts.size(); i != e; ++i) {
|
for (size_t i = CAOpt != 0, e = PositionalOpts.size(); i != e; ++i) {
|
||||||
if (PositionalOpts[i]->ArgStr[0])
|
if (PositionalOpts[i]->ArgStr[0])
|
||||||
cout << " --" << PositionalOpts[i]->ArgStr;
|
outs() << " --" << PositionalOpts[i]->ArgStr;
|
||||||
cout << " " << PositionalOpts[i]->HelpStr;
|
outs() << " " << PositionalOpts[i]->HelpStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print the consume after option info if it exists...
|
// Print the consume after option info if it exists...
|
||||||
if (CAOpt) cout << " " << CAOpt->HelpStr;
|
if (CAOpt) outs() << " " << CAOpt->HelpStr;
|
||||||
|
|
||||||
cout << "\n\n";
|
outs() << "\n\n";
|
||||||
|
|
||||||
// Compute the maximum argument length...
|
// Compute the maximum argument length...
|
||||||
MaxArgLen = 0;
|
MaxArgLen = 0;
|
||||||
for (size_t i = 0, e = Opts.size(); i != e; ++i)
|
for (size_t i = 0, e = Opts.size(); i != e; ++i)
|
||||||
MaxArgLen = std::max(MaxArgLen, Opts[i].second->getOptionWidth());
|
MaxArgLen = std::max(MaxArgLen, Opts[i].second->getOptionWidth());
|
||||||
|
|
||||||
cout << "OPTIONS:\n";
|
outs() << "OPTIONS:\n";
|
||||||
for (size_t i = 0, e = Opts.size(); i != e; ++i)
|
for (size_t i = 0, e = Opts.size(); i != e; ++i)
|
||||||
Opts[i].second->printOptionInfo(MaxArgLen);
|
Opts[i].second->printOptionInfo(MaxArgLen);
|
||||||
|
|
||||||
// Print any extra help the user has declared.
|
// Print any extra help the user has declared.
|
||||||
for (std::vector<const char *>::iterator I = MoreHelp->begin(),
|
for (std::vector<const char *>::iterator I = MoreHelp->begin(),
|
||||||
E = MoreHelp->end(); I != E; ++I)
|
E = MoreHelp->end(); I != E; ++I)
|
||||||
cout << *I;
|
outs() << *I;
|
||||||
MoreHelp->clear();
|
MoreHelp->clear();
|
||||||
|
|
||||||
// Halt the program since help information was printed
|
// Halt the program since help information was printed
|
||||||
@ -1125,42 +1124,43 @@ namespace {
|
|||||||
class VersionPrinter {
|
class VersionPrinter {
|
||||||
public:
|
public:
|
||||||
void print() {
|
void print() {
|
||||||
cout << "Low Level Virtual Machine (http://llvm.org/):\n";
|
raw_ostream &stdout = outs();
|
||||||
cout << " " << PACKAGE_NAME << " version " << PACKAGE_VERSION;
|
stdout << "Low Level Virtual Machine (http://llvm.org/):\n";
|
||||||
|
stdout << " " << PACKAGE_NAME << " version " << PACKAGE_VERSION;
|
||||||
#ifdef LLVM_VERSION_INFO
|
#ifdef LLVM_VERSION_INFO
|
||||||
cout << LLVM_VERSION_INFO;
|
stdout << LLVM_VERSION_INFO;
|
||||||
#endif
|
#endif
|
||||||
cout << "\n ";
|
stdout << "\n ";
|
||||||
#ifndef __OPTIMIZE__
|
#ifndef __OPTIMIZE__
|
||||||
cout << "DEBUG build";
|
stdout << "DEBUG build";
|
||||||
#else
|
#else
|
||||||
cout << "Optimized build";
|
stdout << "Optimized build";
|
||||||
#endif
|
#endif
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
cout << " with assertions";
|
stdout << " with assertions";
|
||||||
#endif
|
#endif
|
||||||
cout << ".\n";
|
stdout << ".\n";
|
||||||
cout << " Built " << __DATE__ << "(" << __TIME__ << ").\n";
|
stdout << " Built " << __DATE__ << "(" << __TIME__ << ").\n";
|
||||||
cout << "\n";
|
stdout << "\n";
|
||||||
cout << " Registered Targets:\n";
|
stdout << " Registered Targets:\n";
|
||||||
|
|
||||||
std::vector<std::pair<std::string, const Target*> > Targets;
|
std::vector<std::pair<std::string, const Target*> > Targets;
|
||||||
size_t Width = 0;
|
size_t Width = 0;
|
||||||
for (TargetRegistry::iterator it = TargetRegistry::begin(),
|
for (TargetRegistry::iterator it = TargetRegistry::begin(),
|
||||||
ie = TargetRegistry::end(); it != ie; ++it) {
|
ie = TargetRegistry::end(); it != ie; ++it) {
|
||||||
Targets.push_back(std::make_pair(it->getName(), &*it));
|
Targets.push_back(std::make_pair(it->getName(), &*it));
|
||||||
Width = std::max(Width, ::strlen(it->getName()));
|
Width = std::max(Width, ::strlen(it->getName()));
|
||||||
}
|
}
|
||||||
std::sort(Targets.begin(), Targets.end());
|
std::sort(Targets.begin(), Targets.end());
|
||||||
|
|
||||||
for (unsigned i = 0, e = Targets.size(); i != e; ++i) {
|
for (unsigned i = 0, e = Targets.size(); i != e; ++i) {
|
||||||
const Target *T = Targets[i].second;
|
const Target *T = Targets[i].second;
|
||||||
cout << " " << T->getName()
|
stdout << " " << T->getName()
|
||||||
<< std::string(Width - ::strlen(T->getName()), ' ') << " - "
|
<< std::string(Width - ::strlen(T->getName()), ' ') << " - "
|
||||||
<< T->getShortDescription() << "\n";
|
<< T->getShortDescription() << "\n";
|
||||||
}
|
}
|
||||||
if (Targets.empty())
|
if (Targets.empty())
|
||||||
cout << " (none)\n";
|
stdout << " (none)\n";
|
||||||
}
|
}
|
||||||
void operator=(bool OptionWasSpecified) {
|
void operator=(bool OptionWasSpecified) {
|
||||||
if (OptionWasSpecified) {
|
if (OptionWasSpecified) {
|
||||||
|
@ -14,10 +14,9 @@
|
|||||||
#define DONT_GET_PLUGIN_LOADER_OPTION
|
#define DONT_GET_PLUGIN_LOADER_OPTION
|
||||||
#include "llvm/Support/ManagedStatic.h"
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/PluginLoader.h"
|
#include "llvm/Support/PluginLoader.h"
|
||||||
#include "llvm/Support/Streams.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include "llvm/System/DynamicLibrary.h"
|
#include "llvm/System/DynamicLibrary.h"
|
||||||
#include "llvm/System/Mutex.h"
|
#include "llvm/System/Mutex.h"
|
||||||
#include <ostream>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -28,8 +27,8 @@ void PluginLoader::operator=(const std::string &Filename) {
|
|||||||
sys::SmartScopedLock<true> Lock(*PluginsLock);
|
sys::SmartScopedLock<true> Lock(*PluginsLock);
|
||||||
std::string Error;
|
std::string Error;
|
||||||
if (sys::DynamicLibrary::LoadLibraryPermanently(Filename.c_str(), &Error)) {
|
if (sys::DynamicLibrary::LoadLibraryPermanently(Filename.c_str(), &Error)) {
|
||||||
cerr << "Error opening '" << Filename << "': " << Error
|
errs() << "Error opening '" << Filename << "': " << Error
|
||||||
<< "\n -load request ignored.\n";
|
<< "\n -load request ignored.\n";
|
||||||
} else {
|
} else {
|
||||||
Plugins->push_back(Filename);
|
Plugins->push_back(Filename);
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "llvm/Support/SlowOperationInformer.h"
|
#include "llvm/Support/SlowOperationInformer.h"
|
||||||
#include "llvm/Support/Streams.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include "llvm/System/Alarm.h"
|
#include "llvm/System/Alarm.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@ -28,8 +28,8 @@ SlowOperationInformer::~SlowOperationInformer() {
|
|||||||
if (LastPrintAmount) {
|
if (LastPrintAmount) {
|
||||||
// If we have printed something, make _sure_ we print the 100% amount, and
|
// If we have printed something, make _sure_ we print the 100% amount, and
|
||||||
// also print a newline.
|
// also print a newline.
|
||||||
cout << std::string(LastPrintAmount, '\b') << "Progress "
|
outs() << std::string(LastPrintAmount, '\b') << "Progress "
|
||||||
<< OperationName << ": 100% \n";
|
<< OperationName << ": 100% \n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ SlowOperationInformer::~SlowOperationInformer() {
|
|||||||
bool SlowOperationInformer::progress(unsigned Amount) {
|
bool SlowOperationInformer::progress(unsigned Amount) {
|
||||||
int status = sys::AlarmStatus();
|
int status = sys::AlarmStatus();
|
||||||
if (status == -1) {
|
if (status == -1) {
|
||||||
cout << "\n";
|
outs() << "\n";
|
||||||
LastPrintAmount = 0;
|
LastPrintAmount = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -61,6 +61,7 @@ bool SlowOperationInformer::progress(unsigned Amount) {
|
|||||||
OS << "% ";
|
OS << "% ";
|
||||||
|
|
||||||
LastPrintAmount = OS.str().size();
|
LastPrintAmount = OS.str().size();
|
||||||
cout << ToPrint+OS.str() << std::flush;
|
outs() << ToPrint+OS.str();
|
||||||
|
outs().flush();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -24,16 +24,15 @@
|
|||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/ManagedStatic.h"
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/Streams.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include "llvm/System/Mutex.h"
|
#include "llvm/System/Mutex.h"
|
||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <ostream>
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
// GetLibSupportInfoOutputFile - Return a file stream to print our output on.
|
// GetLibSupportInfoOutputFile - Return a file stream to print our output on.
|
||||||
namespace llvm { extern std::ostream *GetLibSupportInfoOutputFile(); }
|
namespace llvm { extern raw_ostream *GetLibSupportInfoOutputFile(); }
|
||||||
|
|
||||||
/// -stats - Command line option to cause transformations to emit stats about
|
/// -stats - Command line option to cause transformations to emit stats about
|
||||||
/// what they did.
|
/// what they did.
|
||||||
@ -96,7 +95,7 @@ StatisticInfo::~StatisticInfo() {
|
|||||||
if (Stats.empty()) return;
|
if (Stats.empty()) return;
|
||||||
|
|
||||||
// Get the stream to write to.
|
// Get the stream to write to.
|
||||||
std::ostream &OutStream = *GetLibSupportInfoOutputFile();
|
raw_ostream &OutStream = *GetLibSupportInfoOutputFile();
|
||||||
|
|
||||||
// Figure out how long the biggest Value and Name fields are.
|
// Figure out how long the biggest Value and Name fields are.
|
||||||
unsigned MaxNameLen = 0, MaxValLen = 0;
|
unsigned MaxNameLen = 0, MaxValLen = 0;
|
||||||
@ -125,8 +124,9 @@ StatisticInfo::~StatisticInfo() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OutStream << std::endl; // Flush the output stream...
|
OutStream << '\n'; // Flush the output stream...
|
||||||
|
OutStream.flush();
|
||||||
|
|
||||||
if (&OutStream != cerr.stream() && &OutStream != cout.stream())
|
if (&OutStream != &outs() && &OutStream != &errs())
|
||||||
delete &OutStream; // Close the file.
|
delete &OutStream; // Close the file.
|
||||||
}
|
}
|
||||||
|
@ -14,16 +14,16 @@
|
|||||||
#include "llvm/Support/Timer.h"
|
#include "llvm/Support/Timer.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/ManagedStatic.h"
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/Streams.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
|
#include "llvm/Support/Format.h"
|
||||||
#include "llvm/System/Process.h"
|
#include "llvm/System/Process.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <fstream>
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <map>
|
#include <map>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
// GetLibSupportInfoOutputFile - Return a file stream to print our output on.
|
// GetLibSupportInfoOutputFile - Return a file stream to print our output on.
|
||||||
namespace llvm { extern std::ostream *GetLibSupportInfoOutputFile(); }
|
namespace llvm { extern raw_ostream *GetLibSupportInfoOutputFile(); }
|
||||||
|
|
||||||
// getLibSupportInfoOutputFilename - This ugly hack is brought to you courtesy
|
// getLibSupportInfoOutputFilename - This ugly hack is brought to you courtesy
|
||||||
// of constructor/destructor ordering being unspecified by C++. Basically the
|
// of constructor/destructor ordering being unspecified by C++. Basically the
|
||||||
@ -269,38 +269,17 @@ NamedRegionTimer::NamedRegionTimer(const std::string &Name,
|
|||||||
// TimerGroup Implementation
|
// TimerGroup Implementation
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
// printAlignedFP - Simulate the printf "%A.Bf" format, where A is the
|
|
||||||
// TotalWidth size, and B is the AfterDec size.
|
|
||||||
//
|
|
||||||
static void printAlignedFP(double Val, unsigned AfterDec, unsigned TotalWidth,
|
|
||||||
std::ostream &OS) {
|
|
||||||
assert(TotalWidth >= AfterDec+1 && "Bad FP Format!");
|
|
||||||
OS.width(TotalWidth-AfterDec-1);
|
|
||||||
char OldFill = OS.fill();
|
|
||||||
OS.fill(' ');
|
|
||||||
OS << (int)Val; // Integer part;
|
|
||||||
OS << ".";
|
|
||||||
OS.width(AfterDec);
|
|
||||||
OS.fill('0');
|
|
||||||
unsigned ResultFieldSize = 1;
|
|
||||||
while (AfterDec--) ResultFieldSize *= 10;
|
|
||||||
OS << (int)(Val*ResultFieldSize) % ResultFieldSize;
|
|
||||||
OS.fill(OldFill);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void printVal(double Val, double Total, std::ostream &OS) {
|
static void printVal(double Val, double Total, raw_ostream &OS) {
|
||||||
if (Total < 1e-7) // Avoid dividing by zero...
|
if (Total < 1e-7) // Avoid dividing by zero...
|
||||||
OS << " ----- ";
|
OS << " ----- ";
|
||||||
else {
|
else {
|
||||||
OS << " ";
|
OS << " " << format("%7.4f", Val) << " (";
|
||||||
printAlignedFP(Val, 4, 7, OS);
|
OS << format("%5.1f", Val*100/Total) << "%)";
|
||||||
OS << " (";
|
|
||||||
printAlignedFP(Val*100/Total, 1, 5, OS);
|
|
||||||
OS << "%)";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timer::print(const Timer &Total, std::ostream &OS) {
|
void Timer::print(const Timer &Total, raw_ostream &OS) {
|
||||||
if (&Total < this) {
|
if (&Total < this) {
|
||||||
Total.Lock.acquire();
|
Total.Lock.acquire();
|
||||||
Lock.acquire();
|
Lock.acquire();
|
||||||
@ -320,13 +299,11 @@ void Timer::print(const Timer &Total, std::ostream &OS) {
|
|||||||
OS << " ";
|
OS << " ";
|
||||||
|
|
||||||
if (Total.MemUsed) {
|
if (Total.MemUsed) {
|
||||||
OS.width(9);
|
OS << format("%9lld", (long long)MemUsed) << " ";
|
||||||
OS << MemUsed << " ";
|
|
||||||
}
|
}
|
||||||
if (Total.PeakMem) {
|
if (Total.PeakMem) {
|
||||||
if (PeakMem) {
|
if (PeakMem) {
|
||||||
OS.width(9);
|
OS << format("%9lld", (long long)PeakMem) << " ";
|
||||||
OS << PeakMem << " ";
|
|
||||||
} else
|
} else
|
||||||
OS << " ";
|
OS << " ";
|
||||||
}
|
}
|
||||||
@ -344,23 +321,25 @@ void Timer::print(const Timer &Total, std::ostream &OS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetLibSupportInfoOutputFile - Return a file stream to print our output on...
|
// GetLibSupportInfoOutputFile - Return a file stream to print our output on...
|
||||||
std::ostream *
|
raw_ostream *
|
||||||
llvm::GetLibSupportInfoOutputFile() {
|
llvm::GetLibSupportInfoOutputFile() {
|
||||||
std::string &LibSupportInfoOutputFilename = getLibSupportInfoOutputFilename();
|
std::string &LibSupportInfoOutputFilename = getLibSupportInfoOutputFilename();
|
||||||
if (LibSupportInfoOutputFilename.empty())
|
if (LibSupportInfoOutputFilename.empty())
|
||||||
return cerr.stream();
|
return &errs();
|
||||||
if (LibSupportInfoOutputFilename == "-")
|
if (LibSupportInfoOutputFilename == "-")
|
||||||
return cout.stream();
|
return &outs();
|
||||||
|
|
||||||
std::ostream *Result = new std::ofstream(LibSupportInfoOutputFilename.c_str(),
|
|
||||||
std::ios::app);
|
std::string Error;
|
||||||
if (!Result->good()) {
|
raw_ostream *Result = new raw_fd_ostream(LibSupportInfoOutputFilename.c_str(),
|
||||||
cerr << "Error opening info-output-file '"
|
Error, raw_fd_ostream::F_Append);
|
||||||
|
if (Error.empty())
|
||||||
|
return Result;
|
||||||
|
|
||||||
|
errs() << "Error opening info-output-file '"
|
||||||
<< LibSupportInfoOutputFilename << " for appending!\n";
|
<< LibSupportInfoOutputFilename << " for appending!\n";
|
||||||
delete Result;
|
delete Result;
|
||||||
return cerr.stream();
|
return &errs();
|
||||||
}
|
|
||||||
return Result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -375,7 +354,7 @@ void TimerGroup::removeTimer() {
|
|||||||
unsigned Padding = (80-Name.length())/2;
|
unsigned Padding = (80-Name.length())/2;
|
||||||
if (Padding > 80) Padding = 0; // Don't allow "negative" numbers
|
if (Padding > 80) Padding = 0; // Don't allow "negative" numbers
|
||||||
|
|
||||||
std::ostream *OutStream = GetLibSupportInfoOutputFile();
|
raw_ostream *OutStream = GetLibSupportInfoOutputFile();
|
||||||
|
|
||||||
++NumTimers;
|
++NumTimers;
|
||||||
{ // Scope to contain Total timer... don't allow total timer to drop us to
|
{ // Scope to contain Total timer... don't allow total timer to drop us to
|
||||||
@ -397,10 +376,8 @@ void TimerGroup::removeTimer() {
|
|||||||
if (this != DefaultTimerGroup) {
|
if (this != DefaultTimerGroup) {
|
||||||
*OutStream << " Total Execution Time: ";
|
*OutStream << " Total Execution Time: ";
|
||||||
|
|
||||||
printAlignedFP(Total.getProcessTime(), 4, 5, *OutStream);
|
*OutStream << format("%5.4f", Total.getProcessTime()) << " seconds (";
|
||||||
*OutStream << " seconds (";
|
*OutStream << format("%5.4f", Total.getWallTime()) << " wall clock)\n";
|
||||||
printAlignedFP(Total.getWallTime(), 4, 5, *OutStream);
|
|
||||||
*OutStream << " wall clock)\n";
|
|
||||||
}
|
}
|
||||||
*OutStream << "\n";
|
*OutStream << "\n";
|
||||||
|
|
||||||
@ -422,13 +399,14 @@ void TimerGroup::removeTimer() {
|
|||||||
TimersToPrint[i].print(Total, *OutStream);
|
TimersToPrint[i].print(Total, *OutStream);
|
||||||
|
|
||||||
Total.print(Total, *OutStream);
|
Total.print(Total, *OutStream);
|
||||||
*OutStream << std::endl; // Flush output
|
*OutStream << '\n';
|
||||||
|
OutStream->flush();
|
||||||
}
|
}
|
||||||
--NumTimers;
|
--NumTimers;
|
||||||
|
|
||||||
TimersToPrint.clear();
|
TimersToPrint.clear();
|
||||||
|
|
||||||
if (OutStream != cerr.stream() && OutStream != cout.stream())
|
if (OutStream != &errs() && OutStream != &outs())
|
||||||
delete OutStream; // Close the file...
|
delete OutStream; // Close the file...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user