aboutsummaryrefslogtreecommitdiff
path: root/gcc/common
diff options
context:
space:
mode:
authorDimitar Dimitrov <dimitar@dinux.eu>2024-07-14 19:45:09 +0300
committerDimitar Dimitrov <dimitar@dinux.eu>2024-07-31 19:45:05 +0300
commitdcdefe47e18fabc340f9862a27ebd521dfa3d38c (patch)
treebb1da7458a62d22b23e961dc1079e74b42c072f9 /gcc/common
parentf2fac502097f75e4a098a3321f216523b59030be (diff)
downloadgcc-dcdefe47e18fabc340f9862a27ebd521dfa3d38c.zip
gcc-dcdefe47e18fabc340f9862a27ebd521dfa3d38c.tar.gz
gcc-dcdefe47e18fabc340f9862a27ebd521dfa3d38c.tar.bz2
pru: Enable section anchoring by default
Loading an arbitrary constant address in a register is expensive for PRU. So enable section anchoring by default to utilize the unsigned byte constant offset operand of load/store instructions. gcc/ChangeLog: * common/config/pru/pru-common.cc (TARGET_OPTION_OPTIMIZATION_TABLE): New definition. * config/pru/pru.cc (TARGET_MIN_ANCHOR_OFFSET): Set minimal anchor offset. (TARGET_MAX_ANCHOR_OFFSET): Set maximum anchor offset. gcc/testsuite/ChangeLog: * gcc.target/pru/section-anchors-1.c: New test. * gcc.target/pru/section-anchors-2.c: New test. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
Diffstat (limited to 'gcc/common')
-rw-r--r--gcc/common/config/pru/pru-common.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/common/config/pru/pru-common.cc b/gcc/common/config/pru/pru-common.cc
index e8dbf28..cdc3178 100644
--- a/gcc/common/config/pru/pru-common.cc
+++ b/gcc/common/config/pru/pru-common.cc
@@ -33,4 +33,16 @@ along with GCC; see the file COPYING3. If not see
#undef TARGET_EXCEPT_UNWIND_INFO
#define TARGET_EXCEPT_UNWIND_INFO sjlj_except_unwind_info
+#undef TARGET_OPTION_OPTIMIZATION_TABLE
+#define TARGET_OPTION_OPTIMIZATION_TABLE pru_option_optimization_table
+
+/* Set default optimization options. */
+static const struct default_options pru_option_optimization_table[] =
+ {
+ /* Enable section anchors by default at -O1 or higher. */
+ { OPT_LEVELS_1_PLUS, OPT_fsection_anchors, NULL, 1 },
+
+ { OPT_LEVELS_NONE, 0, NULL, 0 }
+ };
+
struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER;