1- // ===--- SILPassPipelineDumper .cpp ------- ---------------------------------===//
1+ // ===--- sil_passpipeline_dumper_main .cpp ---------------------------------===//
22//
33// This source file is part of the Swift.org open source project
44//
2525
2626using namespace swift ;
2727
28- static llvm::cl::opt<PassPipelineKind>
29- PipelineKind (llvm::cl::desc(" <pipeline kind>" ), llvm::cl::values(
28+ struct SILPassPipelineDumperOptions {
29+ llvm::cl::opt<PassPipelineKind>
30+ PipelineKind = llvm::cl::opt<PassPipelineKind>(llvm::cl::desc(" <pipeline kind>" ),
31+ llvm::cl::values (
3032#define PASSPIPELINE (NAME, DESCRIPTION ) \
3133 clEnumValN (PassPipelineKind::NAME, #NAME, DESCRIPTION),
3234#include " swift/SILOptimizer/PassManager/PassPipeline.def"
3335 clEnumValN (0 , " " , " " )));
36+ };
3437
3538namespace llvm {
3639llvm::raw_ostream &operator <<(llvm::raw_ostream &os, PassPipelineKind Kind) {
@@ -44,17 +47,18 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &os, PassPipelineKind Kind) {
4447}
4548} // namespace llvm
4649
47- int main (int argc, char **argv) {
48- PROGRAM_START (argc, argv);
50+ int sil_passpipeline_dumper_main (ArrayRef<const char *> argv, void *MainAddr) {
4951 INITIALIZE_LLVM ();
5052
51- llvm::cl::ParseCommandLineOptions (argc, argv,
53+ SILPassPipelineDumperOptions options;
54+
55+ llvm::cl::ParseCommandLineOptions (argv.size (), argv.data (),
5256 " Swift SIL Pass Pipeline Dumper\n " );
5357
5458 // TODO: add options to manipulate this.
5559 SILOptions Opt;
5660
57- switch (PipelineKind) {
61+ switch (options. PipelineKind ) {
5862#define PASSPIPELINE (NAME, DESCRIPTION ) \
5963 case PassPipelineKind::NAME: { \
6064 SILPassPipelinePlan::get##NAME##PassPipeline (Opt).print (llvm::outs ()); \
0 commit comments