]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rtl.h (get_call_rtx_from): New prototype.
authorSteven Bosscher <steven@gcc.gnu.org>
Tue, 16 Oct 2012 22:05:17 +0000 (22:05 +0000)
committerSteven Bosscher <steven@gcc.gnu.org>
Tue, 16 Oct 2012 22:05:17 +0000 (22:05 +0000)
* rtl.h (get_call_rtx_from): New prototype.
* rtlanal.c (get_call_rtx_from): New function.
* calls.c (emit_call_1): Use it.
* dse.c (scan_insn): Likewise
* dwarf2out.c (dwarf2out_var_location): Likewise.
* sched-deps.c (call_may_noreturn_p): Likewise.
* var-tracking.c (prepare_call_arguments): Likewise.
* config/sh/sh.c (sh_adjust_cost): Likewise.

From-SVN: r192516

gcc/ChangeLog
gcc/calls.c
gcc/config/sh/sh.c
gcc/dse.c
gcc/dwarf2out.c
gcc/rtl.h
gcc/rtlanal.c
gcc/sched-deps.c
gcc/var-tracking.c

index 14b817d840c4a4e0b9fb788907277e3ba2a79c27..c2e717ffc0b40ca9d32dca314b54c809149b6d5c 100644 (file)
@@ -1,3 +1,14 @@
+2012-10-16  Steven Bosscher  <steven@gcc.gnu.org>
+
+       * rtl.h (get_call_rtx_from): New prototype.
+       * rtlanal.c (get_call_rtx_from): New function.
+       * calls.c (emit_call_1): Use it.
+       * dse.c (scan_insn): Likewise
+       * dwarf2out.c (dwarf2out_var_location): Likewise.
+       * sched-deps.c (call_may_noreturn_p): Likewise.
+       * var-tracking.c (prepare_call_arguments): Likewise.
+       * config/sh/sh.c (sh_adjust_cost): Likewise.
+
 2012-10-16  Tom de Vries  <tom@codesourcery.com>
 
        * expr.c (move_by_pieces, move_by_pieces_ninsns, can_store_by_pieces)
index 2180a622002516dc9a48549d2eed4470c6a2abde..d4ef639dc10d97a7f537201682d9b33ded9edb5f 100644 (file)
@@ -384,13 +384,8 @@ emit_call_1 (rtx funexp, tree fntree ATTRIBUTE_UNUSED, tree fndecl ATTRIBUTE_UNU
 
   /* Some target create a fresh MEM instead of reusing the one provided
      above.  Set its MEM_EXPR.  */
-  call = PATTERN (call_insn);
-  if (GET_CODE (call) == PARALLEL)
-    call = XVECEXP (call, 0, 0);
-  if (GET_CODE (call) == SET)
-    call = SET_SRC (call);
-  if (GET_CODE (call) == CALL
-      && MEM_P (XEXP (call, 0))
+  call = get_call_rtx_from (call_insn);
+  if (call
       && MEM_EXPR (XEXP (call, 0)) == NULL_TREE
       && MEM_EXPR (funmem) != NULL_TREE)
     set_mem_expr (XEXP (call, 0), MEM_EXPR (funmem));
index df5b4e519b35f2eaa31e38840551cd2c33a57b5f..b81c0c35fca9f488954c58a0c2ad5b4eb6262ba2 100644 (file)
@@ -10811,13 +10811,8 @@ sh_adjust_cost (rtx insn, rtx link ATTRIBUTE_UNUSED, rtx dep_insn, int cost)
         function's address.  */
       if (CALL_P (insn))
        {
-         rtx call = PATTERN (insn);
-
-         if (GET_CODE (call) == PARALLEL)
-           call = XVECEXP (call, 0 ,0);
-         if (GET_CODE (call) == SET)
-           call = SET_SRC (call);
-         if (GET_CODE (call) == CALL && MEM_P (XEXP (call, 0))
+         rtx call = get_call_rtx_from (insn);
+         if (call
                  /* sibcalli_thunk uses a symbol_ref in an unspec.  */
              && (GET_CODE (XEXP (XEXP (call, 0), 0)) == UNSPEC
                  || ! reg_set_p (XEXP (XEXP (call, 0), 0), dep_insn)))
index eff4a3909c899e4a5cc4474a63beaaa37bbd60c2..318bbc940c0ff276f0162f8100d3873ac2b1acbd 100644 (file)
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -2518,14 +2518,8 @@ scan_insn (bb_info_t bb_info, rtx insn)
       const_call = RTL_CONST_CALL_P (insn);
       if (!const_call)
        {
-         rtx call = PATTERN (insn);
-         if (GET_CODE (call) == PARALLEL)
-           call = XVECEXP (call, 0, 0);
-         if (GET_CODE (call) == SET)
-           call = SET_SRC (call);
-         if (GET_CODE (call) == CALL
-             && MEM_P (XEXP (call, 0))
-             && GET_CODE (XEXP (XEXP (call, 0), 0)) == SYMBOL_REF)
+         rtx call = get_call_rtx_from (insn);
+         if (call && GET_CODE (XEXP (XEXP (call, 0), 0)) == SYMBOL_REF)
            {
              rtx symbol = XEXP (XEXP (call, 0), 0);
              if (SYMBOL_REF_DECL (symbol)
index 95fc130c3dbf42bbdbdacc2224a0f4280f379220..fcdb1b119516071308392fa1c040ef8d455b54c4 100644 (file)
@@ -20100,12 +20100,8 @@ dwarf2out_var_location (rtx loc_note)
       if (!CALL_P (prev))
        prev = XVECEXP (PATTERN (prev), 0, 0);
       ca_loc->tail_call_p = SIBLING_CALL_P (prev);
-      x = PATTERN (prev);
-      if (GET_CODE (x) == PARALLEL)
-       x = XVECEXP (x, 0, 0);
-      if (GET_CODE (x) == SET)
-       x = SET_SRC (x);
-      if (GET_CODE (x) == CALL && MEM_P (XEXP (x, 0)))
+      x = get_call_rtx_from (PATTERN (prev));
+      if (x)
        {
          x = XEXP (XEXP (x, 0), 0);
          if (GET_CODE (x) == SYMBOL_REF
index a38924d253782ad20e1ca6fd2268bef98da053e0..eeeb6ba4de0de328f3d497d6ec17c6fced3fcc0d 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1930,6 +1930,7 @@ extern bool nonzero_address_p (const_rtx);
 extern int rtx_unstable_p (const_rtx);
 extern bool rtx_varies_p (const_rtx, bool);
 extern bool rtx_addr_varies_p (const_rtx, bool);
+extern rtx get_call_rtx_from (rtx);
 extern HOST_WIDE_INT get_integer_term (const_rtx);
 extern rtx get_related_value (const_rtx);
 extern bool offset_within_block_p (const_rtx, HOST_WIDE_INT);
index fb7d45cfb9616bd1f4012f10209c16533fd02c46..a19bdfdc0d1ad64680b7aad860af3563f77ac1b6 100644 (file)
@@ -466,6 +466,22 @@ rtx_addr_varies_p (const_rtx x, bool for_alias)
   return 0;
 }
 \f
+/* Return the CALL in X if there is one.  */
+
+rtx
+get_call_rtx_from (rtx x)
+{
+  if (INSN_P (x))
+    x = PATTERN (x);
+  if (GET_CODE (x) == PARALLEL)
+    x = XVECEXP (x, 0, 0);
+  if (GET_CODE (x) == SET)
+    x = SET_SRC (x);
+  if (GET_CODE (x) == CALL && MEM_P (XEXP (x, 0)))
+    return x;
+  return NULL_RTX;
+}
+\f
 /* Return the value of the integer term in X, if one is apparent;
    otherwise return 0.
    Only obvious integer terms are detected.
index 936a1317bb7f5ad53c20ab4afb2b097eae539580..b9ffb2d61189e84c0a7f64bc10448f4bede2a719 100644 (file)
@@ -3425,14 +3425,8 @@ call_may_noreturn_p (rtx insn)
       && !RTL_LOOPING_CONST_OR_PURE_CALL_P (insn))
     return false;
 
-  call = PATTERN (insn);
-  if (GET_CODE (call) == PARALLEL)
-    call = XVECEXP (call, 0, 0);
-  if (GET_CODE (call) == SET)
-    call = SET_SRC (call);
-  if (GET_CODE (call) == CALL
-      && MEM_P (XEXP (call, 0))
-      && GET_CODE (XEXP (XEXP (call, 0), 0)) == SYMBOL_REF)
+  call = get_call_rtx_from (insn);
+  if (call && GET_CODE (XEXP (XEXP (call, 0), 0)) == SYMBOL_REF)
     {
       rtx symbol = XEXP (XEXP (call, 0), 0);
       if (SYMBOL_REF_DECL (symbol)
index 65116c287e92c767fc5aba7cac2cec433fb02ca7..25973a9776e9cce6644fddae8fb00b2bb5945e94 100644 (file)
@@ -5897,9 +5897,8 @@ static rtx call_arguments;
 static void
 prepare_call_arguments (basic_block bb, rtx insn)
 {
-  rtx link, x;
+  rtx link, x, call;
   rtx prev, cur, next;
-  rtx call = PATTERN (insn);
   rtx this_arg = NULL_RTX;
   tree type = NULL_TREE, t, fndecl = NULL_TREE;
   tree obj_type_ref = NULL_TREE;
@@ -5908,11 +5907,8 @@ prepare_call_arguments (basic_block bb, rtx insn)
 
   memset (&args_so_far_v, 0, sizeof (args_so_far_v));
   args_so_far = pack_cumulative_args (&args_so_far_v);
-  if (GET_CODE (call) == PARALLEL)
-    call = XVECEXP (call, 0, 0);
-  if (GET_CODE (call) == SET)
-    call = SET_SRC (call);
-  if (GET_CODE (call) == CALL && MEM_P (XEXP (call, 0)))
+  call = get_call_rtx_from (insn);
+  if (call)
     {
       if (GET_CODE (XEXP (XEXP (call, 0), 0)) == SYMBOL_REF)
        {
@@ -6186,12 +6182,8 @@ prepare_call_arguments (basic_block bb, rtx insn)
     }
   call_arguments = prev;
 
-  x = PATTERN (insn);
-  if (GET_CODE (x) == PARALLEL)
-    x = XVECEXP (x, 0, 0);
-  if (GET_CODE (x) == SET)
-    x = SET_SRC (x);
-  if (GET_CODE (x) == CALL && MEM_P (XEXP (x, 0)))
+  x = get_call_rtx_from (insn);
+  if (x)
     {
       x = XEXP (XEXP (x, 0), 0);
       if (GET_CODE (x) == SYMBOL_REF)