[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278566 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Teresa Johnson 2016-08-12 21:33:36 +00:00
parent 43fb2934be
commit 5385053dc4

View File

@ -44,7 +44,7 @@ ModulePass *createBitcodeWriterPass(raw_ostream &Str,
///
/// 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"; }
};
}