Give clients of MachineFunctionPrinter the ability to specify a banner and

choose an ostream.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11016 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Brian Gaeke
2004-01-30 21:53:46 +00:00
parent 10d208d7b1
commit 09caa3751f
2 changed files with 19 additions and 5 deletions
+14 -3
View File
@@ -34,6 +34,12 @@ static AnnotationID MF_AID(
namespace {
struct Printer : public MachineFunctionPass {
std::ostream *OS;
const std::string &Banner;
Printer (std::ostream *_OS, const std::string &_Banner) :
OS (_OS), Banner (_Banner) { }
const char *getPassName() const { return "MachineFunction Printer"; }
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -41,14 +47,19 @@ namespace {
}
bool runOnMachineFunction(MachineFunction &MF) {
MF.dump();
(*OS) << Banner;
MF.print (*OS);
return false;
}
};
}
FunctionPass *llvm::createMachineFunctionPrinterPass() {
return new Printer();
/// Returns a newly-created MachineFunction Printer pass. The default output
/// stream is std::cerr; the default banner is empty.
///
FunctionPass *llvm::createMachineFunctionPrinterPass(std::ostream *OS,
const std::string &Banner) {
return new Printer(OS, Banner);
}
namespace {