diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-15 00:34:24 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-15 00:34:24 +0000 |
commit | 679db3345ce642749cd5fc7181a508982b353022 (patch) | |
tree | e96f9726b74843c685c21db1faf88030091a5a85 /llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp | |
parent | e406c84e3004530c0fd008f4b1121dcce034f82d (diff) | |
download | llvm-679db3345ce642749cd5fc7181a508982b353022.zip llvm-679db3345ce642749cd5fc7181a508982b353022.tar.gz llvm-679db3345ce642749cd5fc7181a508982b353022.tar.bz2 |
uselistorder: Pull bit through BitcodeWriterPass
Now the callers of `BitcodeWriterPass` decide whether or not to preserve
bitcode use-list order.
llvm-svn: 234959
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp index fccc9e7..ddb121a 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp @@ -20,22 +20,25 @@ using namespace llvm; PreservedAnalyses BitcodeWriterPass::run(Module &M) { - WriteBitcodeToFile(&M, OS, shouldPreserveBitcodeUseListOrder()); + WriteBitcodeToFile(&M, OS, ShouldPreserveUseListOrder); return PreservedAnalyses::all(); } namespace { class WriteBitcodePass : public ModulePass { raw_ostream &OS; // raw_ostream to print on + bool ShouldPreserveUseListOrder; + public: static char ID; // Pass identification, replacement for typeid - explicit WriteBitcodePass(raw_ostream &o) - : ModulePass(ID), OS(o) {} + explicit WriteBitcodePass(raw_ostream &o, bool ShouldPreserveUseListOrder) + : ModulePass(ID), OS(o), + ShouldPreserveUseListOrder(ShouldPreserveUseListOrder) {} const char *getPassName() const override { return "Bitcode Writer"; } bool runOnModule(Module &M) override { - WriteBitcodeToFile(&M, OS, shouldPreserveBitcodeUseListOrder()); + WriteBitcodeToFile(&M, OS, ShouldPreserveUseListOrder); return false; } }; @@ -43,6 +46,7 @@ namespace { char WriteBitcodePass::ID = 0; -ModulePass *llvm::createBitcodeWriterPass(raw_ostream &Str) { - return new WriteBitcodePass(Str); +ModulePass *llvm::createBitcodeWriterPass(raw_ostream &Str, + bool ShouldPreserveUseListOrder) { + return new WriteBitcodePass(Str, ShouldPreserveUseListOrder); } |