From 42aaaed52bca48e1f4382c0dc1c64f7f7e75da75 Mon Sep 17 00:00:00 2001 From: rsandifo Date: Sun, 2 Nov 2014 20:00:12 +0000 Subject: [PATCH] gcc/ * config/arc/arc.c (arc_rewrite_small_data_p): Constify argument. (small_data_pattern_1): Delete. (small_data_pattern): Use FOR_EACH_SUBRTX. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217017 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/config/arc/arc.c | 29 ++++++++++++++--------------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 18b1e107039..438c77b3786 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2014-11-02 Richard Sandiford + * config/arc/arc.c (arc_rewrite_small_data_p): Constify argument. + (small_data_pattern_1): Delete. + (small_data_pattern): Use FOR_EACH_SUBRTX. + +2014-11-02 Richard Sandiford + * config/arc/arc.c: Include rtl-iter.h. (arc_rewrite_small_data_1): Delete. (arc_rewrite_small_data): Use FOR_EACH_SUBRTX_PTR. diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index 1bc903b3a2a..48257f7a0dc 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -6355,7 +6355,7 @@ arc_in_small_data_p (const_tree decl) as a gp+symref. */ static bool -arc_rewrite_small_data_p (rtx x) +arc_rewrite_small_data_p (const_rtx x) { if (GET_CODE (x) == CONST) x = XEXP (x, 0); @@ -6405,26 +6405,25 @@ arc_rewrite_small_data (rtx op) return op; } -/* A for_each_rtx callback for small_data_pattern. */ - -static int -small_data_pattern_1 (rtx *loc, void *data ATTRIBUTE_UNUSED) -{ - if (GET_CODE (*loc) == PLUS - && rtx_equal_p (XEXP (*loc, 0), pic_offset_table_rtx)) - return -1; - - return arc_rewrite_small_data_p (*loc); -} - /* Return true if OP refers to small data symbols directly, not through a PLUS. */ bool small_data_pattern (rtx op, machine_mode) { - return (GET_CODE (op) != SEQUENCE - && for_each_rtx (&op, small_data_pattern_1, 0)); + if (GET_CODE (op) == SEQUENCE) + return false; + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, op, ALL) + { + const_rtx x = *iter; + if (GET_CODE (x) == PLUS + && rtx_equal_p (XEXP (x, 0), pic_offset_table_rtx)) + iter.skip_subrtxes (); + else if (arc_rewrite_small_data_p (x)) + return true; + } + return false; } /* Return true if OP is an acceptable memory operand for ARCompact -- 2.11.4.GIT