[committed] MSP430: Remove do_no_relax_short_jumps

Message ID 20200721165103.ntmhuwgz4f5bsmi6@jozef-acer-manjaro
State New
Headers show
Series
  • [committed] MSP430: Remove do_no_relax_short_jumps
Related show

Commit Message

Jozef Lawrynowicz July 21, 2020, 4:51 p.m.
do_not_relax_short_jumps is an old cludge from from when the Binutils
linker could not relax BR to JMP and vice-versa when shuffling "either"
sections between upper and lower memory.
This has been fixed since at least Binutils 2.30.

Successfully regtested on trunk for msp430-elf.
Committed as obvious.
From b4ca70a3faa5ebc1f9fb4600583d0986f1bc7133 Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>

Date: Tue, 21 Jul 2020 17:24:04 +0100
Subject: [PATCH] MSP430: Remove do_no_relax_short_jumps

This is an old cludge from from when the Binutils linker could not relax
BR to JMP and vice-versa when shuffling "either" sections between upper
and lower memory. This has been fixed since at least Binutils 2.30.

gcc/ChangeLog:

	* config/msp430/msp430-protos.h (msp430_do_not_relax_short_jumps):
	Remove.
	* config/msp430/msp430.c (msp430_do_not_relax_short_jumps): Likewise.
	* config/msp430/msp430.md (cbranchhi4_real): Remove special case for
	msp430_do_not_relax_short_jumps.
---
 gcc/config/msp430/msp430-protos.h |  1 -
 gcc/config/msp430/msp430.c        | 13 -------------
 gcc/config/msp430/msp430.md       | 31 ++++---------------------------
 3 files changed, 4 insertions(+), 41 deletions(-)

-- 
2.27.0

Patch

diff --git a/gcc/config/msp430/msp430-protos.h b/gcc/config/msp430/msp430-protos.h
index 29ce9babc4a..a13a94cb92c 100644
--- a/gcc/config/msp430/msp430-protos.h
+++ b/gcc/config/msp430/msp430-protos.h
@@ -21,7 +21,6 @@ 
 #ifndef GCC_MSP430_PROTOS_H
 #define GCC_MSP430_PROTOS_H
 
-bool	msp430_do_not_relax_short_jumps (void);
 rtx	msp430_eh_return_stackadj_rtx (void);
 void	msp430_expand_eh_return (rtx);
 void	msp430_expand_epilogue (int);
diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c
index 6bb1714f465..455b4af3dad 100644
--- a/gcc/config/msp430/msp430.c
+++ b/gcc/config/msp430/msp430.c
@@ -2161,19 +2161,6 @@  msp430_file_end (void)
 #endif
 }
 
-bool
-msp430_do_not_relax_short_jumps (void)
-{
-  /* When placing code into "either" low or high memory we do not want the
-     linker to grow the size of sections, which it can do if it is encounters a
-     branch to a label that is too far away.  So we tell the cbranch patterns to
-     avoid using short jumps when there is a chance that the instructions will
-     end up in a low section.  */
-  return
-    msp430_code_region == MSP430_REGION_EITHER
-    || has_attr (ATTR_EITHER, current_function_decl);
-}
-
 enum msp430_builtin
 {
   MSP430_BUILTIN_BIC_SR,
diff --git a/gcc/config/msp430/msp430.md b/gcc/config/msp430/msp430.md
index 99299bd70ef..ed21eb02868 100644
--- a/gcc/config/msp430/msp430.md
+++ b/gcc/config/msp430/msp430.md
@@ -1309,33 +1309,10 @@  (define_insn "cbranchhi4_real"
    (clobber (reg:BI CARRY))
    ]
   ""
-  "*
-    /* This is nasty.  If we are splitting code between low and high memory
-       then we do not want the linker to increase the size of sections by
-       relaxing out of range jump instructions.  (Since relaxation occurs
-       after section placement).  So we have to generate pessimal branches
-       here.  But we only want to do this when really necessary.
-
-       FIXME: Do we need code in the other cbranch patterns ?  */
-    if (msp430_do_not_relax_short_jumps () && get_attr_length (insn) > 6)
-      {
-        return which_alternative == 0 ?
-            \"CMP.W\t%2, %1 { J%r0 1f { BRA #%l3 { 1:\" :
-	    \"CMPX.W\t%2, %1 { J%r0 1f { BRA #%l3 { 1:\";
-      }
-
-    return which_alternative == 0 ?
-         \"CMP.W\t%2, %1 { J%0\t%l3\" :
-	 \"CMPX.W\t%2, %1 { J%0\t%l3\";
-  "
-  [(set (attr "length")
-	(if_then_else
-	  (and (ge (minus (match_dup 3) (pc)) (const_int -510))
-	       (le (minus (match_dup 3) (pc)) (const_int 510)))
-	  (const_int 6)
-	  (const_int 10))
-	)]
-  )
+  "@
+   CMP.W\t%2, %1 { J%0\t%l3
+   CMPX.W\t%2, %1 { J%0\t%l3"
+)
 
 (define_insn "cbranchpsi4_reversed"
   [(set (pc) (if_then_else