From: rsandifo Date: Thu, 28 Aug 2014 06:25:18 +0000 (+0000) Subject: gcc/ X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5407d66281a35f7c26fb724e733feb15d4ab076a;p=thirdparty%2Fgcc.git gcc/ * varasm.c (compute_reloc_for_rtx_1): Take a const_rtx. Remove the pointer to the cumulative reloc value and return the value for this reloc instead. (compute_reloc_for_rtx): Take a const_rtx. Call compute_reloc_for_rtx_1 directly for SYMBOL_REF and LABEL_REF, avoiding any recursion. Use FOR_EACH_SUBRTX rather than for_each_rtx for the CONST case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214667 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 50f5ece8421f..9e350980f113 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2014-08-28 Richard Sandiford + + * varasm.c (compute_reloc_for_rtx_1): Take a const_rtx. Remove the + pointer to the cumulative reloc value and return the value for + this reloc instead. + (compute_reloc_for_rtx): Take a const_rtx. Call + compute_reloc_for_rtx_1 directly for SYMBOL_REF and LABEL_REF, + avoiding any recursion. Use FOR_EACH_SUBRTX rather than + for_each_rtx for the CONST case. + 2014-08-28 Richard Sandiford * varasm.c (mark_constant): Replace this for_each_rtx callback with... diff --git a/gcc/varasm.c b/gcc/varasm.c index 8cc0633252f2..823ca391bb33 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -6487,44 +6487,43 @@ default_unique_section (tree decl, int reloc) set_decl_section_name (decl, string); } -/* Like compute_reloc_for_constant, except for an RTX. The return value - is a mask for which bit 1 indicates a global relocation, and bit 0 - indicates a local relocation. */ +/* Subroutine of compute_reloc_for_rtx for leaf rtxes. */ static int -compute_reloc_for_rtx_1 (rtx *xp, void *data) +compute_reloc_for_rtx_1 (const_rtx x) { - int *preloc = (int *) data; - rtx x = *xp; - switch (GET_CODE (x)) { case SYMBOL_REF: - *preloc |= SYMBOL_REF_LOCAL_P (x) ? 1 : 2; - break; + return SYMBOL_REF_LOCAL_P (x) ? 1 : 2; case LABEL_REF: - *preloc |= 1; - break; + return 1; default: - break; + return 0; } - - return 0; } +/* Like compute_reloc_for_constant, except for an RTX. The return value + is a mask for which bit 1 indicates a global relocation, and bit 0 + indicates a local relocation. */ + static int -compute_reloc_for_rtx (rtx x) +compute_reloc_for_rtx (const_rtx x) { - int reloc; - switch (GET_CODE (x)) { - case CONST: case SYMBOL_REF: case LABEL_REF: - reloc = 0; - for_each_rtx (&x, compute_reloc_for_rtx_1, &reloc); - return reloc; + return compute_reloc_for_rtx_1 (x); + + case CONST: + { + int reloc = 0; + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, x, ALL) + reloc |= compute_reloc_for_rtx_1 (*iter); + return reloc; + } default: return 0;