summaryrefslogtreecommitdiff
path: root/gcc/rtlanal.c
diff options
context:
space:
mode:
authorSteven Bosscher <steven@gcc.gnu.org>2012-10-16 22:05:17 +0000
committerSteven Bosscher <steven@gcc.gnu.org>2012-10-16 22:05:17 +0000
commitda4fdf2d3ff45366d9378882ad1646306ceee305 (patch)
treeeafbca96b0b0771fa77620d1cff5cfc0a8a8b8be /gcc/rtlanal.c
parentf841b68397bb8b15ea570a7a86c5414f62cc9774 (diff)
downloadgcc-da4fdf2d3ff45366d9378882ad1646306ceee305.tar.gz
rtl.h (get_call_rtx_from): New prototype.
* 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
Diffstat (limited to 'gcc/rtlanal.c')
-rw-r--r--gcc/rtlanal.c16
1 files changed, 16 insertions, 0 deletions
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.