- 2009 patch
[cparser] / driver / firm_cmdline.c
index d7ca466..9ad28d6 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Compile when BACK_END_IS_CP_FIRM_BE is defined
  *
- * (C) 2005  Michael Beck  beck@ipd.info.uni-karlsruhe.de
+ * (C) 2005-2009  Michael Beck  beck@ipd.info.uni-karlsruhe.de
  *
  * $Id$
  */
 #include <libfirm/firm.h>
 #include <libfirm/be.h>
 
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__CYGWIN__)
 #define DEFAULT_OS OS_SUPPORT_MINGW
+#elif defined(__APPLE__)
+#define DEFAULT_OS OS_SUPPORT_MACHO
 #else
 #define DEFAULT_OS OS_SUPPORT_LINUX
 #endif
@@ -26,8 +28,9 @@ struct a_firm_opt firm_opt = {
   /* reassoc         = */ TRUE,
   /* cse             = */ TRUE,
   /* control_flow    = */ TRUE,
-  /* code_place      = */ TRUE,
-  /* gvn_pre         = */ FALSE,       /* currently buggy */
+  /* combo           = */ TRUE,
+  /* gcse            = */ TRUE,
+  /* gvn_pre         = */ FALSE,
   /* cond_eval       = */ FALSE,
   /* if_conversion   = */ FALSE,
   /* func_calls      = */ TRUE,
@@ -46,16 +49,16 @@ struct a_firm_opt firm_opt = {
   /* precise_exc     = */ FALSE,       /* never needed for C */
   /* use_DivMod      = */ FALSE,
   /* remove_unused   = */ TRUE,
-  /* jmp_tbls        = */ TRUE,
   /* cloning         = */ FALSE,
   /* auto_sync       = */ TRUE,
   /* alias_analysis  = */ TRUE,
   /* strict_alias    = */ FALSE,
   /* no_alias        = */ FALSE,
-  /* luffig          = */ FALSE,
+  /* sync            = */ TRUE,
   /* deconv          = */ FALSE,
   /* cc_opt          = */ TRUE,
   /* bool_opt        = */ FALSE,
+  /* shape_blocks    = */ FALSE,
   /* freestanding;   = */ FALSE,
   /* fp_model        = */ fp_model_precise,
   /* lower_ll        = */ FALSE,
@@ -70,6 +73,8 @@ struct a_firm_opt firm_opt = {
   /* ycomp_host      = */ FIRM_YCOMP_DEFAULT_HOST,
   /* ycomp_port      = */ FIRM_YCOMP_DEFAULT_PORT,
   /* clone_threshold = */ DEFAULT_CLONE_THRESHOLD,
+  /* inline_maxsize  = */ 750,
+  /* inline_threshold= */ 0,
   /* vrfy_edges      = */ FALSE,
   /* grs_simd_opt    = */ 0,
   /* grs_create_pattern = */ 0,
@@ -128,8 +133,10 @@ static const struct params {
   { X("no-const-fold"),          &firm_opt.const_folding,    0, "firm: disable constant folding" },
   { X("control_flow"),           &firm_opt.control_flow,     1, "firm: enable control flow optimization" },
   { X("no-control-flow"),        &firm_opt.control_flow,     0, "firm: disable control flow optimization" },
-  { X("code-place"),             &firm_opt.code_place,       1, "firm: enable GCSE and code placement" },
-  { X("no-code-place"),          &firm_opt.code_place,       0, "firm: disable GCSE and code placement" },
+  { X("combo"),                  &firm_opt.combo,            1, "firm: enable combined CCE, UCE and GVN" },
+  { X("no-combo"),               &firm_opt.combo,            0, "firm: disable combined CCE, UCE and GVN" },
+  { X("gcse"),                   &firm_opt.gcse,             1, "firm: enable global common subexpression elimination" },
+  { X("no-gcse"),                &firm_opt.gcse,             0, "firm: disable global common subexpression elimination" },
   { X("gvn-pre"),                &firm_opt.gvn_pre,          1, "firm: enable GVN partial redundancy elimination" },
   { X("no-gvn-pre"),             &firm_opt.gvn_pre,          0, "firm: disable GVN partial redundancy elimination" },
   { X("cond-eval"),              &firm_opt.cond_eval,        1, "firm: enable partial condition evaluation optimization" },
@@ -142,6 +149,8 @@ static const struct params {
   { X("no-reassociation"),       &firm_opt.reassoc,          0, "firm: disable reassociation" },
   { X("inline"),                 &firm_opt.do_inline,        1, "firm: enable FIRM inlining" },
   { X("no-inline"),              &firm_opt.do_inline,        0, "firm: disable FIRM inlining" },
+  { X("inline-max-size=<size>"), NULL,                       0, "firm: set maximum size for function inlining" },
+  { X("inline-threshold=<size>"),NULL,                       0, "firm: set benefice threshold for function inlining" },
   { X("tail-rec"),               &firm_opt.tail_rec,         1, "firm: enable tail-recursion optimization" },
   { X("no-tail-rec"),            &firm_opt.tail_rec,         0, "firm: disable tail-recursion optimization" },
   { X("strength-red"),           &firm_opt.strength_red,     1, "firm: enable strength reduction for loops" },
@@ -150,11 +159,11 @@ static const struct params {
   { X("no-scalar-replace"),      &firm_opt.scalar_replace,   0, "firm: disable scalar replacement" },
   { X("confirm"),                &firm_opt.confirm,          1, "firm: enable Confirm optimization" },
   { X("no-confirm"),             &firm_opt.confirm,          0, "firm: disable Confirm optimization" },
-  { X("opt-mul"),                &firm_opt.muls,             0, "firm: enable multiplication optimization" },
+  { X("opt-mul"),                &firm_opt.muls,             1, "firm: enable multiplication optimization" },
   { X("no-opt-mul"),             &firm_opt.muls,             0, "firm: disable multiplication optimization" },
-  { X("opt-div"),                &firm_opt.divs,             0, "firm: enable division optimization" },
+  { X("opt-div"),                &firm_opt.divs,             1, "firm: enable division optimization" },
   { X("no-opt-div"),             &firm_opt.divs,             0, "firm: disable division optimization" },
-  { X("opt-mod"),                &firm_opt.mods,             0, "firm: enable remainder optimization" },
+  { X("opt-mod"),                &firm_opt.mods,             1, "firm: enable remainder optimization" },
   { X("no-opt-mod"),             &firm_opt.mods,             0, "firm: disable remainder optimization" },
   { X("opt-fragile-ops"),        &firm_opt.fragile_ops,      1, "firm: enable fragile ops optimization" },
   { X("no-opt-fragile-ops"),     &firm_opt.fragile_ops,      0, "firm: disable fragile ops optimization" },
@@ -162,8 +171,6 @@ static const struct params {
   { X("no-opt-load-store"),      &firm_opt.load_store,       0, "firm: disable load store optimization" },
   { X("opt-modes"),              &firm_opt.modes,            1, "firm: optimize integer modes" },
   { X("no-opt-modes"),           &firm_opt.modes,            0, "firm: disable integer modes optimization" },
-  { X("jmptbls"),                &firm_opt.jmp_tbls,         1, "firm: create jump table for switch" },
-  { X("no-jmptbls"),             &firm_opt.jmp_tbls,         0, "firm: do not create jump table for switch" },
   { X("sync"),                   &firm_opt.auto_sync,        1, "firm: automatically create Sync nodes" },
   { X("no-sync"),                &firm_opt.auto_sync,        0, "firm: do not create Sync nodes" },
   { X("opt-alias"),              &firm_opt.alias_analysis,   1, "firm: enable alias analysis" },
@@ -184,14 +191,16 @@ static const struct params {
   { X("fp-precise"),             &firm_opt.fp_model,         fp_model_precise, "firm: precise fp model" },
   { X("fp-fast"),                &firm_opt.fp_model,         fp_model_fast,    "firm: fast fp model" },
   { X("fp-strict"),              &firm_opt.fp_model,         fp_model_strict,  "firm: strict fp model" },
-  { X("luffig"),                 &firm_opt.luffig,           1, "firm: enable the fluffy load/store optimization" },
-  { X("no-luffig"),              &firm_opt.luffig,           0, "firm: disable the fluffy load/store optimization" },
+  { X("sync"),                   &firm_opt.sync,             1, "firm: use Syncs to remove unnecessary memory dependencies" },
+  { X("no-sync"),                &firm_opt.sync,             0, "firm: do not use Syncs to remove unnecessary memory dependencies" },
   { X("deconv"),                 &firm_opt.deconv,           1, "firm: enable the conv node optimization" },
   { X("no-deconv"),              &firm_opt.deconv,           0, "firm: disable the conv node optimization" },
   { X("opt-cc"),                 &firm_opt.cc_opt,           1, "firm: enable calling conventions optimization" },
   { X("no-opt-cc"),              &firm_opt.cc_opt,           0, "firm: disable calling conventions optimization" },
   { X("bool"),                   &firm_opt.bool_opt,         1, "firm: enable bool simplification optimization" },
   { X("no-bool"),                &firm_opt.bool_opt,         0, "firm: disable bool simplification optimization" },
+  { X("shape-blocks"),           &firm_opt.shape_blocks,     1, "firm: enable block shaping" },
+  { X("no-shape-blcoks"),        &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" },
 
@@ -290,7 +299,7 @@ static void disable_opts(void) {
   firm_opt.reassoc         = FALSE;
   firm_opt.cse             = FALSE;
   /* firm_opt.control_flow */
-  firm_opt.code_place      = FALSE;
+  firm_opt.gcse            = FALSE;
   firm_opt.gvn_pre         = FALSE;
   firm_opt.cond_eval       = FALSE;
   firm_opt.if_conversion   = FALSE;
@@ -313,10 +322,11 @@ static void disable_opts(void) {
   firm_opt.alias_analysis  = FALSE;
   firm_opt.strict_alias    = FALSE;
   firm_opt.no_alias        = FALSE;
-  firm_opt.luffig          = FALSE;
+  firm_opt.sync            = FALSE;
   firm_opt.deconv          = FALSE;
   firm_opt.cc_opt          = FALSE;
   firm_opt.bool_opt        = FALSE;
+  firm_opt.shape_blocks    = FALSE;
   firm_opt.freestanding    = TRUE;
 }  /* disable_opts */
 
@@ -339,6 +349,14 @@ int firm_option(const char *opt)
     firm_opt.cloning = TRUE;
     return 1;
   }
+  else if (strncmp("inline-max-size=", opt, 16) == 0) {
+    sscanf(&opt[16], "%u", &firm_opt.inline_maxsize);
+    return 1;
+  }
+  else if (strncmp("inline-threshold=", opt, 17) == 0) {
+    sscanf(&opt[17], "%u", &firm_opt.inline_threshold);
+    return 1;
+  }
   else if (strncmp("ycomp-host=", opt, 11) == 0) {
     opt = &opt[11];
     set_ycomp_host(opt);
@@ -377,21 +395,6 @@ int firm_option(const char *opt)
         res &= firm_be_option("stabs");
         return res;
       }
-      /* OS option must be set to the backend */
-      else if (firm_options[i].flag == &firm_opt.os_support) {
-        switch (firm_opt.os_support) {
-        case OS_SUPPORT_MINGW:
-          firm_be_option("ia32-gasmode=mingw");
-          break;
-        case OS_SUPPORT_MACHO:
-          firm_be_option("ia32-gasmode=macho");
-          break;
-        case OS_SUPPORT_LINUX:
-        default:
-          firm_be_option("ia32-gasmode=linux");
-          break;
-        }
-      }
       break;
     }
   }
@@ -411,29 +414,7 @@ int firm_be_option(const char *opt) {
 #ifdef FIRM_BACKEND
   return be_parse_arg(opt);
 #else
+  (void)opt;
   return 0;
 #endif /* FIRM_BACKEND */
 }  /* firm_be_option */
-
-/**
- * prints the firm version number
- */
-void print_firm_version(FILE *f) {
-  firm_version_t version;
-
-  firm_get_version(&version);
-
-  fprintf(f, "Firm C-Compiler using libFirm (%u.%u", version.major, version.minor);
-  if (version.revision[0] != 0) {
-       fputc(' ', f);
-    fputs(version.revision, f);
-  }
-   if(version.build[0] != 0) {
-       fputc(' ', f);
-    fputs(version.build, f);
-  }
-  fprintf(f, "}\n"
-                    "(C) 2005-2008 Michael Beck\n"
-             "(C) 1995-2008 University of Karlsruhe\n"
-             "Using ");
-}  /* print_firm_version */