From d6d313f6d3744aa43367459c8b31c95f98eeafc7 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Fri, 18 Nov 2005 14:49:11 +0000 Subject: [PATCH] factored all optimization flags into ir_flag_t.def file [r6950] --- ir/ir/irflag.c | 397 +++++---------------------------------------- ir/ir/irflag.h | 4 +- ir/ir/irflag_t.def | 94 +++++++++++ ir/ir/irflag_t.h | 291 +++------------------------------ 4 files changed, 168 insertions(+), 618 deletions(-) create mode 100644 ir/ir/irflag_t.def diff --git a/ir/ir/irflag.c b/ir/ir/irflag.c index f8b2f01d5..beb1638b5 100644 --- a/ir/ir/irflag.c +++ b/ir/ir/irflag.c @@ -19,148 +19,67 @@ /* DISABLE - don't do this optimization ENABLE - lets see, if there is a better graph */ -#define ENABLE(a) a -#define DISABLE(a) 0 +#define ON (-1) +#define OFF (0) -optimization_state_t libFIRM_opt = - ENABLE(OPT_OPTIMIZED) | - ENABLE(OPT_CSE) | - DISABLE(OPT_GLOBAL_CSE) | - ENABLE(OPT_LOOP_UNROLLING) | - ENABLE(OPT_STRENGTH_RED) | - ENABLE(OPT_CONSTANT_FOLDING) | - ENABLE(OPT_REDUNDANT_LOADSTORE) | - ENABLE(OPT_UNREACHABLE_CODE) | - ENABLE(OPT_CONTROL_FLOW_STRAIGHTENING) | - ENABLE(OPT_CONTROL_FLOW_WEAK_SIMPLIFICATION) | - ENABLE(OPT_CONTROL_FLOW_STRONG_SIMPLIFICATION) | - ENABLE(OPT_CRITICAL_EDGES) | - ENABLE(OPT_DEAD_NODE_ELIMINATION) | - ENABLE(OPT_DEAD_METHOD_ELIMINATION) | - ENABLE(OPT_REASSOCIATION) | - ENABLE(OPT_INLINE) | - ENABLE(OPT_DYN_METH_DISPATCH) | - ENABLE(OPT_CLASS_CASTS) | - DISABLE(OPT_SUPPRESS_DOWNCAST_OPT) | - ENABLE(OPT_NORMALIZE) | - ENABLE(OPT_TAIL_RECURSION) | - ENABLE(OPT_PRECISE_EXC_CONTEXT) | - DISABLE(OPT_FRAGILE_OPS) | - ENABLE(OPT_IF_CONVERSION) | - ENABLE(OPT_REAL_FUNC_CALL) | - DISABLE(OPT_REMOVE_CONFIRM) | - ENABLE(OPT_SCALAR_REPLACEMENT) | - 0; +#define FLAG(name, value, def) (irf_##name & def) | +#define E_FLAG(name, value, def) FLAG(name, value, def) +#define I_FLAG(name, value, def) FLAG(name, value, def) -optimization_state_t libFIRM_verb = - DISABLE(OPT_OPTIMIZED) | - DISABLE(OPT_CSE) | - DISABLE(OPT_GLOBAL_CSE) | - DISABLE(OPT_LOOP_UNROLLING) | - DISABLE(OPT_STRENGTH_RED) | - DISABLE(OPT_CONSTANT_FOLDING) | - DISABLE(OPT_REDUNDANT_LOADSTORE) | - DISABLE(OPT_UNREACHABLE_CODE) | - DISABLE(OPT_CONTROL_FLOW_STRAIGHTENING) | - DISABLE(OPT_CONTROL_FLOW_WEAK_SIMPLIFICATION) | - DISABLE(OPT_CONTROL_FLOW_STRONG_SIMPLIFICATION) | - DISABLE(OPT_CRITICAL_EDGES) | - DISABLE(OPT_DEAD_NODE_ELIMINATION) | - DISABLE(OPT_DEAD_METHOD_ELIMINATION) | - DISABLE(OPT_REASSOCIATION) | - DISABLE(OPT_INLINE) | - DISABLE(OPT_DYN_METH_DISPATCH) | - DISABLE(OPT_CLASS_CASTS) | - DISABLE(OPT_NORMALIZE) | - DISABLE(OPT_TAIL_RECURSION) | - DISABLE(OPT_PRECISE_EXC_CONTEXT) | - DISABLE(OPT_FRAGILE_OPS) | - DISABLE(OPT_IF_CONVERSION) | - DISABLE(OPT_REAL_FUNC_CALL) | - DISABLE(OPT_REMOVE_CONFIRM) | - DISABLE(OPT_SCALAR_REPLACEMENT) | +optimization_state_t libFIRM_opt = +#include "irflag_t.def" 0; -/** The Firm verbosity level */ -int firm_verbosity_level; - -/* set the flags with set_flagname, get the flag with get_flagname */ -void set_opt_cse (int value) -{ - if (value) - libFIRM_opt |= OPT_CSE; - else - libFIRM_opt &= ~OPT_CSE; -} +#undef FLAG +#undef E_FLAG +#undef I_FLAG -int (get_opt_cse)(void) { - return _get_opt_cse(); -} -void set_opt_global_cse(int value) -{ - if (value) - libFIRM_opt |= OPT_GLOBAL_CSE; - else - libFIRM_opt &= ~OPT_GLOBAL_CSE; -} +/* verbose is always off on default */ +optimization_state_t libFIRM_verb = 0; -void set_opt_loop_unrolling (int value) -{ - if (value) - libFIRM_opt |= OPT_LOOP_UNROLLING; - else - libFIRM_opt &= ~OPT_LOOP_UNROLLING; -} +/** The Firm verbosity level */ +int firm_verbosity_level; -void set_opt_loop_unrolling_verbose (int value) -{ - if (value) - libFIRM_verb |= OPT_LOOP_UNROLLING; - else - libFIRM_verb &= ~OPT_LOOP_UNROLLING; +/* an external flag can be set and get from outside */ +#define E_FLAG(name, value, def) \ +void set_opt_##name(int flag) { \ + if (value) libFIRM_opt |= irf_##name; \ + else libFIRM_opt &= ~irf_##name; \ +} \ +void set_opt_##name##_verbose(int flag) { \ + if (value) libFIRM_verb |= irf_##name; \ + else libFIRM_verb &= ~irf_##name; \ +} \ +int (get_opt_##name)(void) { \ + return _get_opt_##name(); \ } -void set_opt_strength_red (int value) -{ - if (value) - libFIRM_opt |= OPT_STRENGTH_RED; - else - libFIRM_opt &= ~OPT_STRENGTH_RED; +/* an internal flag can only be set from outside */ +#define I_FLAG(name, value, def) \ +void set_opt_##name(int flag) { \ + if (value) libFIRM_opt |= irf_##name; \ + else libFIRM_opt &= ~irf_##name; \ +} \ +void set_opt_##name##_verbose(int flag) { \ + if (value) libFIRM_verb |= irf_##name; \ + else libFIRM_verb &= ~irf_##name; \ } -void set_opt_strength_red_verbose (int value) -{ - if (value) - libFIRM_verb |= OPT_STRENGTH_RED; - else - libFIRM_verb &= ~OPT_STRENGTH_RED; -} +/* generate them */ +#include "irflag_t.def" -void -set_opt_constant_folding(int value) -{ - if (value) - libFIRM_opt |= OPT_CONSTANT_FOLDING; - else - libFIRM_opt &= ~OPT_CONSTANT_FOLDING; -} +#undef I_FLAG +#undef E_FLAG -void -set_opt_redundant_LoadStore(int value) { - if (value) - libFIRM_opt |= OPT_REDUNDANT_LOADSTORE; - else - libFIRM_opt &= ~OPT_REDUNDANT_LOADSTORE; +/* for compatibility reasons */ +void set_optimize(int value) { + if (value) libFIRM_opt |= irf_optimize; + else libFIRM_opt &= ~irf_optimize; } -void -set_opt_unreachable_code(int value) -{ - if (value) - libFIRM_opt |= OPT_UNREACHABLE_CODE; - else - libFIRM_opt &= ~OPT_UNREACHABLE_CODE; +int (get_optimize)(void) { + return get_opt_optimize(); } void set_opt_control_flow(int value) @@ -171,85 +90,6 @@ void set_opt_control_flow(int value) set_opt_critical_edges(value); } -/* Performs Straightening */ -void set_opt_control_flow_straightening(int value) -{ - if (value) - libFIRM_opt |= OPT_CONTROL_FLOW_STRAIGHTENING; - else - libFIRM_opt &= ~OPT_CONTROL_FLOW_STRAIGHTENING; -} - -/* Performs if simplifications in local optimizations. */ -void set_opt_control_flow_weak_simplification(int value) -{ - if (value) - libFIRM_opt |= OPT_CONTROL_FLOW_WEAK_SIMPLIFICATION; - else - libFIRM_opt &= ~OPT_CONTROL_FLOW_WEAK_SIMPLIFICATION; -} - -/* Performs strong if and loop simplification (in optimize_cf). */ -void set_opt_control_flow_strong_simplification(int value) -{ - if (value) - libFIRM_opt |= OPT_CONTROL_FLOW_STRONG_SIMPLIFICATION; - else - libFIRM_opt &= ~OPT_CONTROL_FLOW_STRONG_SIMPLIFICATION; -} - -void set_opt_critical_edges(int value) -{ - if (value) - libFIRM_opt |= OPT_CRITICAL_EDGES; - else - libFIRM_opt &= ~OPT_CRITICAL_EDGES; -} - -void set_opt_reassociation(int value) -{ - if (value) - libFIRM_opt |= OPT_REASSOCIATION; - else - libFIRM_opt &= ~OPT_REASSOCIATION; -} - -void set_opt_dead_node_elimination(int value) -{ - if (value) - libFIRM_opt |= OPT_DEAD_NODE_ELIMINATION; - else - libFIRM_opt &= ~OPT_DEAD_NODE_ELIMINATION; -} - -void set_opt_dead_method_elimination (int value) { - if (value) - libFIRM_opt |= OPT_DEAD_METHOD_ELIMINATION; - else - libFIRM_opt &= ~OPT_DEAD_METHOD_ELIMINATION; -} - -void set_opt_dead_method_elimination_verbose (int value) { - if (value) - libFIRM_verb |= OPT_DEAD_METHOD_ELIMINATION; - else - libFIRM_verb &= ~OPT_DEAD_METHOD_ELIMINATION; -} - -void set_optimize(int value) -{ - if (value) - libFIRM_opt |= OPT_OPTIMIZED; - else - libFIRM_opt &= ~OPT_OPTIMIZED; -} - -int get_optimize(void) -{ - return get_opt_optimize(); -} - - void set_firm_verbosity (int value) { firm_verbosity_level = value; } @@ -258,153 +98,6 @@ int (get_firm_verbosity) (void) { return _get_firm_verbosity(); } - - -/* Enable/Disables inlining. */ -void set_opt_inline(int value) -{ - if (value) - libFIRM_opt |= OPT_INLINE; - else - libFIRM_opt &= ~OPT_INLINE; -} - -/* Enable/Disable optimization of dynamic method dispatch */ -void set_opt_dyn_meth_dispatch (int value) -{ - if (value) - libFIRM_opt |= OPT_DYN_METH_DISPATCH; - else - libFIRM_opt &= ~OPT_DYN_METH_DISPATCH; -} - -int (get_opt_dyn_meth_dispatch)(void) { - return _get_opt_dyn_meth_dispatch(); -} - -void set_opt_optimize_class_casts (int value) -{ - if (value) - libFIRM_opt |= OPT_CLASS_CASTS; - else - libFIRM_opt &= ~OPT_CLASS_CASTS; -} -int (get_opt_optimize_class_casts) (void) { - return _get_opt_optimize_class_casts(); -} -void set_opt_optimize_class_casts_verbose (int value) -{ - if (value) - libFIRM_verb |= OPT_CLASS_CASTS; - else - libFIRM_verb &= ~OPT_CLASS_CASTS; -} -int (get_opt_optimize_class_casts_verbose) (void) { - return _get_opt_optimize_class_casts_verbose(); -} -void set_opt_suppress_downcast_optimization(int value) -{ - if (value) - libFIRM_opt |= OPT_SUPPRESS_DOWNCAST_OPT; - else - libFIRM_opt &= ~OPT_SUPPRESS_DOWNCAST_OPT; -} -int (get_opt_suppress_downcast_optimization)(void) { - return _get_opt_suppress_downcast_optimization(); -} - - -/* Enable/Disable normalizations of the firm representation. */ -void set_opt_normalize(int value) -{ - if (value) - libFIRM_opt |= OPT_NORMALIZE; - else - libFIRM_opt &= ~OPT_NORMALIZE; -} - -/* Enable/Disable optimization of tail-recursion calls. */ -void set_opt_tail_recursion(int value) -{ - if (value) - libFIRM_opt |= OPT_TAIL_RECURSION; - else - libFIRM_opt &= ~OPT_TAIL_RECURSION; -} - -/* Enable/Disable optimization of tail-recursion calls. */ -void set_opt_tail_recursion_verbose(int value) -{ - if (value) - libFIRM_verb |= OPT_TAIL_RECURSION; - else - libFIRM_verb &= ~OPT_TAIL_RECURSION; -} - -/* Enable/Disable precise exception context. */ -void set_opt_precise_exc_context(int value) -{ -#if PRECISE_EXC_CONTEXT - if (value) - libFIRM_opt |= OPT_PRECISE_EXC_CONTEXT; - else - libFIRM_opt &= ~OPT_PRECISE_EXC_CONTEXT; -#endif -} - -void set_opt_fragile_ops(int value) -{ - if (value) - libFIRM_opt |= OPT_FRAGILE_OPS; - else - libFIRM_opt &= ~OPT_FRAGILE_OPS; -} - -/* Enable/Disable if conversion. */ -void set_opt_if_conversion(int value) -{ - if (value) - libFIRM_opt |= OPT_IF_CONVERSION; - else - libFIRM_opt &= ~OPT_IF_CONVERSION; -} - -/* Enable/Disable real function call optimization. */ -void set_opt_real_function_call(int value) -{ - if (value) - libFIRM_opt |= OPT_REAL_FUNC_CALL; - else - libFIRM_opt &= ~OPT_REAL_FUNC_CALL; -} - -/* Enable/Disable Confirm node removal. */ -void set_opt_remove_Confirm(int value) -{ - if (value) - libFIRM_opt |= OPT_REMOVE_CONFIRM; - else - libFIRM_opt &= ~OPT_REMOVE_CONFIRM; -} - -/* Enable/Disable scalar replacement optimization. */ -void set_opt_scalar_replacement(int value) -{ - if (value) - libFIRM_opt |= OPT_SCALAR_REPLACEMENT; - else - libFIRM_opt &= ~OPT_SCALAR_REPLACEMENT; -} - -/* Set verbosity for scalar relacement */ -void set_opt_scalar_replacement_verbose(int value) -{ - if (value) - libFIRM_verb |= OPT_SCALAR_REPLACEMENT; - else - libFIRM_verb &= ~OPT_SCALAR_REPLACEMENT; -} - /* Save the current optimization state. */ void save_optimization_state(optimization_state_t *state) { diff --git a/ir/ir/irflag.h b/ir/ir/irflag.h index fc28d11f1..4f7a6399a 100644 --- a/ir/ir/irflag.h +++ b/ir/ir/irflag.h @@ -91,7 +91,7 @@ void set_opt_loop_unrolling_verbose (int value); * - remove Load that loads a value already loaded (RAR) * - replace Load of constant values with constants (RC) */ -void set_opt_redundant_LoadStore(int value); +void set_opt_redundant_loadstore(int value); /** Enables/Disables constant subexpression elimination. * @@ -249,7 +249,7 @@ void set_opt_real_function_call(int value); /** * Enable/Disable Confirm node removal during local optimization. */ -void set_opt_remove_Confirm(int value); +void set_opt_remove_confirm(int value); /** * Enable/Disable scalar replacement optimization. diff --git a/ir/ir/irflag_t.def b/ir/ir/irflag_t.def new file mode 100644 index 000000000..374154e51 --- /dev/null +++ b/ir/ir/irflag_t.def @@ -0,0 +1,94 @@ +/* + * Project: libFIRM + * File name: ir/ir/irflag_t.def + * Purpose: Flags to control optimizations, inline implementation. + * Author: Michael Beck + * Created: + * CVS-ID: $Id$ + * Copyright: (c) 1998-2004 Universität Karlsruhe + * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. + */ + +/** Turn off all optimizations. */ +I_FLAG(optimize , 0, ON) + +/** Common subexpression eliminations: Hash the nodes. */ +E_FLAG(cse , 1, ON) + +/** Don't use block predecessor for comparison. + * Default must be zero as code placement must + * be run right after a local optimize walk with + * global_cse on. */ +I_FLAG(global_cse , 2, OFF) + +/** Evaluate operations. */ +I_FLAG(constant_folding , 3, ON) + +/** Bad node propagation. */ +I_FLAG(unreachable_code , 4, ON) + +/** */ +I_FLAG(control_flow_straightening , 5, ON) + +/** */ +I_FLAG(control_flow_weak_simplification , 6, ON) + +/** */ +I_FLAG(control_flow_strong_simplification , 7, ON) + +/** */ +I_FLAG(critical_edges , 8, ON) + +/** Reclaim memory. */ +I_FLAG(dead_node_elimination , 9, ON) + +/** Reassociate nodes. */ +I_FLAG(reassociation , 10, ON) + +/** Do inlining transformation. */ +I_FLAG(inline , 11, ON) + +/** Remove dynamic method dispatch. */ +E_FLAG(dyn_meth_dispatch , 12, ON) + +/** Transformations that normalize the firm representation + * as removing Ids and Tuples, useless Phis, SymConst(id) -> Const(entity) ... + */ +I_FLAG(normalize , 13, ON) + +/** Remove tail-recursion. */ +I_FLAG(tail_recursion , 14, ON) + +/** Free never called methods */ +I_FLAG(dead_method_elimination , 15, ON) + +/** precise exception context */ +I_FLAG(precise_exc_context , 16, ON) + +/** Do loop unrolling */ +I_FLAG(loop_unrolling , 17, ON) + +/** Do Strength reduction */ +I_FLAG(strength_red , 18, ON) + +/** Optimize Loads and Stores */ +I_FLAG(redundant_loadstore , 19, ON) + +/** Optimize Fragile OPs */ +I_FLAG(fragile_ops , 20, OFF) + +/** If conversion. */ +I_FLAG(if_conversion , 21, ON) + +/** Optimize real function calls. */ +I_FLAG(real_function_call , 22, ON) + +/** Optimize cast nodes. */ +E_FLAG(optimize_class_casts , 23, ON) +E_FLAG(suppress_downcast_optimization , 24, OFF) + +/** Not really an optimization, removes Confirm nodes */ +I_FLAG(remove_confirm , 25, OFF) + +/** Scalar replacement. */ +I_FLAG(scalar_replacement , 26, ON) diff --git a/ir/ir/irflag_t.h b/ir/ir/irflag_t.h index 47c755be6..422c31e2a 100644 --- a/ir/ir/irflag_t.h +++ b/ir/ir/irflag_t.h @@ -25,92 +25,13 @@ * current libFIRM optimizations */ typedef enum { - /** Common subexpression eliminations: Hash the nodes. */ - OPT_CSE = 0x00000001, - - /** Don't use block predecessor for comparison. - * Default must be zero as code placement must - * be run right after a local optimize walk with - * opt_global_cse on. */ - OPT_GLOBAL_CSE = 0x00000002, - - /** Evaluate operations. */ - OPT_CONSTANT_FOLDING = 0x00000004, - - /** Bad node propagation. */ - OPT_UNREACHABLE_CODE = 0x00000008, - - /** */ - OPT_CONTROL_FLOW_STRAIGHTENING = 0x00000010, - - /** */ - OPT_CONTROL_FLOW_WEAK_SIMPLIFICATION = 0x00000020, - - /** */ - OPT_CONTROL_FLOW_STRONG_SIMPLIFICATION = 0x00000040, - - /** */ - OPT_CRITICAL_EDGES = 0x00000080, - - /** Reclaim memory. */ - OPT_DEAD_NODE_ELIMINATION = 0x00000100, - - /** Reassociate nodes. */ - OPT_REASSOCIATION = 0x00000200, - - /** Do inlining transformation. */ - OPT_INLINE = 0x00000400, - - /** Remove dynamic method dispatch. */ - OPT_DYN_METH_DISPATCH = 0x00000800, - - /** Transformations that normalize the firm representation - * as removing Ids and Tuples, useless Phis, SymConst(id) -> Const(entity) ... - */ - OPT_NORMALIZE = 0x00001000, - - /** Remove tail-recursion. */ - OPT_TAIL_RECURSION = 0x00002000, - - /** Free never called methods */ - OPT_DEAD_METHOD_ELIMINATION = 0x00004000, - - /** precise exception context */ - OPT_PRECISE_EXC_CONTEXT = 0x00008000, - - /** EMPTY SLOT !!! TO BE ASSIGNED */ - - /** Do loop unrolling */ - OPT_LOOP_UNROLLING = 0x00010000, - - /** Do Strength reduction */ - OPT_STRENGTH_RED = 0x00020000, - - /** Optimize Loads and Stores */ - OPT_REDUNDANT_LOADSTORE = 0x00040000, - - /** Optimize Fragile OPs */ - OPT_FRAGILE_OPS = 0x00080000, - - /** If conversion. */ - OPT_IF_CONVERSION = 0x00100000, - - /** Optimize real function calls. */ - OPT_REAL_FUNC_CALL = 0x00200000, - - /** Optimize cast nodes. */ - OPT_CLASS_CASTS = 0x00400000, - OPT_SUPPRESS_DOWNCAST_OPT = 0x00800000, - - /** Not really an optimization, removes Confirm nodes */ - OPT_REMOVE_CONFIRM = 0x01000000, - - /** Scalar replacement. */ - OPT_SCALAR_REPLACEMENT = 0x02000000, - - /** Turn off all optimizations. */ - OPT_OPTIMIZED = 0x40000000, +#define E_FLAG(name, value, def) irf_##name = (1 << value), +#define I_FLAG(name, value, def) irf_##name = (1 << value), +#include "irflag_t.def" + irf_last +#undef I_FLAG +#undef E_FLAG } libfirm_opts_t; extern optimization_state_t libFIRM_opt; @@ -118,197 +39,39 @@ extern optimization_state_t libFIRM_verb; extern int firm_verbosity_level; - -/** Returns constant folding optimization setting. */ -static INLINE int _get_opt_cse(void) -{ - return libFIRM_opt & OPT_CSE; -} - -/** Returns constant subexpression elimination setting. */ -static INLINE int get_opt_global_cse(void) -{ - return libFIRM_opt & OPT_GLOBAL_CSE; -} - -static INLINE int get_opt_loop_unrolling(void) -{ - return libFIRM_opt & OPT_LOOP_UNROLLING; -} - -/** Returns verbosity for loop unrolling. */ -static INLINE int get_opt_loop_unrolling_verbose(void) -{ - return libFIRM_verb & OPT_LOOP_UNROLLING; -} - -static INLINE int get_opt_strength_red(void) -{ - return libFIRM_opt & OPT_STRENGTH_RED; -} - -/** Returns verbosity for strength reduction. */ -static INLINE int get_opt_strength_red_verbose(void) -{ - return libFIRM_verb & OPT_STRENGTH_RED; -} - -/** Returns global constant subexpression elimination setting. */ -static INLINE int get_opt_constant_folding(void) -{ - return libFIRM_opt & OPT_CONSTANT_FOLDING; -} - -/** Returns global constant subexpression elimination setting. */ -static INLINE int get_opt_redundant_LoadStore(void) -{ - return libFIRM_opt & OPT_REDUNDANT_LOADSTORE; -} - -/** Returns unreachable code elimination setting. */ -static INLINE int get_opt_unreachable_code(void) -{ - return libFIRM_opt & OPT_UNREACHABLE_CODE; -} - -/** Returns Straightening setting. */ -static INLINE int get_opt_control_flow_straightening(void) -{ - return libFIRM_opt & OPT_CONTROL_FLOW_STRAIGHTENING; +/* generate the getter functions for external access */ +#define E_FLAG(name, value, def) \ +static INLINE int _get_opt_##name(void) { \ + return libFIRM_opt & irf_##name; \ +} \ +static INLINE int get_opt_##name##_verbose(void) { \ + return libFIRM_verb & irf_##name; \ } -/** Returns if simplifications in local optimizations setting. */ -static INLINE int get_opt_control_flow_weak_simplification(void) -{ - return libFIRM_opt & OPT_CONTROL_FLOW_WEAK_SIMPLIFICATION; +/* generate the getter functions for internal access */ +#define I_FLAG(name, value, def) \ + static INLINE int get_opt_##name(void) { \ + return libFIRM_opt & irf_##name; \ +} \ + static INLINE int get_opt_##name##_verbose(void) { \ + return libFIRM_verb & irf_##name; \ } -/** Returns strong if and loop simplification setting */ -static INLINE int get_opt_control_flow_strong_simplification(void) -{ - return libFIRM_opt & OPT_CONTROL_FLOW_STRONG_SIMPLIFICATION; -} +#include "irflag_t.def" -/** Returns whether critical edges are removed */ -static INLINE int get_opt_critical_edges(void) -{ - return libFIRM_opt & OPT_CRITICAL_EDGES; -} +#undef I_FLAG +#undef E_FLAG -/** Returns reassociation setting. */ -static INLINE int get_opt_reassociation(void) -{ - return libFIRM_opt & OPT_REASSOCIATION; -} - -/** Returns dead node elimination setting. */ -static INLINE int get_opt_dead_node_elimination(void) -{ - return libFIRM_opt & OPT_DEAD_NODE_ELIMINATION; -} - -/** Returns dead method elimination setting. */ -static INLINE int get_opt_dead_method_elimination(void) -{ - return libFIRM_opt & OPT_DEAD_METHOD_ELIMINATION; -} - -/** Returns dead method elimination setting. */ -static INLINE int get_opt_dead_method_elimination_verbose(void) -{ - return libFIRM_verb & OPT_DEAD_METHOD_ELIMINATION; -} - -/** Returns global optimization setting */ -static INLINE int get_opt_optimize(void) -{ - return libFIRM_opt & OPT_OPTIMIZED; -} static INLINE int _get_firm_verbosity (void) { - return firm_verbosity_level; -} - -/** Returns inlining setting. */ -static INLINE int get_opt_inline(void) -{ - return libFIRM_opt & OPT_INLINE; -} - -static INLINE int _get_opt_dyn_meth_dispatch(void) -{ - return libFIRM_opt & OPT_DYN_METH_DISPATCH; -} - -static INLINE int _get_opt_optimize_class_casts (void) { - return libFIRM_opt & OPT_CLASS_CASTS; -} - -static INLINE int _get_opt_optimize_class_casts_verbose (void) { - return libFIRM_verb & OPT_CLASS_CASTS; -} - -static INLINE int _get_opt_suppress_downcast_optimization (void) { - return libFIRM_opt & OPT_SUPPRESS_DOWNCAST_OPT; -} - -static INLINE int get_opt_normalize(void) -{ - return libFIRM_opt & OPT_NORMALIZE; -} - -/** Returns tail-recursion setting. */ -static INLINE int get_opt_tail_recursion(void) -{ - return libFIRM_opt & OPT_TAIL_RECURSION; -} - -/** Returns tail-recursion setting. */ -static INLINE int get_opt_tail_recursion_verbose(void) -{ - return libFIRM_verb & OPT_TAIL_RECURSION; -} - -/** Returns precise exception context setting. */ -static INLINE int get_opt_precise_exc_context(void) -{ - return libFIRM_opt & OPT_PRECISE_EXC_CONTEXT; -} - -/** Returns fragile ops setting. */ -static INLINE int get_opt_fragile_ops(void) -{ - return libFIRM_opt & OPT_FRAGILE_OPS; -} - -/** Returns if conversion setting. */ -static INLINE int get_opt_if_conversion(void) -{ - return libFIRM_opt & OPT_IF_CONVERSION; -} - -/** Returns real function call optimization setting. */ -static INLINE int get_opt_real_func_call(void) -{ - return libFIRM_opt & OPT_REAL_FUNC_CALL; -} - -/** Returns Confirm removal setting. */ -static INLINE int get_opt_remove_Confirm(void) -{ - return libFIRM_opt & OPT_REMOVE_CONFIRM; -} - -/** Returns Confirm removal setting. */ -static INLINE int get_opt_scalar_replacement(void) -{ - return libFIRM_opt & OPT_SCALAR_REPLACEMENT; + return firm_verbosity_level; } -static INLINE int get_opt_scalar_replacement_verbose(void) { - return libFIRM_verb & OPT_SCALAR_REPLACEMENT; +static INLINE int _get_optimize (void) { + return get_opt_optimize(); } +#define get_optimize() _get_optimize() #define get_opt_cse() _get_opt_cse() #define get_firm_verbosity() _get_firm_verbosity() #define get_opt_dyn_meth_dispatch() _get_opt_dyn_meth_dispatch() -- 2.20.1