* [ARM] RFA: Use new rtl iterators in arm_tls_referenced_p
@ 2014-11-05 11:51 Richard Sandiford
2014-11-07 12:23 ` Richard Earnshaw
0 siblings, 1 reply; 2+ messages in thread
From: Richard Sandiford @ 2014-11-05 11:51 UTC (permalink / raw)
To: gcc-patches
Tested in the same way as the aarch-common.c patch. OK to install?
Thanks,
Richard
gcc/
* config/arm/arm.c: Include rtl-iter.h.
(arm_tls_referenced_p_1): Delete.
(arm_tls_referenced_p): Use FOR_EACH_SUBRTX.
Index: gcc/config/arm/arm.c
===================================================================
--- gcc/config/arm/arm.c 2014-11-02 19:59:27.588237213 +0000
+++ gcc/config/arm/arm.c 2014-11-05 11:48:55.030053470 +0000
@@ -82,6 +82,7 @@
#include "gimple-expr.h"
#include "builtins.h"
#include "tm-constrs.h"
+#include "rtl-iter.h"
/* Forward definitions of types. */
typedef struct minipool_node Mnode;
@@ -8078,25 +8079,6 @@ thumb_legitimize_reload_address (rtx *x_
return NULL;
}
-/* Test for various thread-local symbols. */
-
-/* Helper for arm_tls_referenced_p. */
-
-static int
-arm_tls_operand_p_1 (rtx *x, void *data ATTRIBUTE_UNUSED)
-{
- if (GET_CODE (*x) == SYMBOL_REF)
- return SYMBOL_REF_TLS_MODEL (*x) != 0;
-
- /* Don't recurse into UNSPEC_TLS looking for TLS symbols; these are
- TLS offsets, not real symbol references. */
- if (GET_CODE (*x) == UNSPEC
- && XINT (*x, 1) == UNSPEC_TLS)
- return -1;
-
- return 0;
-}
-
/* Return TRUE if X contains any TLS symbol references. */
bool
@@ -8105,7 +8087,19 @@ arm_tls_referenced_p (rtx x)
if (! TARGET_HAVE_TLS)
return false;
- return for_each_rtx (&x, arm_tls_operand_p_1, NULL);
+ subrtx_iterator::array_type array;
+ FOR_EACH_SUBRTX (iter, array, x, ALL)
+ {
+ const_rtx x = *iter;
+ if (GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (x) != 0)
+ return true;
+
+ /* Don't recurse into UNSPEC_TLS looking for TLS symbols; these are
+ TLS offsets, not real symbol references. */
+ if (GET_CODE (x) == UNSPEC && XINT (x, 1) == UNSPEC_TLS)
+ iter.skip_subrtxes ();
+ }
+ return false;
}
/* Implement TARGET_LEGITIMATE_CONSTANT_P.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [ARM] RFA: Use new rtl iterators in arm_tls_referenced_p
2014-11-05 11:51 [ARM] RFA: Use new rtl iterators in arm_tls_referenced_p Richard Sandiford
@ 2014-11-07 12:23 ` Richard Earnshaw
0 siblings, 0 replies; 2+ messages in thread
From: Richard Earnshaw @ 2014-11-07 12:23 UTC (permalink / raw)
To: gcc-patches, rdsandiford
On 05/11/14 11:51, Richard Sandiford wrote:
> Tested in the same way as the aarch-common.c patch. OK to install?
>
> Thanks,
> Richard
>
>
> gcc/
> * config/arm/arm.c: Include rtl-iter.h.
> (arm_tls_referenced_p_1): Delete.
> (arm_tls_referenced_p): Use FOR_EACH_SUBRTX.
>
OK.
R.
> Index: gcc/config/arm/arm.c
> ===================================================================
> --- gcc/config/arm/arm.c 2014-11-02 19:59:27.588237213 +0000
> +++ gcc/config/arm/arm.c 2014-11-05 11:48:55.030053470 +0000
> @@ -82,6 +82,7 @@
> #include "gimple-expr.h"
> #include "builtins.h"
> #include "tm-constrs.h"
> +#include "rtl-iter.h"
>
> /* Forward definitions of types. */
> typedef struct minipool_node Mnode;
> @@ -8078,25 +8079,6 @@ thumb_legitimize_reload_address (rtx *x_
> return NULL;
> }
>
> -/* Test for various thread-local symbols. */
> -
> -/* Helper for arm_tls_referenced_p. */
> -
> -static int
> -arm_tls_operand_p_1 (rtx *x, void *data ATTRIBUTE_UNUSED)
> -{
> - if (GET_CODE (*x) == SYMBOL_REF)
> - return SYMBOL_REF_TLS_MODEL (*x) != 0;
> -
> - /* Don't recurse into UNSPEC_TLS looking for TLS symbols; these are
> - TLS offsets, not real symbol references. */
> - if (GET_CODE (*x) == UNSPEC
> - && XINT (*x, 1) == UNSPEC_TLS)
> - return -1;
> -
> - return 0;
> -}
> -
> /* Return TRUE if X contains any TLS symbol references. */
>
> bool
> @@ -8105,7 +8087,19 @@ arm_tls_referenced_p (rtx x)
> if (! TARGET_HAVE_TLS)
> return false;
>
> - return for_each_rtx (&x, arm_tls_operand_p_1, NULL);
> + subrtx_iterator::array_type array;
> + FOR_EACH_SUBRTX (iter, array, x, ALL)
> + {
> + const_rtx x = *iter;
> + if (GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (x) != 0)
> + return true;
> +
> + /* Don't recurse into UNSPEC_TLS looking for TLS symbols; these are
> + TLS offsets, not real symbol references. */
> + if (GET_CODE (x) == UNSPEC && XINT (x, 1) == UNSPEC_TLS)
> + iter.skip_subrtxes ();
> + }
> + return false;
> }
>
> /* Implement TARGET_LEGITIMATE_CONSTANT_P.
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-11-07 12:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-05 11:51 [ARM] RFA: Use new rtl iterators in arm_tls_referenced_p Richard Sandiford
2014-11-07 12:23 ` Richard Earnshaw
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).