mirror of
https://github.com/danog/ir.git
synced 2024-11-30 04:39:43 +01:00
Simplify compilation pipeline
This commit is contained in:
parent
ccbf3da286
commit
f5e84ec44c
17
ir_main.c
17
ir_main.c
@ -137,15 +137,15 @@ static int _save(ir_ctx *ctx, uint32_t dump, uint32_t pass, const char *dump_fil
|
||||
|
||||
int ir_compile_func(ir_ctx *ctx, int opt_level, uint32_t dump, const char *dump_file)
|
||||
{
|
||||
if (opt_level > 0) {
|
||||
ir_build_def_use_lists(ctx);
|
||||
}
|
||||
|
||||
if ((dump & (IR_DUMP_AFTER_LOAD|IR_DUMP_AFTER_ALL))
|
||||
&& !_save(ctx, dump, IR_DUMP_AFTER_LOAD, dump_file)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (opt_level > 0 || (ctx->flags & (IR_GEN_NATIVE|IR_GEN_C))) {
|
||||
ir_build_def_use_lists(ctx);
|
||||
}
|
||||
|
||||
ir_check(ctx);
|
||||
|
||||
/* Global Optimization */
|
||||
@ -157,10 +157,14 @@ int ir_compile_func(ir_ctx *ctx, int opt_level, uint32_t dump, const char *dump_
|
||||
}
|
||||
}
|
||||
|
||||
if (opt_level > 0 || (ctx->flags & (IR_GEN_NATIVE|IR_GEN_C))) {
|
||||
ir_build_cfg(ctx);
|
||||
}
|
||||
|
||||
/* Schedule */
|
||||
if (opt_level > 0) {
|
||||
ir_build_cfg(ctx);
|
||||
if (opt_level == 1) {
|
||||
/* With -O2 unreachable blocks are removed by SCCP */
|
||||
ir_remove_unreachable_blocks(ctx);
|
||||
}
|
||||
ir_build_dominators_tree(ctx);
|
||||
@ -175,9 +179,6 @@ int ir_compile_func(ir_ctx *ctx, int opt_level, uint32_t dump, const char *dump_
|
||||
&& !_save(ctx, dump, IR_DUMP_AFTER_SCHEDULE, dump_file)) {
|
||||
return 0;
|
||||
}
|
||||
} else if (ctx->flags & (IR_GEN_NATIVE|IR_GEN_C)) {
|
||||
ir_build_def_use_lists(ctx);
|
||||
ir_build_cfg(ctx);
|
||||
}
|
||||
|
||||
if (ctx->flags & IR_GEN_NATIVE) {
|
||||
|
Loading…
Reference in New Issue
Block a user