move -ffp-XXX flags handling to main cparser to be more independent of firm_cmdline
authorMatthias Braun <matze@braunis.de>
Fri, 10 Jun 2011 12:51:48 +0000 (14:51 +0200)
committerMatthias Braun <matze@braunis.de>
Fri, 10 Jun 2011 12:51:48 +0000 (14:51 +0200)
ast2firm.c
ast2firm.h
driver/firm_cmdline.c
driver/firm_cmdline.h
main.c
type.c

index 53edbdd..c214587 100644 (file)
@@ -49,7 +49,6 @@
 #include "printer.h"
 #include "entitymap_t.h"
 #include "driver/firm_opt.h"
-#include "driver/firm_cmdline.h"
 
 typedef struct trampoline_region trampoline_region;
 struct trampoline_region {
@@ -57,6 +56,8 @@ struct trampoline_region {
        ir_entity        *region;      /**< created region for the trampoline */
 };
 
+fp_model_t firm_fp_model = fp_model_precise;
+
 static const backend_params *be_params;
 
 static ir_type *ir_type_char;
@@ -5803,7 +5804,7 @@ static void create_function(entity_t *entity)
        ir_graph *old_current_function = current_function;
        current_function = irg;
 
-       set_irg_fp_model(irg, firm_opt.fp_model);
+       set_irg_fp_model(irg, firm_fp_model);
        tarval_enable_fp_ops(1);
        set_irn_dbg_info(get_irg_start_block(irg),
                         get_entity_dbg_info(function_entity));
index 03e59e8..fc92beb 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef AST2FIRM_H
 #define AST2FIRM_H
 
-#include <libfirm/firm_types.h>
+#include <libfirm/firm.h>
 #include "ast.h"
 #include "type.h"
 
@@ -36,4 +36,6 @@ typedef ident* (*create_ld_ident_func)(entity_t *entity);
 
 void set_create_ld_ident(create_ld_ident_func func);
 
+extern fp_model_t firm_fp_model;
+
 #endif
index c500848..4365e53 100644 (file)
@@ -26,7 +26,6 @@ struct a_firm_opt firm_opt = {
   /* alias_analysis  = */ true,
   /* strict_alias    = */ false,
   /* no_alias        = */ false,
-  /* fp_model        = */ fp_model_precise,
   /* verify          = */ FIRM_VERIFICATION_ON,
   /* check_all       = */ true,
   /* clone_threshold = */ DEFAULT_CLONE_THRESHOLD,
@@ -85,9 +84,6 @@ static const struct params {
   { X("strict-aliasing"),        &firm_opt.strict_alias,     1, "firm: strict alias rules" },
   { X("no-strict-aliasing"),     &firm_opt.strict_alias,     0, "firm: strict alias rules" },
   { X("clone-threshold=<value>"),NULL,                       0, "firm: set clone threshold to <value>" },
-  { 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" },
 
   /* other firm regarding options */
   { X("verify-off"),             &firm_opt.verify,           FIRM_VERIFICATION_OFF, "firm: disable node verification" },
index 774365b..a0c7370 100644 (file)
@@ -19,7 +19,6 @@ struct a_firm_opt {
   bool     alias_analysis;  /**< enable Alias Analysis */
   bool     strict_alias;    /**< enable strict Alias Analysis (using type based AA) */
   bool     no_alias;        /**< no aliasing possible. */
-  bool     fp_model;        /**< fp model */
   bool     verify;          /**< Firm verifier setting */
   bool     check_all;       /**< enable checking all Firm phases */
   int      clone_threshold; /**< The threshold value for procedure cloning. */
diff --git a/main.c b/main.c
index a638a1a..6a4cf71 100644 (file)
--- a/main.c
+++ b/main.c
@@ -655,16 +655,11 @@ static void print_help_codegeneration(void)
        put_help("-fhosted",                 "compile in hosted (not freestanding) mode");
        put_help("-fprofile-generate",       "Generate instrumented code to collect profile information");
        put_help("-fprofile-use",            "Use profile information generated by instrumented binaries");
+       put_help("-ffp-precise",             "precise floating point model");
+       put_help("-ffp-fast",                "imprecise floating point model");
+       put_help("-ffp-strict",              "strict floating point model");
+       put_help("-ffp-precise",             "precise floating point model");
        put_help("-pthread",                 "Use pthread threading library");
-       put_help("-fverbose-asm",            "ignored (gcc compatibility)");
-       put_help("-ffast-math",              "ignored (gcc compatibility)");
-       put_help("-fjump-tables",            "ignored (gcc compatibility)");
-       put_help("-fcommon",                 "ignored (gcc compatibility)");
-       put_help("-foptimize-sibling-calls", "ignored (gcc compatibility)");
-       put_help("-falign-loops",            "ignored (gcc compatibility)");
-       put_help("-falign-jumps",            "ignored (gcc compatibility)");
-       put_help("-falign-functions",        "ignored (gcc compatibility)");
-       put_help("-fPIC",                    "ignored (gcc compatibility)");
        put_help("-mtarget=TARGET",          "Specify target architecture as CPU-manufacturer-OS triple");
        put_help("-mtriple=TARGET",          "alias for -mtarget (clang compatibility)");
        put_help("-march=ARCH",              "");
@@ -677,6 +672,15 @@ static void print_help_codegeneration(void)
        put_help("-msoft-float",             "not supported yet");
        put_help("-m32",                     "generate 32bit code");
        put_help("-m64",                     "generate 64bit code");
+       put_help("-fverbose-asm",            "ignored (gcc compatibility)");
+       put_help("-fjump-tables",            "ignored (gcc compatibility)");
+       put_help("-fcommon",                 "ignored (gcc compatibility)");
+       put_help("-foptimize-sibling-calls", "ignored (gcc compatibility)");
+       put_help("-falign-loops",            "ignored (gcc compatibility)");
+       put_help("-falign-jumps",            "ignored (gcc compatibility)");
+       put_help("-falign-functions",        "ignored (gcc compatibility)");
+       put_help("-fPIC",                    "ignored (gcc compatibility)");
+       put_help("-ffast-math",              "same as fp-fast (gcc compatibility)");
        puts("");
        puts("\tMost of these options can be used with a no- prefix to disable them");
        puts("\ti.e. -fno-signed-char");
@@ -1081,10 +1085,15 @@ int main(int argc, char **argv)
                                                   streq(opt, "asynchronous-unwind-tables")) {
                                            /* nothing todo, a gcc feature which we don't support
                                             * anyway was deactivated */
-                                       } else if (streq(orig_opt, "verbose-asm")) {
+                                       } else if (streq(opt, "verbose-asm")) {
                                                /* ignore: we always print verbose assembler */
-                                       } else if (streq(opt, "fast-math")               ||
-                                                  streq(opt, "jump-tables")             ||
+                                       } else if (streq(opt, "fast-math") || streq(opt, "fp-fast")) {
+                                               firm_fp_model = fp_model_fast;
+                                       } else if (streq(opt, "fp-precise")) {
+                                               firm_fp_model = fp_model_precise;
+                                       } else if (streq(opt, "fp-strict")) {
+                                               firm_fp_model = fp_model_strict;
+                                       } else if (streq(opt, "jump-tables")             ||
                                                   streq(opt, "expensive-optimizations") ||
                                                   streq(opt, "common")                  ||
                                                   streq(opt, "optimize-sibling-calls")  ||
diff --git a/type.c b/type.c
index 92f571c..1fd4b64 100644 (file)
--- a/type.c
+++ b/type.c
@@ -33,7 +33,6 @@
 #include "warning.h"
 #include "diagnostic.h"
 #include "printer.h"
-#include "driver/firm_cmdline.h"
 
 /** The default calling convention. */
 cc_kind_t default_calling_convention = CC_CDECL;