X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firflag.c;h=ed5967f5b984cb52162050d1f863d9be82922dad;hb=cb91bddc9cacdab7c28e4336847bd3dc248aa549;hp=fdfbd2df0b1eccbcc90f1db5a5eab538ac082a86;hpb=e570f00fb465d212dde403160e97ab45d36d1d7e;p=libfirm diff --git a/ir/ir/irflag.c b/ir/ir/irflag.c index fdfbd2df0..ed5967f5b 100644 --- a/ir/ir/irflag.c +++ b/ir/ir/irflag.c @@ -26,17 +26,47 @@ optimization_state_t libFIRM_opt = ENABLE(OPT_OPTIMIZED) | ENABLE(OPT_CSE) | DISABLE(OPT_GLOBAL_CSE) | + 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_NORMALIZE); + ENABLE(OPT_NORMALIZE) | + ENABLE(OPT_TAIL_RECURSION) | + ENABLE(OPT_PRECISE_EXC_CONTEXT) | + 0; + +optimization_state_t libFIRM_verb = + DISABLE(OPT_OPTIMIZED) | + DISABLE(OPT_CSE) | + DISABLE(OPT_GLOBAL_CSE) | + 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_NORMALIZE) | + DISABLE(OPT_TAIL_RECURSION) | + DISABLE(OPT_PRECISE_EXC_CONTEXT) | + 0; + +int firm_verbosity_level; /* set the flags with set_flagname, get the flag with get_flagname */ void set_opt_cse (int value) @@ -55,6 +85,22 @@ void set_opt_global_cse(int value) libFIRM_opt &= ~OPT_GLOBAL_CSE; } +void set_opt_strength_red (int value) +{ + if (value) + libFIRM_opt |= OPT_STRENGTH_RED; + else + libFIRM_opt &= ~OPT_STRENGTH_RED; +} + +void set_opt_strength_red_verbose (int value) +{ + if (value) + libFIRM_verb |= OPT_STRENGTH_RED; + else + libFIRM_verb &= ~OPT_STRENGTH_RED; +} + void set_opt_constant_folding(int value) { @@ -64,6 +110,14 @@ set_opt_constant_folding(int value) libFIRM_opt &= ~OPT_CONSTANT_FOLDING; } +void +set_opt_redundant_LoadStore(int value) { + if (value) + libFIRM_opt |= OPT_REDUNDANT_LOADSTORE; + else + libFIRM_opt &= ~OPT_REDUNDANT_LOADSTORE; +} + void set_opt_unreachable_code(int value) { @@ -132,6 +186,20 @@ void set_opt_dead_node_elimination(int value) 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) @@ -145,6 +213,18 @@ int get_optimize(void) return get_opt_optimize(); } + +void set_firm_verbosity (int value) { + firm_verbosity_level = value; +} + +int (get_firm_verbosity) (void) { + return __get_firm_verbosity(); +} + + + +/* Enable/Disables inlining. */ void set_opt_inline(int value) { if (value) @@ -153,12 +233,7 @@ void set_opt_inline(int value) libFIRM_opt &= ~OPT_INLINE; } -/** Enable/Disable optimization of dynamic method dispatch - * - * This flag enables/disables the optimization of dynamic method dispatch. - * If the flag is turned on Sel nodes can be replaced by Const nodes representing - * the address of a function. - */ +/* Enable/Disable optimization of dynamic method dispatch */ void set_opt_dyn_meth_dispatch (int value) { if (value) @@ -167,6 +242,7 @@ void set_opt_dyn_meth_dispatch (int value) libFIRM_opt &= ~OPT_DYN_METH_DISPATCH; } +/* Enable/Disable normalizations of the firm representation. */ void set_opt_normalize(int value) { if (value) @@ -175,102 +251,43 @@ void set_opt_normalize(int value) libFIRM_opt &= ~OPT_NORMALIZE; } -/* Save the current optimization state. */ -void save_optimization_state(optimization_state_t *state) -{ - *state = libFIRM_opt; -} - -/* Restore the current optimization state. */ -void restore_optimization_state(const optimization_state_t *state) -{ - libFIRM_opt = *state; -} - -/* repeat 'inline' methods here */ - -# ifndef USE_GCC_INLINE - -/** Returns constant folding optimization setting. */ -int get_opt_cse(void) /* iropt.c */ -{ - return libFIRM_opt & OPT_CSE; -} - -/** Returns constant subexpression elimination setting. */ -int get_opt_global_cse(void) /* irgopt.c iropt.c */ -{ - return libFIRM_opt & OPT_GLOBAL_CSE; -} - -/** Returns global constant subexpression elimination setting. */ -int get_opt_constant_folding(void) /* iropt.c */ -{ - return libFIRM_opt & OPT_CONSTANT_FOLDING; -} - -/** Returns unreachable code elimination setting. */ -int get_opt_unreachable_code(void) /* iropt.c */ +/* Enable/Disable optimization of tail-recursion calls. */ +void set_opt_tail_recursion(int value) { - return libFIRM_opt & OPT_UNREACHABLE_CODE; -} - -/** Returns Straightening setting. */ -int get_opt_control_flow_straightening(void) /* iropt.c, irgopt.c */ -{ - return libFIRM_opt & OPT_CONTROL_FLOW_STRAIGHTENING; -} - -/** Returns if simplifications in local optimizations setting. */ -int get_opt_control_flow_weak_simplification(void) /* iropt.c, irgopt.c */ -{ - return libFIRM_opt & OPT_CONTROL_FLOW_WEAK_SIMPLIFICATION; -} - -/** Returns strong if and loop simplification setting */ -int get_opt_control_flow_strong_simplification(void) /* irgopt.c */ -{ - return libFIRM_opt & OPT_CONTROL_FLOW_STRONG_SIMPLIFICATION; -} - -/** Returns whether critical edges are removed */ -int get_opt_critical_edges(void) /* irgopt.c */ -{ - return libFIRM_opt & OPT_CRITICAL_EDGES; -} - -/** Returns reassociation setting. */ -int get_opt_reassociation(void) /* iropt.c */ -{ - return libFIRM_opt & OPT_REASSOCIATION; -} - -/** Returns dead node elimination setting. */ -int get_opt_dead_node_elimination(void) /* irgopt.c */ -{ - return libFIRM_opt & OPT_DEAD_NODE_ELIMINATION; + if (value) + libFIRM_opt |= OPT_TAIL_RECURSION; + else + libFIRM_opt &= ~OPT_TAIL_RECURSION; } -/** Returns global optimization setting */ -int get_opt_optimize(void) /* iropt.c, irgopt.c */ +/* Enable/Disable optimization of tail-recursion calls. */ +void set_opt_tail_recursion_verbose(int value) { - return libFIRM_opt & OPT_OPTIMIZED; + if (value) + libFIRM_verb |= OPT_TAIL_RECURSION; + else + libFIRM_verb &= ~OPT_TAIL_RECURSION; } -/** Returns inlining setting. */ /* how appropriate */ -int get_opt_inline(void) /* irgopt.c */ +/* Enable/Disable precise exception context. */ +void set_opt_precise_exc_context(int value) { - return libFIRM_opt & OPT_INLINE; +#if PRECISE_EXC_CONTEXT + if (value) + libFIRM_opt |= OPT_PRECISE_EXC_CONTEXT; + else + libFIRM_opt &= ~OPT_PRECISE_EXC_CONTEXT; +#endif } -int get_opt_dyn_meth_dispatch(void) /* cgana.c */ +/* Save the current optimization state. */ +void save_optimization_state(optimization_state_t *state) { - return libFIRM_opt & OPT_DYN_METH_DISPATCH; + *state = libFIRM_opt; } -int get_opt_normalize(void) /* irgopt.c, irnode.c, iropt.c */ +/* Restore the current optimization state. */ +void restore_optimization_state(const optimization_state_t *state) { - return libFIRM_opt & OPT_NORMALIZE; + libFIRM_opt = *state; } - -# endif /* not defined USE_GCC_INLINE */