diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2014-10-26 10:40:59 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2014-10-26 10:40:59 +0000 |
commit | 187804d41fded84fdf8dc733e9cd746c20b8f569 (patch) | |
tree | e1f82dd72b9a0631c6fe629622d7c0bb309c5a98 | |
parent | 21ffb9589ebd03e7d6e0b6f2d14bb3c437cc9b6f (diff) | |
download | gcc-187804d41fded84fdf8dc733e9cd746c20b8f569.zip gcc-187804d41fded84fdf8dc733e9cd746c20b8f569.tar.gz gcc-187804d41fded84fdf8dc733e9cd746c20b8f569.tar.bz2 |
mips.c: Include rtl-iter.h.
gcc/
* config/mips/mips.c: Include rtl-iter.h.
(mips_small_data_pattern_1): Take an rtx rather than an rtx pointer.
Take the context as a parameter instead of the containing MEM.
Iterate over all subrtxes.
(mips_small_data_pattern_p): Update call accordingly.
From-SVN: r216707
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/config/mips/mips.c | 42 |
2 files changed, 31 insertions, 19 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d3aecde..10dd26e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,13 @@ 2014-10-26 Richard Sandiford <richard.sandiford@arm.com> + * config/mips/mips.c: Include rtl-iter.h. + (mips_small_data_pattern_1): Take an rtx rather than an rtx pointer. + Take the context as a parameter instead of the containing MEM. + Iterate over all subrtxes. + (mips_small_data_pattern_p): Update call accordingly. + +2014-10-26 Richard Sandiford <richard.sandiford@arm.com> + * config/mep/mep.c (mep_mul_hilo_bypass_1): Delete. (mep_mul_hilo_bypass_p): Use FOR_EACH_SUBRTX. diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 41a3ba4..f0286ce 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -76,6 +76,7 @@ along with GCC; see the file COPYING3. If not see #include "context.h" #include "cgraph.h" #include "builtins.h" +#include "rtl-iter.h" /* True if X is an UNSPEC wrapper around a SYMBOL_REF or LABEL_REF. */ #define UNSPEC_ADDRESS_P(X) \ @@ -3449,29 +3450,32 @@ mips_rewrite_small_data_p (rtx x, enum mips_symbol_context context) && symbol_type == SYMBOL_GP_RELATIVE); } -/* A for_each_rtx callback for mips_small_data_pattern_p. DATA is the - containing MEM, or null if none. */ +/* Return true if OP refers to small data symbols directly, not through + a LO_SUM. CONTEXT is the context in which X appears. */ static int -mips_small_data_pattern_1 (rtx *loc, void *data) +mips_small_data_pattern_1 (rtx x, enum mips_symbol_context context) { - enum mips_symbol_context context; - - /* Ignore things like "g" constraints in asms. We make no particular - guarantee about which symbolic constants are acceptable as asm operands - versus which must be forced into a GPR. */ - if (GET_CODE (*loc) == LO_SUM || GET_CODE (*loc) == ASM_OPERANDS) - return -1; - - if (MEM_P (*loc)) + subrtx_var_iterator::array_type array; + FOR_EACH_SUBRTX_VAR (iter, array, x, ALL) { - if (for_each_rtx (&XEXP (*loc, 0), mips_small_data_pattern_1, *loc)) - return 1; - return -1; - } + rtx x = *iter; - context = data ? SYMBOL_CONTEXT_MEM : SYMBOL_CONTEXT_LEA; - return mips_rewrite_small_data_p (*loc, context); + /* Ignore things like "g" constraints in asms. We make no particular + guarantee about which symbolic constants are acceptable as asm operands + versus which must be forced into a GPR. */ + if (GET_CODE (x) == LO_SUM || GET_CODE (x) == ASM_OPERANDS) + iter.skip_subrtxes (); + else if (MEM_P (x)) + { + if (mips_small_data_pattern_1 (XEXP (x, 0), SYMBOL_CONTEXT_MEM)) + return true; + iter.skip_subrtxes (); + } + else if (mips_rewrite_small_data_p (x, context)) + return true; + } + return false; } /* Return true if OP refers to small data symbols directly, not through @@ -3480,7 +3484,7 @@ mips_small_data_pattern_1 (rtx *loc, void *data) bool mips_small_data_pattern_p (rtx op) { - return for_each_rtx (&op, mips_small_data_pattern_1, NULL); + return mips_small_data_pattern_1 (op, SYMBOL_CONTEXT_LEA); } /* A for_each_rtx callback, used by mips_rewrite_small_data. |