{ X("verify-off"), &firm_opt.verify, FIRM_VERIFICATION_OFF, "disable node verification" },
{ X("verify-on"), &firm_opt.verify, FIRM_VERIFICATION_ON, "enable node verification" },
{ X("verify-report"), &firm_opt.verify, FIRM_VERIFICATION_REPORT, "node verification, report only" },
- { X("check-all"), &firm_opt.check_all, 1, "enable checking all Firm phases" },
- { X("no-check-all"), &firm_opt.check_all, 0, "disable checking all Firm phases" },
/* dumping */
{ X("dump-ir"), &firm_dump.ir_graph, 1, "dump IR graph" },
static int *irg_dump_no;
+typedef enum opt_target {
+ OPT_TARGET_IRG, /**< optimization function works on a single graph */
+ OPT_TARGET_IRP /**< optimization function works on the complete program */
+} opt_target_t;
+
+typedef enum opt_flags {
+ OPT_FLAG_NONE = 0,
+ OPT_FLAG_ENABLED = 1 << 0, /**< enable the optimization */
+ OPT_FLAG_NO_DUMP = 1 << 1, /**< don't dump after transformation */
+ OPT_FLAG_NO_VERIFY = 1 << 2, /**< don't verify after transformation */
+ OPT_FLAG_HIDE_OPTIONS = 1 << 3, /**< do not automatically process
+ -foptions for this transformation */
+ OPT_FLAG_ESSENTIAL = 1 << 4, /**< output won't work without this pass
+ so we need it even with -O0 */
+} opt_flags_t;
+
+typedef void (*transform_irg_func)(ir_graph *irg);
+typedef void (*transform_irp_func)(void);
+
+typedef struct {
+ opt_target_t target;
+ const char *name;
+ union {
+ transform_irg_func transform_irg;
+ transform_irp_func transform_irp;
+ } u;
+ const char *description;
+ opt_flags_t flags;
+ ir_timer_t *timer;
+} opt_config_t;
+
+static opt_config_t *get_opt(const char *name);
+
static void do_stred(ir_graph *irg)
{
opt_osr(irg, osr_flag_default | osr_flag_keep_reg_pressure | osr_flag_ignore_x86_shift);
static void after_inline_opt(ir_graph *irg)
{
+ opt_config_t *const config = get_opt("inline");
+ timer_stop(config->timer);
+
do_irg_opt(irg, "scalar-replace");
do_irg_opt(irg, "local");
do_irg_opt(irg, "control-flow");
do_irg_opt(irg, "combo");
+
+ timer_start(config->timer);
}
static void do_inline(void)
set_opt_global_cse(0);
}
-typedef enum opt_target {
- OPT_TARGET_IRG, /**< optimization function works on a single graph */
- OPT_TARGET_IRP /**< optimization function works on the complete program */
-} opt_target_t;
-
-typedef enum opt_flags {
- OPT_FLAG_NONE = 0,
- OPT_FLAG_ENABLED = 1 << 0, /**< enable the optimization */
- OPT_FLAG_NO_DUMP = 1 << 1, /**< don't dump after transformation */
- OPT_FLAG_NO_VERIFY = 1 << 2, /**< don't verify after transformation */
- OPT_FLAG_HIDE_OPTIONS = 1 << 3, /**< do not automatically process
- -foptions for this transformation */
- OPT_FLAG_ESSENTIAL = 1 << 4, /**< output won't work without this pass
- so we need it even with -O0 */
-} opt_flags_t;
-
-typedef void (*transform_irg_func)(ir_graph *irg);
-typedef void (*transform_irp_func)(void);
-
-typedef struct {
- opt_target_t target;
- const char *name;
- union {
- transform_irg_func transform_irg;
- transform_irp_func transform_irp;
- } u;
- const char *description;
- opt_flags_t flags;
- ir_timer_t *timer;
-} opt_config_t;
-
static opt_config_t opts[] = {
#define IRG(a, b, c, d) { OPT_TARGET_IRG, a, .u.transform_irg = (transform_irg_func)b, c, d }
#define IRP(a, b, c, d) { OPT_TARGET_IRP, a, .u.transform_irp = b, c, d }
ir_graph *const old_irg = current_ir_graph;
current_ir_graph = irg;
- timer_push(config->timer);
+ timer_start(config->timer);
config->u.transform_irg(irg);
- timer_pop(config->timer);
+ timer_stop(config->timer);
if (firm_dump.all_phases && firm_dump.ir_graph) {
dump_ir_graph(irg, name);
}
- if (firm_opt.check_all) {
+ if (firm_opt.verify) {
timer_push(t_verify);
irg_verify(irg, VERIFY_ENFORCE_SSA);
timer_pop(t_verify);
if (! (config->flags & OPT_FLAG_ENABLED))
return;
- timer_push(config->timer);
+ timer_start(config->timer);
config->u.transform_irp();
- timer_pop(config->timer);
+ timer_stop(config->timer);
if (firm_dump.ir_graph && firm_dump.all_phases) {
int i;
}
}
- if (firm_opt.check_all) {
+ if (firm_opt.verify) {
int i;
timer_push(t_verify);
for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
if (get_opt_enabled("ivopts"))
set_opt_enabled("remove-phi-cycles", false);
- timer_start(t_all_opt);
-
do_irp_opt("rts");
/* first step: kill dead code */
if (firm_dump.statistic & STAT_AFTER_OPT)
stat_dump_snapshot(input_filename, "opt");
-
- timer_stop(t_all_opt);
}
/**
if (firm_dump.statistic & STAT_AFTER_LOWER)
stat_dump_snapshot(input_filename, "low");
- timer_start(t_all_opt);
-
for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
ir_graph *irg = get_irp_irg(i);
do_irp_opt("local-const");
do_irp_opt("remove-unused");
do_irp_opt("opt-cc");
- timer_stop(t_all_opt);
dump_all("low-opt");
if (firm_dump.statistic & STAT_FINAL) {
/* FIXME: cloning might ADD new graphs. */
irg_dump_no = calloc(get_irp_last_idx(), sizeof(*irg_dump_no));
+ ir_timer_init_parent(t_verify);
+ ir_timer_init_parent(t_vcg_dump);
+ timer_start(t_all_opt);
+
if (firm_dump.all_types) {
dump_ir_prog_ext(dump_typegraph, "types.vcg");
}
dump_all("");
- timer_push(t_verify);
- tr_verify();
- timer_pop(t_verify);
-
- /* all graphs are finalized, set the irp phase to high */
- set_irp_phase_state(phase_high);
+ if (firm_opt.verify) {
+ timer_push(t_verify);
+ tr_verify();
+ timer_pop(t_verify);
+ }
/* BEWARE: kill unreachable code before doing compound lowering */
for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
do_firm_optimizations(input_filename);
do_firm_lowering(input_filename);
- /* set the phase to low */
- for (i = get_irp_n_irgs() - 1; i >= 0; --i)
- set_irg_phase_state(get_irp_irg(i), phase_low);
+ timer_stop(t_all_opt);
if (firm_dump.statistic & STAT_FINAL_IR)
stat_dump_snapshot(input_filename, "final-ir");
{
ir_timer_t *t_parsing = ir_timer_new();
timer_register(t_parsing, "Frontend: Parsing");
- timer_push(t_parsing);
+ timer_start(t_parsing);
start_parsing();
unit->type = COMPILATION_UNIT_AST;
unit->parse_errors = error_count > 0 || !res;
- timer_pop(t_parsing);
+ timer_stop(t_parsing);
}
static void add_flag(struct obstack *obst, const char *format, ...)
/* build the firm graph */
ir_timer_t *t_construct = ir_timer_new();
timer_register(t_construct, "Frontend: Graph construction");
- timer_push(t_construct);
+ timer_start(t_construct);
if (already_constructed_firm) {
panic("compiling multiple files/translation units not possible");
}
init_implicit_optimizations();
translation_unit_to_firm(unit->ast);
already_constructed_firm = true;
- timer_pop(t_construct);
+ timer_stop(t_construct);
unit->type = COMPILATION_UNIT_INTERMEDIATE_REPRESENTATION;
goto again;
} else {
asm_out = make_temp_file("ccs", &unit->name);
}
+ ir_timer_t *t_opt_codegen = ir_timer_new();
+ timer_register(t_opt_codegen, "Optimization and Codegeneration");
+ timer_start(t_opt_codegen);
generate_code(asm_out, inputname);
+ timer_stop(t_opt_codegen);
if (asm_out != out) {
fclose(asm_out);
}