[llvm] r234969 - uselistorder: Pull the bit through PrintModulePass
Duncan P. N. Exon Smith
dexonsmith at apple.com
Tue Apr 14 19:38:07 PDT 2015
Author: dexonsmith
Date: Tue Apr 14 21:38:06 2015
New Revision: 234969
URL: http://llvm.org/viewvc/llvm-project?rev=234969&view=rev
Log:
uselistorder: Pull the bit through PrintModulePass
Now the callers of `PrintModulePass()` (etc.) that care about use-list
order in assembly pass in the flag.
Modified:
llvm/trunk/include/llvm/IR/IRPrintingPasses.h
llvm/trunk/lib/IR/IRPrintingPasses.cpp
llvm/trunk/tools/llvm-extract/llvm-extract.cpp
llvm/trunk/tools/opt/NewPMDriver.cpp
llvm/trunk/tools/opt/NewPMDriver.h
llvm/trunk/tools/opt/opt.cpp
Modified: llvm/trunk/include/llvm/IR/IRPrintingPasses.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IRPrintingPasses.h?rev=234969&r1=234968&r2=234969&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/IRPrintingPasses.h (original)
+++ llvm/trunk/include/llvm/IR/IRPrintingPasses.h Tue Apr 14 21:38:06 2015
@@ -34,7 +34,8 @@ class raw_ostream;
/// \brief Create and return a pass that writes the module to the specified
/// \c raw_ostream.
ModulePass *createPrintModulePass(raw_ostream &OS,
- const std::string &Banner = "");
+ const std::string &Banner = "",
+ bool ShouldPreserveUseListOrder = false);
/// \brief Create and return a pass that prints functions to the specified
/// \c raw_ostream as they are processed.
@@ -53,10 +54,12 @@ BasicBlockPass *createPrintBasicBlockPas
class PrintModulePass {
raw_ostream &OS;
std::string Banner;
+ bool ShouldPreserveUseListOrder;
public:
PrintModulePass();
- PrintModulePass(raw_ostream &OS, const std::string &Banner = "");
+ PrintModulePass(raw_ostream &OS, const std::string &Banner = "",
+ bool ShouldPreserveUseListOrder = false);
PreservedAnalyses run(Module &M);
Modified: llvm/trunk/lib/IR/IRPrintingPasses.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/IRPrintingPasses.cpp?rev=234969&r1=234968&r2=234969&view=diff
==============================================================================
--- llvm/trunk/lib/IR/IRPrintingPasses.cpp (original)
+++ llvm/trunk/lib/IR/IRPrintingPasses.cpp Tue Apr 14 21:38:06 2015
@@ -15,19 +15,20 @@
#include "llvm/IR/Function.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
-#include "llvm/IR/UseListOrder.h"
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
PrintModulePass::PrintModulePass() : OS(dbgs()) {}
-PrintModulePass::PrintModulePass(raw_ostream &OS, const std::string &Banner)
- : OS(OS), Banner(Banner) {}
+PrintModulePass::PrintModulePass(raw_ostream &OS, const std::string &Banner,
+ bool ShouldPreserveUseListOrder)
+ : OS(OS), Banner(Banner),
+ ShouldPreserveUseListOrder(ShouldPreserveUseListOrder) {}
PreservedAnalyses PrintModulePass::run(Module &M) {
OS << Banner;
- M.print(OS, nullptr, shouldPreserveAssemblyUseListOrder());
+ M.print(OS, nullptr, ShouldPreserveUseListOrder);
return PreservedAnalyses::all();
}
@@ -48,8 +49,9 @@ class PrintModulePassWrapper : public Mo
public:
static char ID;
PrintModulePassWrapper() : ModulePass(ID) {}
- PrintModulePassWrapper(raw_ostream &OS, const std::string &Banner)
- : ModulePass(ID), P(OS, Banner) {}
+ PrintModulePassWrapper(raw_ostream &OS, const std::string &Banner,
+ bool ShouldPreserveUseListOrder)
+ : ModulePass(ID), P(OS, Banner, ShouldPreserveUseListOrder) {}
bool runOnModule(Module &M) override {
P.run(M);
@@ -114,8 +116,9 @@ INITIALIZE_PASS(PrintBasicBlockPass, "pr
false)
ModulePass *llvm::createPrintModulePass(llvm::raw_ostream &OS,
- const std::string &Banner) {
- return new PrintModulePassWrapper(OS, Banner);
+ const std::string &Banner,
+ bool ShouldPreserveUseListOrder) {
+ return new PrintModulePassWrapper(OS, Banner, ShouldPreserveUseListOrder);
}
FunctionPass *llvm::createPrintFunctionPass(llvm::raw_ostream &OS,
Modified: llvm/trunk/tools/llvm-extract/llvm-extract.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-extract/llvm-extract.cpp?rev=234969&r1=234968&r2=234969&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-extract/llvm-extract.cpp (original)
+++ llvm/trunk/tools/llvm-extract/llvm-extract.cpp Tue Apr 14 21:38:06 2015
@@ -270,7 +270,8 @@ int main(int argc, char **argv) {
}
if (OutputAssembly)
- Passes.add(createPrintModulePass(Out.os()));
+ Passes.add(createPrintModulePass(Out.os(), "",
+ shouldPreserveAssemblyUseListOrder()));
else if (Force || !CheckBitcodeOutputToConsole(Out.os(), true))
Passes.add(
createBitcodeWriterPass(Out.os(), shouldPreserveBitcodeUseListOrder()));
Modified: llvm/trunk/tools/opt/NewPMDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/NewPMDriver.cpp?rev=234969&r1=234968&r2=234969&view=diff
==============================================================================
--- llvm/trunk/tools/opt/NewPMDriver.cpp (original)
+++ llvm/trunk/tools/opt/NewPMDriver.cpp Tue Apr 14 21:38:06 2015
@@ -40,6 +40,7 @@ bool llvm::runPassPipeline(StringRef Arg
TargetMachine *TM, tool_output_file *Out,
StringRef PassPipeline, OutputKind OK,
VerifierKind VK,
+ bool ShouldPreserveAssemblyUseListOrder,
bool ShouldPreserveBitcodeUseListOrder) {
PassBuilder PB(TM);
@@ -78,7 +79,8 @@ bool llvm::runPassPipeline(StringRef Arg
case OK_NoOutput:
break; // No output pass needed.
case OK_OutputAssembly:
- MPM.addPass(PrintModulePass(Out->os()));
+ MPM.addPass(
+ PrintModulePass(Out->os(), "", ShouldPreserveAssemblyUseListOrder));
break;
case OK_OutputBitcode:
MPM.addPass(
Modified: llvm/trunk/tools/opt/NewPMDriver.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/NewPMDriver.h?rev=234969&r1=234968&r2=234969&view=diff
==============================================================================
--- llvm/trunk/tools/opt/NewPMDriver.h (original)
+++ llvm/trunk/tools/opt/NewPMDriver.h Tue Apr 14 21:38:06 2015
@@ -52,6 +52,7 @@ bool runPassPipeline(StringRef Arg0, LLV
TargetMachine *TM, tool_output_file *Out,
StringRef PassPipeline, opt_tool::OutputKind OK,
opt_tool::VerifierKind VK,
+ bool ShouldPreserveAssemblyUseListOrder,
bool ShouldPreserveBitcodeUseListOrder);
}
Modified: llvm/trunk/tools/opt/opt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=234969&r1=234968&r2=234969&view=diff
==============================================================================
--- llvm/trunk/tools/opt/opt.cpp (original)
+++ llvm/trunk/tools/opt/opt.cpp Tue Apr 14 21:38:06 2015
@@ -432,6 +432,7 @@ int main(int argc, char **argv) {
// layer.
return runPassPipeline(argv[0], Context, *M, TM.get(), Out.get(),
PassPipeline, OK, VK,
+ shouldPreserveAssemblyUseListOrder(),
shouldPreserveBitcodeUseListOrder())
? 0
: 1;
@@ -556,7 +557,8 @@ int main(int argc, char **argv) {
}
if (PrintEachXForm)
- Passes.add(createPrintModulePass(errs()));
+ Passes.add(createPrintModulePass(errs(), "",
+ shouldPreserveAssemblyUseListOrder()));
}
if (StandardLinkOpts) {
@@ -593,7 +595,8 @@ int main(int argc, char **argv) {
// Write bitcode or assembly to the output as the last step...
if (!NoOutput && !AnalyzeOnly) {
if (OutputAssembly)
- Passes.add(createPrintModulePass(Out->os()));
+ Passes.add(createPrintModulePass(Out->os(), "",
+ shouldPreserveAssemblyUseListOrder()));
else
Passes.add(createBitcodeWriterPass(Out->os(),
shouldPreserveBitcodeUseListOrder()));
More information about the llvm-commits
mailing list