Commit 7fb8d0d5 authored by Matthias Braun's avatar Matthias Braun
Browse files

remove some unnecessary/confusing flags

[r28021]
parent 43aca1df
......@@ -108,23 +108,6 @@ FIRM_API void set_opt_global_cse(int value);
*/
FIRM_API void set_opt_unreachable_code(int value);
/** Enables/Disables control flow optimizations.
*
* Performs Straightening, if simplifications and loop simplifications.
* Sets all separate control flow flags (control_flow_straightening,
* weak_simplification, strong_simplification and critical_edges).
*/
FIRM_API void set_opt_control_flow(int value);
/** Enables/Disables Straightening. */
FIRM_API void set_opt_control_flow_straightening(int value);
/** Enables/Disables if simplifications in local optimizations. */
FIRM_API void set_opt_control_flow_weak_simplification(int value);
/** Enables/Disables strong if and loop simplification (in optimize_cf). */
FIRM_API void set_opt_control_flow_strong_simplification(int value);
/** Enable/Disable optimization of dynamic method dispatch.
*
* This flag enables/disables the optimization of dynamic method dispatch.
......@@ -149,11 +132,6 @@ FIRM_API void set_opt_optimize_class_casts(int value);
FIRM_API void set_opt_suppress_downcast_optimization(int value);
FIRM_API int get_opt_suppress_downcast_optimization(void);
/**
* Enable/Disable Confirm node removal during local optimization.
*/
FIRM_API void set_opt_remove_confirm(int value);
/**
* Enable/Disable Null exception in Load and Store nodes only.
*
......@@ -207,27 +185,6 @@ FIRM_API void set_opt_global_null_ptr_elimination(int value);
*/
FIRM_API void set_opt_auto_create_sync(int value);
/** Enable/Disable normalizations of the firm representation.
*
* This flag guards transformations that normalize the Firm representation
* as removing Ids and Tuples, useless Phis, replacing SymConst(id) by
* Const(entity) and others.
* The transformations guarded by this flag are not guarded by flag
* "optimize".
* Many algorithms operating on Firm can not deal with constructs in
* the non-normalized representation.
* default: ON
*
* @note ATTENTION: not all such transformations are guarded by a flag.
*/
FIRM_API void set_opt_normalize(int value);
/**
* Enable/Disable ConvB() nodes with a "semantic behavior", i.e. a real
* operation that must be executed.
*/
FIRM_API void set_opt_allow_conv_b(int value);
/** Enable/Disable Alias analysis.
*
* If enabled, memory disambiguation by alias analysis is used.
......
......@@ -619,38 +619,24 @@ ir_graph_pass_t *construct_confirms_pass(const char *name)
return def_graph_pass(name ? name : "confirm", construct_confirms);
} /* construct_confirms_pass */
#if 0
/**
* Post-walker: Remove Confirm nodes
*/
static void rem_Confirm(ir_node *n, void *env)
static void remove_confirm(ir_node *n, void *env)
{
ir_node *value;
(void) env;
if (is_Confirm(n)) {
ir_node *value = get_Confirm_value(n);
if (value != n)
exchange(n, value);
else {
/*
* Strange: a Confirm is its own bound. This can happen
* in dead blocks when Phi nodes are already removed.
*/
exchange(n, new_Bad());
}
}
} /* rem_Confirm */
#endif
if (!is_Confirm(n))
return;
value = get_Confirm_value(n);
exchange(n, value);
}
/*
* Remove all Confirm nodes from a graph.
*/
void remove_confirms(ir_graph *irg)
{
int rem = get_opt_remove_confirm();
set_opt_remove_confirm(1);
optimize_graph_df(irg);
set_opt_remove_confirm(rem);
irg_walk_graph(irg, NULL, remove_confirm, NULL);
} /* remove_confirms */
/* Construct a pass. */
......
......@@ -665,7 +665,6 @@ static void be_main_loop(FILE *file_handle, const char *cup_name)
/* we switch off optimizations here, because they might cause trouble */
save_optimization_state(&state);
set_optimize(0);
set_opt_normalize(0);
set_opt_cse(0);
/* add Keeps for should_be_different constrained nodes */
......
......@@ -99,13 +99,6 @@ int (get_optimize)(void)
return get_opt_optimize();
}
void set_opt_control_flow(int value)
{
set_opt_control_flow_straightening(value);
set_opt_control_flow_weak_simplification(value);
set_opt_control_flow_strong_simplification(value);
}
/* Save the current optimization state. */
void save_optimization_state(optimization_state_t *state)
{
......
......@@ -49,51 +49,32 @@ 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)
/** Algebraic simplifications. */
I_FLAG(algebraic_simplification , 8, ON)
I_FLAG(algebraic_simplification , 5, ON)
/** Use Global Null Pointer Test elimination. */
I_FLAG(global_null_ptr_elimination , 10, ON)
I_FLAG(global_null_ptr_elimination , 6, ON)
/** Remove dynamic method dispatch. */
E_FLAG(dyn_meth_dispatch , 11, ON)
/** Transformations that normalize the firm representation
* as removing Ids and Tuples, useless Phis, SymConst(id) -> Const(entity) ...
*/
I_FLAG(normalize , 12, ON)
I_FLAG(allow_conv_b , 13, ON)
E_FLAG(dyn_meth_dispatch , 7, ON)
/** Optimize cast nodes. */
E_FLAG(suppress_downcast_optimization , 22, OFF)
/** Not really an optimization, removes Confirm nodes. */
I_FLAG(remove_confirm , 23, OFF)
E_FLAG(suppress_downcast_optimization , 8, OFF)
/** Load and Store have only Null exceptions. */
I_FLAG(ldst_only_null_ptr_exceptions , 25, ON)
I_FLAG(ldst_only_null_ptr_exceptions , 9, ON)
/** Sel-based Null-pointer check elimination. */
I_FLAG(sel_based_null_check_elim , 26, OFF)
I_FLAG(sel_based_null_check_elim , 10, OFF)
/** Automatically create Sync node during construction. */
I_FLAG(auto_create_sync , 27, OFF)
I_FLAG(auto_create_sync , 11, OFF)
/** Enable Alias-analysis. */
I_FLAG(alias_analysis , 28, ON)
I_FLAG(alias_analysis , 12, ON)
/** Closed world assumption. */
I_FLAG(closed_world , 31, OFF)
I_FLAG(closed_world , 13, OFF)
/* -------------------- RUNNING flags ------------------- */
......
......@@ -1610,8 +1610,6 @@ ir_node *skip_HighLevel_ops(ir_node *node)
*
* Note: This function takes 10% of mostly ANY the compiler run, so it's
* a little bit "hand optimized".
*
* Moreover, it CANNOT be switched off using get_opt_normalize() ...
*/
ir_node *skip_Id(ir_node *node)
{
......
......@@ -440,17 +440,10 @@ static tarval *computed_value_Mux(const ir_node *n)
*/
static tarval *computed_value_Confirm(const ir_node *n)
{
/*
* Beware: we might produce Phi(Confirm(x == true), Confirm(x == false)).
* Do NOT optimize them away (jump threading wants them), so wait until
* remove_confirm is activated.
*/
if (get_opt_remove_confirm()) {
if (get_Confirm_cmp(n) == pn_Cmp_Eq) {
tarval *tv = value_of(get_Confirm_bound(n));
if (tv != tarval_bad)
return tv;
}
if (get_Confirm_cmp(n) == pn_Cmp_Eq) {
tarval *tv = value_of(get_Confirm_bound(n));
if (tv != tarval_bad)
return tv;
}
return value_of(get_Confirm_value(n));
} /* computed_value_Confirm */
......@@ -799,7 +792,7 @@ static ir_node *equivalent_node_Block(ir_node *n)
/* Jmp jumps into the block it is in -- deal self cycle. */
n = set_Block_dead(n);
DBG_OPT_DEAD_BLOCK(oldn, n);
} else if (get_opt_control_flow_straightening()) {
} else {
n = predblock;
DBG_OPT_STG(oldn, n);
}
......@@ -811,8 +804,7 @@ static ir_node *equivalent_node_Block(ir_node *n)
DBG_OPT_DEAD_BLOCK(oldn, n);
}
}
} else if ((n_preds == 2) &&
(get_opt_control_flow_weak_simplification())) {
} else if (n_preds == 2) {
/* Test whether Cond jumps twice to this block
* The more general case which more than 2 predecessors is handles
* in optimize_cf(), we handle only this special case for speed here.
......@@ -1408,8 +1400,6 @@ static ir_node *equivalent_node_Phi(ir_node *n)
ir_node *block;
ir_node *first_val = NULL; /* to shutup gcc */
if (!get_opt_normalize()) return n;
n_preds = get_Phi_n_preds(n);
block = get_nodes_block(n);
......@@ -1917,8 +1907,6 @@ static ir_node *equivalent_node_Confirm(ir_node *n)
pred = get_Confirm_value(n);
pnc = get_Confirm_cmp(n);
}
if (get_opt_remove_confirm())
return get_Confirm_value(n);
return n;
}
......
......@@ -425,7 +425,6 @@ void ir_lower_mode_b(ir_graph *irg, const lower_mode_b_config_t *nconfig)
adjust_method_type(type);
set_opt_allow_conv_b(0);
irg_walk_graph(irg, firm_clear_link, NULL, NULL);
irg_walk_graph(irg, lower_mode_b_walker, NULL, &changed);
......
......@@ -171,9 +171,6 @@ static void merge_blocks(ir_node *node, void *ctx)
promote it directly below. Nevertheless, we sometimes reach a block
the first time through a dataflow node. In this case we optimized the
block as such and have to promote the Bad here. */
assert((get_opt_control_flow_straightening() ||
get_opt_control_flow_weak_simplification()) &&
("strange flag setting"));
exchange(b, new_block);
env->changed = 1;
b = new_block;
......@@ -327,12 +324,6 @@ static int test_whether_dispensable(ir_node *b, int pos)
return 0;
if (is_Block_removable(pred)) {
if (!get_opt_optimize() || !get_opt_control_flow_strong_simplification()) {
/* Mark block so that is will not be removed: optimization is turned off. */
set_Block_non_removable(pred);
return 1;
}
/* Seems to be empty. At least we detected this in collect_nodes. */
if (get_irn_link(b) == NULL) {
/* There are no Phi nodes ==> all predecessors are dispensable. */
......
......@@ -127,7 +127,7 @@ ir_node *transform_node_Sel(ir_node *node)
if (get_irp_phase_state() == phase_building) return node;
if (!(get_opt_optimize() && get_opt_dyn_meth_dispatch()))
if (!get_opt_dyn_meth_dispatch())
return node;
if (!is_Method_type(get_entity_type(ent)))
......@@ -189,7 +189,7 @@ ir_node *transform_polymorph_Load(ir_node *load)
ir_entity *ent;
ir_type *dyn_tp;
if (!(get_opt_optimize() && get_opt_dyn_meth_dispatch()))
if (!get_opt_dyn_meth_dispatch())
return load;
field_ptr = get_Load_ptr(load);
......
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