From: Matthias Braun Date: Sat, 13 Dec 2008 17:56:13 +0000 (+0000) Subject: introduce fp_no_float_fold flag for frontends which do not query the backends float... X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=3a5977e21e90a3f51a7601e63cb75f217090b268;p=libfirm introduce fp_no_float_fold flag for frontends which do not query the backends float arithmetic mode yet [r24609] --- diff --git a/include/libfirm/iropt.h b/include/libfirm/iropt.h index e008edec7..9203ef8e0 100644 --- a/include/libfirm/iropt.h +++ b/include/libfirm/iropt.h @@ -51,20 +51,24 @@ * - fp_model_fast: * Fastest mode. Associative and distributive law allowed at the expense * of floating point accuracy and correctness. Explicit rounding is disabled. + * - fp_no_float_fold: + * Avoid floating point constant folding. Usefull for frontends which do not + * create arithmetic operations in the backends arithmetic mode. */ typedef enum _fp_model_t { - fp_explicit_rounding = 1, /**< Explicit rounding at assignments, typecasts, return + fp_explicit_rounding = (1u << 0), /**< Explicit rounding at assignments, typecasts, return and function calls. Conv nodes may NOT be removed, even if they look useless. */ - fp_strict_algebraic = 2, /**< Strict adherence to non-associative and non-distributive + fp_strict_algebraic = (1u << 1), /**< Strict adherence to non-associative and non-distributive algebra unless the same result is guaranteed. */ - fp_contradictions = 4, /**< FP contradictions are enabled. Only for backend. */ - fp_strict_eval_order = 8, /**< FP instructions must be strict evaluated in given order. */ - fp_exceptions = 16, /**< FP exceptions are supported. No reordering that changes + fp_contradictions = (1u << 2), /**< FP contradictions are enabled. Only for backend. */ + fp_strict_eval_order = (1u << 3), /**< FP instructions must be strict evaluated in given order. */ + fp_exceptions = (1u << 4), /**< FP exceptions are supported. No reordering that changes the exception flow are allowed. Backends must generate synchronized exception code. */ - fp_environment_access = 32, /**< FPU environment can be accessed. Even Constant folding + fp_environment_access = (1u << 5), /**< FPU environment can be accessed. Even Constant folding cannot be done. */ + fp_no_float_fold = (1u << 6), /** Precise floating point model. Default. */ fp_model_precise = fp_explicit_rounding|fp_strict_algebraic|fp_contradictions, diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index 265daadb3..92df9f6f2 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -6343,7 +6343,8 @@ ir_node *optimize_node(ir_node *n) { unsigned fp_model = get_irg_fp_model(current_ir_graph); int old_fp_mode = tarval_fp_ops_enabled(); - tarval_enable_fp_ops((fp_model & fp_strict_algebraic) == 0); + tarval_enable_fp_ops(! (fp_model & fp_no_float_fold)); + /* try to evaluate */ tv = computed_value(n); if (tv != tarval_bad) {