summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-16 22:05:17 +0000
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-16 22:05:17 +0000
commitcf7fb72d3b3a94549e5b32d2ef34863c5477d758 (patch)
treeeafbca96b0b0771fa77620d1cff5cfc0a8a8b8be
parent01dd0067b62af36b93ffcd6a9ff9070a64ed1b45 (diff)
downloadgcc-cf7fb72d3b3a94549e5b32d2ef34863c5477d758.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192516 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/calls.c9
-rw-r--r--gcc/config/sh/sh.c9
-rw-r--r--gcc/dse.c10
-rw-r--r--gcc/dwarf2out.c8
-rw-r--r--gcc/rtl.h1
-rw-r--r--gcc/rtlanal.c16
-rw-r--r--gcc/sched-deps.c10
-rw-r--r--gcc/var-tracking.c18
9 files changed, 43 insertions, 49 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 14b817d840c..c2e717ffc0b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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)
diff --git a/gcc/calls.c b/gcc/calls.c
index 2180a622002..d4ef639dc10 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -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));
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index df5b4e519b3..b81c0c35fca 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -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)))
diff --git a/gcc/dse.c b/gcc/dse.c
index eff4a3909c8..318bbc940c0 100644
--- 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)
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 95fc130c3db..fcdb1b11951 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -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
diff --git a/gcc/rtl.h b/gcc/rtl.h
index a38924d2537..eeeb6ba4de0 100644
--- 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);
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index fb7d45cfb96..a19bdfdc0d1 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -466,6 +466,22 @@ rtx_addr_varies_p (const_rtx x, bool for_alias)
return 0;
}
+/* 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;
+}
+
/* Return the value of the integer term in X, if one is apparent;
otherwise return 0.
Only obvious integer terms are detected.
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index 936a1317bb7..b9ffb2d6118 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -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)
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 65116c287e9..25973a9776e 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -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)