]> gcc.gnu.org Git - gcc.git/commitdiff
tree-eh.c (do_return_redirection): Set location for jump statement.
authorDehao Chen <dehao@google.com>
Thu, 1 Nov 2012 00:08:51 +0000 (00:08 +0000)
committerDehao Chen <dehao@gcc.gnu.org>
Thu, 1 Nov 2012 00:08:51 +0000 (00:08 +0000)
gcc:
2012-10-31  Dehao Chen  <dehao@google.com>

* tree-eh.c (do_return_redirection): Set location for jump statement.
(do_goto_redirection): Likewise.
(frob_into_branch_around): Likewise.
(lower_try_finally_nofallthru): Likewise.
(lower_try_finally_copy): Likewise.
(lower_try_finally_switch): Likewise.
* expr.c (store_expr): Use current insn location instead of expr
location.
(expand_expr_real): Likewise.
(expand_expr_real_1): Likewise.

gcc/testsuite:
2012-10-31  Dehao Chen  <dehao@google.com>

* g++.dg/debug/dwarf2/block.C: New testcase.

From-SVN: r193053

gcc/ChangeLog
gcc/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/debug/dwarf2/block.C [new file with mode: 0644]
gcc/tree-eh.c

index 21fd7265c6e6940c175f90a3224620f2522c51f1..9db326f627a53b5c0bf8d29abed32d006abf04cc 100644 (file)
@@ -1,3 +1,16 @@
+2012-10-31  Dehao Chen  <dehao@google.com>
+
+       * tree-eh.c (do_return_redirection): Set location for jump statement.
+       (do_goto_redirection): Likewise.
+       (frob_into_branch_around): Likewise.
+       (lower_try_finally_nofallthru): Likewise.
+       (lower_try_finally_copy): Likewise.
+       (lower_try_finally_switch): Likewise.
+       * expr.c (store_expr): Use current insn location instead of expr
+       location.
+       (expand_expr_real): Likewise.
+       (expand_expr_real_1): Likewise.
+
 2012-10-31   Easwaran Raman  <eraman@google.com>
 
        PR target/54938
index db20e9cb635529407b6c83865ca60a375700a2fc..0ad3b578f17529bc0b2f3db3e1b21b20c671a712 100644 (file)
@@ -5024,7 +5024,7 @@ store_expr (tree exp, rtx target, int call_param_p, bool nontemporal)
 {
   rtx temp;
   rtx alt_rtl = NULL_RTX;
-  location_t loc = EXPR_LOCATION (exp);
+  location_t loc = curr_insn_location ();
 
   if (VOID_TYPE_P (TREE_TYPE (exp)))
     {
@@ -7863,31 +7863,7 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode,
       return ret ? ret : const0_rtx;
     }
 
-  /* If this is an expression of some kind and it has an associated line
-     number, then emit the line number before expanding the expression.
-
-     We need to save and restore the file and line information so that
-     errors discovered during expansion are emitted with the right
-     information.  It would be better of the diagnostic routines
-     used the file/line information embedded in the tree nodes rather
-     than globals.  */
-  if (cfun && EXPR_HAS_LOCATION (exp))
-    {
-      location_t saved_location = input_location;
-      location_t saved_curr_loc = curr_insn_location ();
-      input_location = EXPR_LOCATION (exp);
-      set_curr_insn_location (input_location);
-
-      ret = expand_expr_real_1 (exp, target, tmode, modifier, alt_rtl);
-
-      input_location = saved_location;
-      set_curr_insn_location (saved_curr_loc);
-    }
-  else
-    {
-      ret = expand_expr_real_1 (exp, target, tmode, modifier, alt_rtl);
-    }
-
+  ret = expand_expr_real_1 (exp, target, tmode, modifier, alt_rtl);
   return ret;
 }
 
@@ -9244,8 +9220,15 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
        g = SSA_NAME_DEF_STMT (exp);
       if (g)
        {
-         rtx r = expand_expr_real (gimple_assign_rhs_to_tree (g), target,
-                                   tmode, modifier, NULL);
+         rtx r;
+         location_t saved_loc = input_location;
+
+         input_location = gimple_location (g);
+         set_curr_insn_location (input_location);
+         r = expand_expr_real (gimple_assign_rhs_to_tree (g), target,
+                               tmode, modifier, NULL);
+         input_location = saved_loc;
+         set_curr_insn_location (saved_loc);
          if (REG_P (r) && !REG_EXPR (r))
            set_reg_attrs_for_decl_rtl (SSA_NAME_VAR (exp), r);
          return r;
@@ -9475,7 +9458,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
               with non-BLKmode values.  */
            gcc_assert (GET_MODE (ret) != BLKmode);
 
-           val = build_decl (EXPR_LOCATION (exp),
+           val = build_decl (curr_insn_location (),
                              VAR_DECL, NULL, TREE_TYPE (exp));
            DECL_ARTIFICIAL (val) = 1;
            DECL_IGNORED_P (val) = 1;
index 29a9bfbb0c54b2fb0f03f03d9ed317e05ac72cc7..926b1796c44e91257b7ad7591b25351ea3082af8 100644 (file)
@@ -1,3 +1,7 @@
+2012-10-31  Dehao Chen  <dehao@google.com>
+
+       * g++.dg/debug/dwarf2/block.C: New testcase.
+
 2012-10-31  Jan Hubicka  <jh@suse.cz>
 
        * gcc.dg/pr44974.c: Add noinline.
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/block.C b/gcc/testsuite/g++.dg/debug/dwarf2/block.C
new file mode 100644 (file)
index 0000000..176823f
--- /dev/null
@@ -0,0 +1,29 @@
+// Compiler should not generate too many lexical blocks for this function.
+// { dg-do compile { target { i?86-*-* x86_64-*-* } } }
+// { dg-options "-O0 -fno-exceptions -g -dA" }
+
+union UElement {
+    void* pointer;
+    int integer;
+};
+struct UColToken {
+  unsigned source;
+  unsigned char **rulesToParseHdl;
+};
+
+int uhash_hashTokens(const union UElement k)
+{
+  int hash = 0;
+  struct UColToken *key = (struct UColToken *)k.pointer;
+  if (key != 0) {
+    int len = (key->source & 0xFF000000)>>24;
+    int inc = ((len - 32) / 32) + 1;
+    const unsigned char *p = (key->source & 0x00FFFFFF)
+                            + *(key->rulesToParseHdl);
+    const unsigned char *limit = p + len;
+    hash = *p + *limit;
+  }
+  return hash;
+}
+
+// { dg-final { scan-assembler-not "LBB10" } }
index 9042f068835c33e9f759cb1cc17cc9781168113e..960a966014e7c6ead0e5c6ddd640a9b9d721e6bd 100644 (file)
@@ -739,6 +739,7 @@ do_return_redirection (struct goto_queue_node *q, tree finlab, gimple_seq mod)
     gimple_seq_add_seq (&q->repl_stmt, mod);
 
   x = gimple_build_goto (finlab);
+  gimple_set_location (x, q->location);
   gimple_seq_add_stmt (&q->repl_stmt, x);
 }
 
@@ -758,6 +759,7 @@ do_goto_redirection (struct goto_queue_node *q, tree finlab, gimple_seq mod,
     gimple_seq_add_seq (&q->repl_stmt, mod);
 
   x = gimple_build_goto (finlab);
+  gimple_set_location (x, q->location);
   gimple_seq_add_stmt (&q->repl_stmt, x);
 }
 
@@ -857,6 +859,7 @@ frob_into_branch_around (gimple tp, eh_region region, tree over)
       if (!over)
        over = create_artificial_label (loc);
       x = gimple_build_goto (over);
+      gimple_set_location (x, loc);
       gimple_seq_add_stmt (&cleanup, x);
     }
   gimple_seq_add_seq (&eh_seq, cleanup);
@@ -1085,6 +1088,7 @@ lower_try_finally_nofallthru (struct leh_state *state,
          emit_post_landing_pad (&eh_seq, tf->region);
 
          x = gimple_build_goto (lab);
+         gimple_set_location (x, gimple_location (tf->try_finally_expr));
          gimple_seq_add_stmt (&eh_seq, x);
        }
     }
@@ -1223,6 +1227,7 @@ lower_try_finally_copy (struct leh_state *state, struct leh_tf_state *tf)
 
       tmp = lower_try_finally_fallthru_label (tf);
       x = gimple_build_goto (tmp);
+      gimple_set_location (x, tf_loc);
       gimple_seq_add_stmt (&new_stmt, x);
     }
 
@@ -1395,6 +1400,7 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf)
 
       tmp = lower_try_finally_fallthru_label (tf);
       x = gimple_build_goto (tmp);
+      gimple_set_location (x, tf_loc);
       gimple_seq_add_stmt (&switch_body, x);
     }
 
@@ -1423,6 +1429,7 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf)
       gimple_seq_add_stmt (&eh_seq, x);
 
       x = gimple_build_goto (finally_label);
+      gimple_set_location (x, tf_loc);
       gimple_seq_add_stmt (&eh_seq, x);
 
       tmp = build_int_cst (integer_type_node, eh_index);
This page took 0.128574 seconds and 5 git commands to generate.