From f073d133c36c0f6dda8d11e5b343bd90f383b2a2 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Fri, 10 Jun 2011 14:51:48 +0200 Subject: [PATCH] move -ffp-XXX flags handling to main cparser to be more independent of firm_cmdline --- ast2firm.c | 5 +++-- ast2firm.h | 4 +++- driver/firm_cmdline.c | 4 ---- driver/firm_cmdline.h | 1 - main.c | 33 +++++++++++++++++++++------------ type.c | 1 - 6 files changed, 27 insertions(+), 21 deletions(-) diff --git a/ast2firm.c b/ast2firm.c index 53edbdd..c214587 100644 --- a/ast2firm.c +++ b/ast2firm.c @@ -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)); diff --git a/ast2firm.h b/ast2firm.h index 03e59e8..fc92beb 100644 --- a/ast2firm.h +++ b/ast2firm.h @@ -20,7 +20,7 @@ #ifndef AST2FIRM_H #define AST2FIRM_H -#include +#include #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 diff --git a/driver/firm_cmdline.c b/driver/firm_cmdline.c index c500848..4365e53 100644 --- a/driver/firm_cmdline.c +++ b/driver/firm_cmdline.c @@ -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="),NULL, 0, "firm: set clone threshold to " }, - { 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" }, diff --git a/driver/firm_cmdline.h b/driver/firm_cmdline.h index 774365b..a0c7370 100644 --- a/driver/firm_cmdline.h +++ b/driver/firm_cmdline.h @@ -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 --- 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 --- 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; -- 2.20.1