Options for loop optimization added.
authorChristian Helmer <helmer@ipd.info.uni-karlsruhe.de>
Mon, 23 Nov 2009 15:26:11 +0000 (15:26 +0000)
committerChristian Helmer <helmer@ipd.info.uni-karlsruhe.de>
Mon, 23 Nov 2009 15:26:11 +0000 (15:26 +0000)
[r26738]

driver/firm_cmdline.c
driver/firm_cmdline.h
driver/firm_opt.c
driver/firm_timing.def
main.c

index 945637d..050bfa3 100644 (file)
@@ -78,7 +78,8 @@ struct a_firm_opt firm_opt = {
   /* grs_create_pattern = */ 0,
   /* spare_size      = */ 128,
   /* enable_statev   = */ FALSE,
-  /* statev_filter   = */ ""
+  /* statev_filter   = */ "",
+  /* loop                       = */ FALSE
 };
 
 /* dumping options */
@@ -205,6 +206,8 @@ static const struct params {
   { X("no-shape-blocks"),        &firm_opt.shape_blocks,     0, "firm: disable block shaping" },
   { X("freestanding"),           &firm_opt.freestanding,     1, "firm: freestanding environment" },
   { X("hosted"),                 &firm_opt.freestanding,     0, "firm: hosted environment" },
+  { X("loop"),                          &firm_opt.loop,                 1, "firm: enable loop peeling and unrolling" },
+  { X("no-loop"),                   &firm_opt.loop,                     0, "firm: disable loop peeling and unrolling" },
 
   /* other firm regarding options */
   { X("restrict"),               &firm_opt.honor_restrict,   1, "firm: honor restrict keyword" },
@@ -319,6 +322,7 @@ static void disable_opts(void) {
   firm_opt.bool_opt        = FALSE;
   firm_opt.shape_blocks    = FALSE;
   firm_opt.freestanding    = TRUE;
+  firm_opt.loop                           = FALSE;
 }  /* disable_opts */
 
 /**
index 64c13bd..20f1980 100644 (file)
@@ -84,6 +84,7 @@ struct a_firm_opt {
   unsigned spare_size;      /**< allowed spare size for table switches in machine words. */
   a_byte   enable_statev;   /**< enable statev output */
   char     *statev_filter;  /**< statev filter */
+  a_byte   loop;                       /**< loop peeling and unrolling */
 };
 
 /** statistic options */
index db574c9..273ff68 100644 (file)
@@ -346,6 +346,11 @@ static void do_lower_switch(ir_graph *irg)
        lower_switch(irg, firm_opt.spare_size);
 }
 
+static void do_loop(ir_graph *irg)
+{
+       loop_optimization(irg);
+}
+
 typedef enum opt_target {
        OPT_TARGET_IRG,
        OPT_TARGET_IRP
@@ -395,6 +400,7 @@ static opt_config_t opts[] = {
        { OPT_TARGET_IRP, "inline",      (func_ptr_t) do_inline,               true, true,  true,  TV_INLINE },
        { OPT_TARGET_IRP, "clone",       (func_ptr_t) do_cloning,              true, true,  true,  TV_CLONE },
        { OPT_TARGET_IRG, "lower_switch", (func_ptr_t) do_lower_switch,        true, true,  true,  TV_LOWER },
+       { OPT_TARGET_IRG, "loop",                (func_ptr_t) do_loop,                     true, true,  true,  TV_LOOP },
 };
 static const int n_opts = sizeof(opts) / sizeof(opts[0]);
 
@@ -512,6 +518,7 @@ static void do_firm_optimizations(const char *input_filename)
   set_opt_enabled("inline", firm_opt.do_inline);
   set_opt_enabled("clone", firm_opt.cloning);
   set_opt_enabled("combo", firm_opt.combo);
+  set_opt_enabled("loop", firm_opt.loop);
 
   timer_start(TV_ALL_OPT);
 
@@ -556,6 +563,7 @@ static void do_firm_optimizations(const char *input_filename)
 
     do_irg_opt(irg, "controlflow");
     do_irg_opt(irg, "ldst");
+    do_irg_opt(irg, "loop");
     do_irg_opt(irg, "lower");
     do_irg_opt(irg, "deconv");
     do_irg_opt(irg, "jumpthreading");
index 3786f4a..93bf0ee 100644 (file)
@@ -24,7 +24,7 @@ DEFTIMEVAR(TV_JUMPTHREADING    , "jumpthreading", "Firm: jump threading")
 DEFTIMEVAR(TV_CODE_PLACE       , "codeplace",     "Firm: code placement")
 DEFTIMEVAR(TV_IF_CONV          , "ifconv",        "Firm: if conversion")
 DEFTIMEVAR(TV_OSR              , "osr",           "Firm: operator strenght reduce")
-DEFTIMEVAR(TV_LOOP_UNROLL      , "lunroll",       "Firm: loop unrolling")
+DEFTIMEVAR(TV_LOOP             , "loop",          "Firm: loop peeling and unrolling")
 DEFTIMEVAR(TV_REAL_FUNC_CALL   , "realfunc",      "Firm: real func call")
 DEFTIMEVAR(TV_CGANA            , "cgana",         "Firm: CG analysis")
 DEFTIMEVAR(TV_CONFIRM_CREATE   , "confirm",       "Firm: Confirm creation")
diff --git a/main.c b/main.c
index a418bf6..8eae020 100644 (file)
--- a/main.c
+++ b/main.c
@@ -909,7 +909,6 @@ int main(int argc, char **argv)
                                                char_is_signed = !truth_value;
                                        } else if (streq(opt, "fast-math")               ||
                                                   streq(opt, "jump-tables")             ||
-                                                  streq(opt, "unroll-loops")            ||
                                                   streq(opt, "expensive-optimizations") ||
                                                   streq(opt, "common")                  ||
                                                   streq(opt, "PIC")                     ||