From 8a5f15326aeefb771a9999c87d963972f47b19b9 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Fri, 18 Nov 2011 14:24:12 +0100 Subject: [PATCH] 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. --- include/libfirm/irflag.h | 13 ------- ir/ir/irflag_t.def | 3 -- ir/ir/iropt.c | 76 +++++++++++++++++++--------------------- 3 files changed, 36 insertions(+), 56 deletions(-) diff --git a/include/libfirm/irflag.h b/include/libfirm/irflag.h index 730c56005..557d42c4a 100644 --- a/include/libfirm/irflag.h +++ b/include/libfirm/irflag.h @@ -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. * diff --git a/ir/ir/irflag_t.def b/ir/ir/irflag_t.def index 2f8ca50fa..2405620ca 100644 --- a/ir/ir/irflag_t.def +++ b/ir/ir/irflag_t.def @@ -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) diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index 2d4a5e978..ec61a829c 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -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); } } } -- 2.20.1