From: Chris Schlumberger-Socha Date: Wed, 29 May 2013 12:57:33 +0000 (+0000) Subject: [AArch64] Re-organize aarch64_classify_symbol. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=17f4d4bfc102925666ffdf8b0b1567535e2daf64;p=gcc.git [AArch64] Re-organize aarch64_classify_symbol. This patch re-orgnaizes the implementation of aarch64_classify_symbol in preparation for tiny absolute memory model support. Co-Authored-By: Marcus Shawcroft From-SVN: r199407 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4b9e8460581..6c4997351f0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-05-29 Chris Schlumberger-Socha + Marcus Shawcroft + + * config/aarch64/aarch64.c (aarch64_classify_symbol): Remove comment. + Refactor if/switch. Replace gcc_assert with if. + 2013-05-29 Ganesh Gopalasubramanian * config/i386/i386.c (initial_ix86_tune_features): Enable diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index e580a1bcafc..59e6234291b 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -5016,6 +5016,7 @@ aarch64_classify_tls_symbol (rtx x) /* Return the method that should be used to access SYMBOL_REF or LABEL_REF X in context CONTEXT. */ + enum aarch64_symbol_type aarch64_classify_symbol (rtx x, enum aarch64_symbol_context context ATTRIBUTE_UNUSED) @@ -5038,48 +5039,34 @@ aarch64_classify_symbol (rtx x, } } - gcc_assert (GET_CODE (x) == SYMBOL_REF); - - switch (aarch64_cmodel) + if (GET_CODE (x) == SYMBOL_REF) { - case AARCH64_CMODEL_LARGE: - return SYMBOL_FORCE_TO_MEM; - - case AARCH64_CMODEL_TINY: - case AARCH64_CMODEL_SMALL: - - /* This is needed to get DFmode, TImode constants to be loaded off - the constant pool. Is it necessary to dump TImode values into - the constant pool. We don't handle TImode constant loads properly - yet and hence need to use the constant pool. */ - if (CONSTANT_POOL_ADDRESS_P (x)) - return SYMBOL_FORCE_TO_MEM; - - if (aarch64_tls_symbol_p (x)) - return aarch64_classify_tls_symbol (x); - - if (SYMBOL_REF_WEAK (x)) - return SYMBOL_FORCE_TO_MEM; - - return SYMBOL_SMALL_ABSOLUTE; - - case AARCH64_CMODEL_TINY_PIC: - case AARCH64_CMODEL_SMALL_PIC: - - if (CONSTANT_POOL_ADDRESS_P (x)) + if (aarch64_cmodel == AARCH64_CMODEL_LARGE + || CONSTANT_POOL_ADDRESS_P (x)) return SYMBOL_FORCE_TO_MEM; if (aarch64_tls_symbol_p (x)) return aarch64_classify_tls_symbol (x); - if (!aarch64_symbol_binds_local_p (x)) - return SYMBOL_SMALL_GOT; + switch (aarch64_cmodel) + { + case AARCH64_CMODEL_TINY: + case AARCH64_CMODEL_SMALL: + if (SYMBOL_REF_WEAK (x)) + return SYMBOL_FORCE_TO_MEM; + return SYMBOL_SMALL_ABSOLUTE; - return SYMBOL_SMALL_ABSOLUTE; + case AARCH64_CMODEL_TINY_PIC: + case AARCH64_CMODEL_SMALL_PIC: + if (!aarch64_symbol_binds_local_p (x)) + return SYMBOL_SMALL_GOT; + return SYMBOL_SMALL_ABSOLUTE; - default: - gcc_unreachable (); + default: + gcc_unreachable (); + } } + /* By default push everything into the constant pool. */ return SYMBOL_FORCE_TO_MEM; }