remove opt_ldst_only_null_ptr_exception
authorMatthias Braun <matze@braunis.de>
Fri, 18 Nov 2011 13:24:12 +0000 (14:24 +0100)
committerMatthias Braun <matze@braunis.de>
Fri, 18 Nov 2011 16:54:49 +0000 (17:54 +0100)
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
ir/ir/irflag_t.def
ir/ir/iropt.c

index 730c560..557d42c 100644 (file)
@@ -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.
  *
index 2f8ca50..2405620 100644 (file)
@@ -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)
 
index 2d4a5e9..ec61a82 100644 (file)
@@ -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);
                        }
                }
        }