aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorChristian Bruel <christian.bruel@st.com>2010-02-10 11:08:01 +0100
committerChristian Bruel <chrbr@gcc.gnu.org>2010-02-10 11:08:01 +0100
commite938feb4286b063ff749bbda21fa5e433df062dc (patch)
treebdc67fdd49663f68485fbac1ff4f87568ce1f4bb /gcc
parentcbb1ab104083d2fda4b7eee3b8c1a383ff5ced4e (diff)
downloadgcc-e938feb4286b063ff749bbda21fa5e433df062dc.zip
gcc-e938feb4286b063ff749bbda21fa5e433df062dc.tar.gz
gcc-e938feb4286b063ff749bbda21fa5e433df062dc.tar.bz2
sh.c (find_barrier): Don't emit a CP inside the GP setting.
* config/sh/sh.c (find_barrier): Don't emit a CP inside the GP setting. From-SVN: r156648
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/config/sh/sh.c21
2 files changed, 24 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f540be5..b310463 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2010-02-10 Christian Bruel <christian.bruel@st.com>
+
+ * config/sh/sh.c (find_barrier): Don't emit a CP inside the GP setting.
+
2010-02-10 Jakub Jelinek <jakub@redhat.com>
* builtins.c (set_builtin_user_assembler_name): Also handle
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index cec17b8..475995b 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -1,6 +1,7 @@
/* Output routines for GCC for Renesas / SuperH SH.
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ Free Software Foundation, Inc.
Contributed by Steve Chamberlain (sac@cygnus.com).
Improved by Jim Wilson (wilson@cygnus.com).
@@ -4392,6 +4393,7 @@ find_barrier (int num_mova, rtx mova, rtx from)
int si_limit;
int hi_limit;
rtx orig = from;
+ rtx last_got = NULL_RTX;
/* For HImode: range is 510, add 4 because pc counts from address of
second instruction after this one, subtract 2 for the jump instruction
@@ -4482,6 +4484,16 @@ find_barrier (int num_mova, rtx mova, rtx from)
dst = SET_DEST (pat);
mode = GET_MODE (dst);
+ /* GOT pcrelat setting comes in pair of
+ mova .L8,r0
+ mov.l .L8,r12
+ instructions. (plus add r0,r12).
+ Remember if we see one without the other. */
+ if (GET_CODE (src) == UNSPEC && PIC_ADDR_P (XVECEXP (src, 0, 0)))
+ last_got = last_got ? NULL_RTX : from;
+ else if (PIC_ADDR_P (src))
+ last_got = last_got ? NULL_RTX : from;
+
/* We must explicitly check the mode, because sometimes the
front end will generate code to load unsigned constants into
HImode targets without properly sign extending them. */
@@ -4628,6 +4640,13 @@ find_barrier (int num_mova, rtx mova, rtx from)
else
from = PREV_INSN (from);
+ /* Don't emit a constant table int the middle of global pointer setting,
+ since that that would move the addressing base GOT into another table.
+ We need the first mov instruction before the _GLOBAL_OFFSET_TABLE_
+ in the pool anyway, so just move up the whole constant pool. */
+ if (last_got)
+ from = PREV_INSN (last_got);
+
/* Walk back to be just before any jump or label.
Putting it before a label reduces the number of times the branch
around the constant pool table will be hit. Putting it before