Commit 9aa71a81 authored by Matthias Braun's avatar Matthias Braun
Browse files

- remove some more of the optimisation flags inside firm. Enabling/Disabling

  an optimization should be decided simply on wether the frontend calls
  it or not.

[r26798]
parent 7b36f67e
......@@ -96,24 +96,6 @@ int get_opt_cse(void);
*/
void set_opt_global_cse(int value);
/** Enables/Disables usage of combo algorithm.
*
* If opt_combo == 1 perform combo optimization
* instead of combinations of optimiza_graph_df()/
* optimize_graph_cf()
* Default: opt_combo == 1.
*/
void set_opt_combo(int value);
/** Enables/Disables strength reduction.
*
* If opt_strength_red == 1 perform strength reduction.
* See strenth_red.h.
*
* Default: opt_strength_red = 1;
*/
void set_opt_strength_red(int value);
/** Enables/Disables unreachable code elimination.
*
* If set, evaluate conditions of conditional branch and replace the
......@@ -180,11 +162,6 @@ void set_opt_fragile_ops(int value);
*/
void set_opt_remove_confirm(int value);
/**
* Enable/Disable scalar replacement optimization.
*/
void set_opt_scalar_replacement(int value);
/**
* Enable/Disable Null exception in Load and Store nodes only.
*
......
......@@ -741,10 +741,11 @@ void normalize_irg_class_casts(ir_graph *irg, gen_pointer_type_to_func gppt_fct)
void optimize_class_casts(void);
/**
* CLiff Click's combo algorithm from "Combining Analyses, combining Optimizations".
* CLiff Click's combo algorithm from
* "Combining Analyses, combining Optimizations".
*
* Does conditional constant propagation, unreachable code elimination and optimistic
* global value numbering at once.
* Does conditional constant propagation, unreachable code elimination and
* optimistic global value numbering at once.
*
* @param irg the graph to run on
*/
......@@ -835,6 +836,8 @@ ir_prog_pass_t *inline_leave_functions_pass(
const char *name, unsigned maxsize, unsigned leavesize,
unsigned size, int ignore_runtime);
typedef void (*opt_ptr)(ir_graph *irg);
/**
* Heuristic inliner. Calculates a benefice value for every call and inlines
* those calls with a value higher than the threshold.
......@@ -843,8 +846,11 @@ ir_prog_pass_t *inline_leave_functions_pass(
* maxsize firm nodes. It may reach this limit by
* inlining.
* @param inline_threshold inlining threshold
* @param after_inline_opt optimizations performed immediately after inlining
* some calls
*/
void inline_functions(unsigned maxsize, int inline_threshold);
void inline_functions(unsigned maxsize, int inline_threshold,
opt_ptr after_inline_opt);
/**
* Creates an ir_prog pass for inline_functions().
......@@ -858,7 +864,8 @@ void inline_functions(unsigned maxsize, int inline_threshold);
* @return the newly created ir_prog pass
*/
ir_prog_pass_t *inline_functions_pass(
const char *name, unsigned maxsize, int inline_threshold);
const char *name, unsigned maxsize, int inline_threshold,
opt_ptr after_inline_opt);
/**
* Combines congruent blocks into one.
......@@ -890,4 +897,8 @@ void do_loop_inversion(ir_graph *irg);
*/
void do_loop_peeling(ir_graph *irg);
typedef ir_type *(*get_Alloc_func)(ir_node *n);
/** Set a new get_Alloc_func and returns the old one. */
get_Alloc_func firm_set_Alloc_func(get_Alloc_func newf);
#endif
......@@ -61,9 +61,6 @@ I_FLAG(control_flow_strong_simplification , 7, ON)
/** Algebraic simplifications. */
I_FLAG(algebraic_simplification , 8, ON)
/** Use combo instead of df/cf optimizations. */
I_FLAG(combo , 9, ON)
/** Use Global Null Pointer Test elimination. */
I_FLAG(global_null_ptr_elimination , 10, ON)
......@@ -78,13 +75,10 @@ I_FLAG(normalize , 12, ON)
I_FLAG(allow_conv_b , 13, ON)
/** precise exception context */
I_FLAG(precise_exc_context , 15, ON)
/** Do Strength reduction */
I_FLAG(strength_red , 17, ON)
I_FLAG(precise_exc_context , 15, OFF)
/** Optimize Fragile OPs */
I_FLAG(fragile_ops , 19, OFF)
I_FLAG(fragile_ops , 16, OFF)
/** Optimize cast nodes. */
E_FLAG(optimize_class_casts , 21, ON)
......@@ -93,9 +87,6 @@ E_FLAG(suppress_downcast_optimization , 22, OFF)
/** Not really an optimization, removes Confirm nodes. */
I_FLAG(remove_confirm , 23, OFF)
/** Scalar replacement. */
I_FLAG(scalar_replacement , 24, ON)
/** Load and Store have only Null exceptions. */
I_FLAG(ldst_only_null_ptr_exceptions , 25, ON)
......
......@@ -1407,7 +1407,6 @@ typedef struct {
unsigned n_callers; /**< Number of known graphs that call this graphs. */
unsigned n_callers_orig; /**< for statistics */
unsigned got_inline:1; /**< Set, if at least one call inside this graph was inlined. */
unsigned local_vars:1; /**< Set, if an inlined function got the address of a local variable. */
unsigned recursive:1; /**< Set, if this function is self recursive. */
} inline_irg_env;
......@@ -1426,7 +1425,6 @@ static inline_irg_env *alloc_inline_irg_env(void) {
env->n_callers = 0;
env->n_callers_orig = 0;
env->got_inline = 0;
env->local_vars = 0;
env->recursive = 0;
return env;
}
......@@ -2284,8 +2282,6 @@ static void inline_into(ir_graph *irg, unsigned maxsize,
/* callee was inline. Append it's call list. */
env->got_inline = 1;
if (curr_call->local_adr)
env->local_vars = 1;
--env->n_call_nodes;
/* we just generate a bunch of new calls */
......@@ -2322,7 +2318,9 @@ static void inline_into(ir_graph *irg, unsigned maxsize,
* Heuristic inliner. Calculates a benefice value for every call and inlines
* those calls with a value higher than the threshold.
*/
void inline_functions(unsigned maxsize, int inline_threshold) {
void inline_functions(unsigned maxsize, int inline_threshold,
opt_ptr after_inline_opt)
{
inline_irg_env *env;
int i, n_irgs;
ir_graph *rem;
......@@ -2368,21 +2366,9 @@ void inline_functions(unsigned maxsize, int inline_threshold) {
ir_graph *irg = irgs[i];
env = get_irg_link(irg);
if (env->got_inline) {
if (env->got_inline && after_inline_opt != NULL) {
/* this irg got calls inlined: optimize it */
if (get_opt_combo()) {
if (env->local_vars) {
scalar_replacement_opt(irg);
}
combo(irg);
} else {
if (env->local_vars) {
if (scalar_replacement_opt(irg)) {
optimize_graph_df(irg);
}
}
optimize_cf(irg);
}
after_inline_opt(irg);
}
if (env->got_inline || (env->n_callers_orig != env->n_callers)) {
DB((dbg, LEVEL_1, "Nodes:%3d ->%3d, calls:%3d ->%3d, callers:%3d ->%3d, -- %s\n",
......@@ -2412,6 +2398,7 @@ struct inline_functions_pass_t {
ir_prog_pass_t pass;
unsigned maxsize;
int inline_threshold;
opt_ptr after_inline_opt;
};
/**
......@@ -2421,18 +2408,21 @@ static int inline_functions_wrapper(ir_prog *irp, void *context) {
struct inline_functions_pass_t *pass = context;
(void)irp;
inline_functions(pass->maxsize, pass->inline_threshold);
inline_functions(pass->maxsize, pass->inline_threshold,
pass->after_inline_opt);
return 0;
}
/* create a ir_prog pass for inline_functions */
ir_prog_pass_t *inline_functions_pass(
const char *name, unsigned maxsize, int inline_threshold) {
const char *name, unsigned maxsize, int inline_threshold,
opt_ptr after_inline_opt) {
struct inline_functions_pass_t *pass =
XMALLOCZ(struct inline_functions_pass_t);
pass->maxsize = maxsize;
pass->inline_threshold = inline_threshold;
pass->after_inline_opt = after_inline_opt;
return def_prog_pass_constructor(
&pass->pass, name ? name : "inline_functions",
......
......@@ -1384,12 +1384,6 @@ void opt_osr(ir_graph *irg, unsigned flags) {
int edges;
int projs_moved;
if (! get_opt_strength_red()) {
/* only kill Phi cycles */
remove_phi_cycles(irg);
return;
}
rem = current_ir_graph;
current_ir_graph = irg;
......
......@@ -53,8 +53,6 @@ ir_type *default_firm_get_Alloc(ir_node *n) {
return NULL;
}
typedef ir_type *(*get_Alloc_func)(ir_node *n);
/** The get_Alloc function */
static get_Alloc_func firm_get_Alloc = default_firm_get_Alloc;
......
......@@ -680,9 +680,6 @@ int scalar_replacement_opt(ir_graph *irg) {
ir_graph *rem;
int res = 0;
if (! get_opt_scalar_replacement())
return 0;
rem = current_ir_graph;
current_ir_graph = irg;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment