aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorClaudiu Zissulescu <claziss@synopsys.com>2017-09-01 13:43:17 +0200
committerClaudiu Zissulescu <claziss@gcc.gnu.org>2017-09-01 13:43:17 +0200
commit7cfbf676bdb8783e2818995ddd436a442b4dae75 (patch)
tree9c1a5c6698bec6a78ba2568a6606ffd5c2ca82e5 /gcc/config
parentd2e05fcbdafc26ab0c2babf2b3065d177f71305b (diff)
downloadgcc-7cfbf676bdb8783e2818995ddd436a442b4dae75.zip
gcc-7cfbf676bdb8783e2818995ddd436a442b4dae75.tar.gz
gcc-7cfbf676bdb8783e2818995ddd436a442b4dae75.tar.bz2
[ARC] Use TARGET_USE_ANCHORS_FOR_SYMBOL_P.
We don't want to use anchors for small data: the GP register acts as an anchor in that case. We also don't want to use them for PC-relative accesses, where the PC acts as an anchor. TLS symbols require special accesses as well, don't use anchors for such symbols. gcc/ 2017-04-28 Claudiu Zissulescu <claziss@synopsys.com> * config/arc/arc.c (arc_use_anchors_for_symbol_p): New function. (TARGET_USE_ANCHORS_FOR_SYMBOL_P): Define. gcc/testsuite 2017-04-28 Claudiu Zissulescu <claziss@synopsys.com> * gcc.target/arc/pr9001184797.c: New test. From-SVN: r251586
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/arc/arc.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index bc73a59..5410d6b 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -10566,6 +10566,30 @@ compact_memory_operand_p (rtx op, machine_mode mode,
return false;
}
+/* Implement TARGET_USE_ANCHORS_FOR_SYMBOL_P. We don't want to use
+ anchors for small data: the GP register acts as an anchor in that
+ case. We also don't want to use them for PC-relative accesses,
+ where the PC acts as an anchor. Prohibit also TLS symbols to use
+ anchors. */
+
+static bool
+arc_use_anchors_for_symbol_p (const_rtx symbol)
+{
+ if (SYMBOL_REF_TLS_MODEL (symbol))
+ return false;
+
+ if (flag_pic)
+ return false;
+
+ if (SYMBOL_REF_SMALL_P (symbol))
+ return false;
+
+ return default_use_anchors_for_symbol_p (symbol);
+}
+
+#undef TARGET_USE_ANCHORS_FOR_SYMBOL_P
+#define TARGET_USE_ANCHORS_FOR_SYMBOL_P arc_use_anchors_for_symbol_p
+
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-arc.h"