Commit 8a5f1532 authored by Matthias Braun's avatar Matthias Braun
Browse files

remove opt_ldst_only_null_ptr_exception

We just define that the only reason a Load/Store node can use the
exception edge is a NULL pointer. Misaligned Load/Store is a problem for
low-level languages which don't use exception edges anyway.
parent 95cfa646
......@@ -105,19 +105,6 @@ FIRM_API void set_opt_global_cse(int value);
FIRM_API void set_opt_suppress_downcast_optimization(int value);
FIRM_API int get_opt_suppress_downcast_optimization(void);
/**
* Enable/Disable Null exception in Load and Store nodes only.
*
* If enabled, only Null pointer exception can occur at Load and
* store nodes. If it can be proved that the address input of these
* nodes is non-null, the exception edge can safely be removed.
* If disabled, other exceptions (like unaligned access, read-only memory,
* etc.) can occur.
*
* This flag is enabled by default.
*/
FIRM_API void set_opt_ldst_only_null_ptr_exceptions(int value);
/**
* Enable/Disable Global Null Pointer Test Elimination.
*
......
......@@ -54,9 +54,6 @@ I_FLAG(global_null_ptr_elimination , 5, ON)
/** Optimize cast nodes. */
E_FLAG(suppress_downcast_optimization , 7, OFF)
/** Load and Store have only Null exceptions. */
I_FLAG(ldst_only_null_ptr_exceptions , 8, ON)
/** Automatically create Sync node during construction. */
I_FLAG(auto_create_sync , 10, OFF)
......
......@@ -4065,27 +4065,25 @@ static ir_node *transform_node_Minus(ir_node *n)
*/
static ir_node *transform_node_Proj_Load(ir_node *proj)
{
if (get_opt_ldst_only_null_ptr_exceptions()) {
if (get_irn_mode(proj) == mode_X) {
ir_node *load = get_Proj_pred(proj);
/* get the Load address */
const ir_node *addr = get_Load_ptr(load);
const ir_node *confirm;
if (value_not_null(addr, &confirm)) {
if (confirm == NULL) {
/* this node may float if it did not depend on a Confirm */
set_irn_pinned(load, op_pin_state_floats);
}
if (get_Proj_proj(proj) == pn_Load_X_except) {
ir_graph *irg = get_irn_irg(proj);
DBG_OPT_EXC_REM(proj);
return new_r_Bad(irg, mode_X);
} else {
ir_node *blk = get_nodes_block(load);
return new_r_Jmp(blk);
}
if (get_irn_mode(proj) == mode_X) {
ir_node *load = get_Proj_pred(proj);
/* get the Load address */
const ir_node *addr = get_Load_ptr(load);
const ir_node *confirm;
if (value_not_null(addr, &confirm)) {
if (confirm == NULL) {
/* this node may float if it did not depend on a Confirm */
set_irn_pinned(load, op_pin_state_floats);
}
if (get_Proj_proj(proj) == pn_Load_X_except) {
ir_graph *irg = get_irn_irg(proj);
DBG_OPT_EXC_REM(proj);
return new_r_Bad(irg, mode_X);
} else {
ir_node *blk = get_nodes_block(load);
return new_r_Jmp(blk);
}
}
}
......@@ -4097,27 +4095,25 @@ static ir_node *transform_node_Proj_Load(ir_node *proj)
*/
static ir_node *transform_node_Proj_Store(ir_node *proj)
{
if (get_opt_ldst_only_null_ptr_exceptions()) {
if (get_irn_mode(proj) == mode_X) {
ir_node *store = get_Proj_pred(proj);
if (get_irn_mode(proj) == mode_X) {
ir_node *store = get_Proj_pred(proj);
/* get the load/store address */
const ir_node *addr = get_Store_ptr(store);
const ir_node *confirm;
/* get the load/store address */
const ir_node *addr = get_Store_ptr(store);
const ir_node *confirm;
if (value_not_null(addr, &confirm)) {
if (confirm == NULL) {
/* this node may float if it did not depend on a Confirm */
set_irn_pinned(store, op_pin_state_floats);
}
if (get_Proj_proj(proj) == pn_Store_X_except) {
ir_graph *irg = get_irn_irg(proj);
DBG_OPT_EXC_REM(proj);
return new_r_Bad(irg, mode_X);
} else {
ir_node *blk = get_nodes_block(store);
return new_r_Jmp(blk);
}
if (value_not_null(addr, &confirm)) {
if (confirm == NULL) {
/* this node may float if it did not depend on a Confirm */
set_irn_pinned(store, op_pin_state_floats);
}
if (get_Proj_proj(proj) == pn_Store_X_except) {
ir_graph *irg = get_irn_irg(proj);
DBG_OPT_EXC_REM(proj);
return new_r_Bad(irg, mode_X);
} else {
ir_node *blk = get_nodes_block(store);
return new_r_Jmp(blk);
}
}
}
......
Supports Markdown
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