Skip to content

Commit 5744828

Browse files
redbopoSmit-create
authored andcommitted
Add an option to skip pass in default pipeline
1 parent 595139b commit 5744828

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/bin/lpython.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1297,6 +1297,7 @@ int main(int argc, char *argv[])
12971297
bool show_errors = false;
12981298
bool with_intrinsic_modules = false;
12991299
std::string arg_pass;
1300+
std::string skip_pass;
13001301
bool arg_no_color = false;
13011302
bool show_llvm = false;
13021303
bool show_asm = false;
@@ -1363,6 +1364,7 @@ int main(int argc, char *argv[])
13631364
app.add_flag("--indent", compiler_options.indent, "Indented print ASR/AST");
13641365
app.add_flag("--tree", compiler_options.tree, "Tree structure print ASR/AST");
13651366
app.add_option("--pass", arg_pass, "Apply the ASR pass and show ASR (implies --show-asr)");
1367+
app.add_option("--skip_pass", skip_pass, "Skip an ASR pass in default pipeline");
13661368
app.add_flag("--disable-main", compiler_options.disable_main, "Do not generate any code for the `main` function");
13671369
app.add_flag("--symtab-only", compiler_options.symtab_only, "Only create symbol tables in ASR (skip executable stmt)");
13681370
app.add_flag("--time-report", time_report, "Show compilation time report");
@@ -1539,7 +1541,7 @@ int main(int argc, char *argv[])
15391541
// return emit_c_preprocessor(arg_file, compiler_options);
15401542
// }
15411543

1542-
lpython_pass_manager.parse_pass_arg(arg_pass);
1544+
lpython_pass_manager.parse_pass_arg(arg_pass, skip_pass);
15431545
if (show_tokens) {
15441546
return emit_tokens(arg_file, true, compiler_options);
15451547
}

src/libasr/pass/pass_manager.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ namespace LCompilers {
8686

8787
bool is_fast;
8888
bool apply_default_passes;
89+
std::string skip_pass;
8990

9091
void _apply_passes(Allocator& al, LFortran::ASR::TranslationUnit_t* asr,
9192
std::vector<std::string>& passes, PassOptions &pass_options,
@@ -159,8 +160,9 @@ namespace LCompilers {
159160
_user_defined_passes.clear();
160161
}
161162

162-
void parse_pass_arg(std::string& arg_pass) {
163+
void parse_pass_arg(std::string& arg_pass, std::string& s_pass) {
163164
_user_defined_passes.clear();
165+
skip_pass = s_pass;
164166
if (arg_pass == "") {
165167
return ;
166168
}

0 commit comments

Comments
 (0)