This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
don't set flag_reorder_blocks for Xtensa
- From: Bob Wilson <bwilson at tensilica dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 29 Apr 2005 09:40:01 -0700
- Subject: don't set flag_reorder_blocks for Xtensa
Reordering basic blocks (at least as it is done now) almost always leads to
worse code on Xtensa targets. The range of conditional branch instructions is
smaller than on many other architectures, and GCC is not currently aware of this
limitation. (Branch relaxation is currently done only by the assembler.) This
patch avoids enabling this optimization by default for Xtensa. Committed on the
mainline.
2005-04-29 Bob Wilson <bob.wilson@acm.org>
* config/xtensa/xtensa.h (OPTIMIZATION_OPTIONS): Define to disable
flag_reorder_blocks.
Index: config/xtensa/xtensa.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/xtensa/xtensa.h,v
retrieving revision 1.66
diff -u -p -r1.66 xtensa.h
--- config/xtensa/xtensa.h 29 Apr 2005 07:04:49 -0000 1.66
+++ config/xtensa/xtensa.h 29 Apr 2005 16:26:27 -0000
@@ -65,6 +65,19 @@ extern unsigned xtensa_current_frame_siz
(XCHAL_HAVE_L32R ? 0 : MASK_CONST16))
#define OVERRIDE_OPTIONS override_options ()
+
+/* Reordering blocks for Xtensa is not a good idea unless the compiler
+ understands the range of conditional branches. Currently all branch
+ relaxation for Xtensa is handled in the assembler, so GCC cannot do a
+ good job of reordering blocks. Do not enable reordering unless it is
+ explicitly requested. */
+#define OPTIMIZATION_OPTIONS(LEVEL, SIZE) \
+ do \
+ { \
+ flag_reorder_blocks = 0; \
+ } \
+ while (0)
+
/* Target CPU builtins. */
#define TARGET_CPU_CPP_BUILTINS() \