aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2014-10-26 10:41:36 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2014-10-26 10:41:36 +0000
commitd0cac36fc4a0240ca47d8fd79793f9e5c73790bc (patch)
treeac3b585f69df4f50f78c9ff8d56292bece8645ab /gcc
parent9989ddc8b77cc6512e6fb7830daf832582dc6451 (diff)
downloadgcc-d0cac36fc4a0240ca47d8fd79793f9e5c73790bc.zip
gcc-d0cac36fc4a0240ca47d8fd79793f9e5c73790bc.tar.gz
gcc-d0cac36fc4a0240ca47d8fd79793f9e5c73790bc.tar.bz2
mips.c (r10k_needs_protection_p_call): Take a const_rtx and return a bool.
gcc/ * config/mips/mips.c (r10k_needs_protection_p_call): Take a const_rtx and return a bool. Iterate over all subrtxes here. (r10k_needs_protection_p): Update accordingly. From-SVN: r216712
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/mips/mips.c35
2 files changed, 25 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9bb932d..f753d65 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2014-10-26 Richard Sandiford <richard.sandiford@arm.com>
+ * config/mips/mips.c (r10k_needs_protection_p_call): Take a const_rtx
+ and return a bool. Iterate over all subrtxes here.
+ (r10k_needs_protection_p): Update accordingly.
+
+2014-10-26 Richard Sandiford <richard.sandiford@arm.com>
+
* config/mips/mips.c (r10k_needs_protection_p_1): Take an rtx
rather than an rtx pointer. Change type of insn from "void *"
to its real type. Return bool rather than int. Iterate over
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 5490e975..8a0185c 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -15102,23 +15102,26 @@ r10k_needs_protection_p_store (rtx x, const_rtx pat ATTRIBUTE_UNUSED,
*insn_ptr = NULL;
}
-/* A for_each_rtx callback that iterates over the pattern of a CALL_INSN.
- Return nonzero if the call is not to a declared function. */
+/* X is the pattern of a call instruction. Return true if the call is
+ not to a declared function. */
-static int
-r10k_needs_protection_p_call (rtx *loc, void *data ATTRIBUTE_UNUSED)
+static bool
+r10k_needs_protection_p_call (const_rtx x)
{
- rtx x;
-
- x = *loc;
- if (!MEM_P (x))
- return 0;
-
- x = XEXP (x, 0);
- if (GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_DECL (x))
- return -1;
-
- return 1;
+ subrtx_iterator::array_type array;
+ FOR_EACH_SUBRTX (iter, array, x, NONCONST)
+ {
+ const_rtx mem = *iter;
+ if (MEM_P (mem))
+ {
+ const_rtx addr = XEXP (mem, 0);
+ if (GET_CODE (addr) == SYMBOL_REF && SYMBOL_REF_DECL (addr))
+ iter.skip_subrtxes ();
+ else
+ return true;
+ }
+ }
+ return false;
}
/* Return true if instruction INSN needs to be protected by an R10K
@@ -15128,7 +15131,7 @@ static bool
r10k_needs_protection_p (rtx_insn *insn)
{
if (CALL_P (insn))
- return for_each_rtx (&PATTERN (insn), r10k_needs_protection_p_call, NULL);
+ return r10k_needs_protection_p_call (PATTERN (insn));
if (mips_r10k_cache_barrier == R10K_CACHE_BARRIER_STORE)
{