[llvm] r278566 - [PM] BitcodeWriterPass should derive from PassInfoMixin

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 12 14:33:36 PDT 2016


Author: tejohnson
Date: Fri Aug 12 16:33:36 2016
New Revision: 278566

URL: http://llvm.org/viewvc/llvm-project?rev=278566&view=rev
Log:
[PM] BitcodeWriterPass should derive from PassInfoMixin

Summary:
The BitcodeWriterPass was ported a couple years ago, and predates the
PassInfoMixin. Make BitcodeWriterPass from that base class.

Should BitcodeWriterPass be added to the PassRegistry.def file? It seems
like that is only for passes that can be added arbitrarily, e.g. via the
-passes flag to the opt tool. Whereas the bitcode writer is added
specially based on the output type (and requires an output stream and
other parameters). For now I have left it out of the PassRegistry, but
let me know if it should go there.

Finally, I was considering an NFC change of the legacy WriteBitcodePass
to BitcodeWriterLegacyPass to make its usage clearer and more consistent
with other legacy passes. WDYT?

Reviewers: mehdi_amini

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D23465

Modified:
    llvm/trunk/include/llvm/Bitcode/BitcodeWriterPass.h

Modified: llvm/trunk/include/llvm/Bitcode/BitcodeWriterPass.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitcodeWriterPass.h?rev=278566&r1=278565&r2=278566&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Bitcode/BitcodeWriterPass.h (original)
+++ llvm/trunk/include/llvm/Bitcode/BitcodeWriterPass.h Fri Aug 12 16:33:36 2016
@@ -44,7 +44,7 @@ ModulePass *createBitcodeWriterPass(raw_
 ///
 /// Note that this is intended for use with the new pass manager. To construct
 /// a pass for the legacy pass manager, use the function above.
-class BitcodeWriterPass {
+class BitcodeWriterPass : public PassInfoMixin<BitcodeWriterPass> {
   raw_ostream &OS;
   bool ShouldPreserveUseListOrder;
   bool EmitSummaryIndex;
@@ -68,8 +68,6 @@ public:
   /// \brief Run the bitcode writer pass, and output the module to the selected
   /// output stream.
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
-
-  static StringRef name() { return "BitcodeWriterPass"; }
 };
 
 }




More information about the llvm-commits mailing list