aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@redhat.com>2002-11-18 14:01:23 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2002-11-18 14:01:23 +0000
commitea4210ef82eac78a2a512b48c888b88c9912c6eb (patch)
treed563874386d683a14642a7464764df24ddb0d0f5 /gcc
parent48f5b6723a0f7dd8e8889c2eb4deea9185863386 (diff)
downloadgcc-ea4210ef82eac78a2a512b48c888b88c9912c6eb.zip
gcc-ea4210ef82eac78a2a512b48c888b88c9912c6eb.tar.gz
gcc-ea4210ef82eac78a2a512b48c888b88c9912c6eb.tar.bz2
sh-protos.h (sh_mark_label): Declare.
* config/sh/sh-protos.h (sh_mark_label): Declare. * config/sh/sh.c (sh_mark_label): New function, taken from movdi_const, but fixing the case when the address has an addend. * config/sh/sh.md (movdi_const, movdi_const_32bit): Use it. From-SVN: r59217
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/sh/sh-protos.h1
-rw-r--r--gcc/config/sh/sh.c22
-rw-r--r--gcc/config/sh/sh.md18
4 files changed, 32 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5a61cca..715b380 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
2002-11-18 Richard Sandiford <rsandifo@redhat.com>
+ * config/sh/sh-protos.h (sh_mark_label): Declare.
+ * config/sh/sh.c (sh_mark_label): New function, taken from
+ movdi_const, but fixing the case when the address has an addend.
+ * config/sh/sh.md (movdi_const, movdi_const_32bit): Use it.
+
+2002-11-18 Richard Sandiford <rsandifo@redhat.com>
+
* config/sh/sh.c (pool_node): New field: part_of_sequence_p.
(add_constant): Set it.
(dump_table): Don't reorder a constant if part_of_sequence_p.
diff --git a/gcc/config/sh/sh-protos.h b/gcc/config/sh/sh-protos.h
index a729462..c87000b 100644
--- a/gcc/config/sh/sh-protos.h
+++ b/gcc/config/sh/sh-protos.h
@@ -128,6 +128,7 @@ extern int sh_cfun_interrupt_handler_p PARAMS ((void));
extern void sh_initialize_trampoline PARAMS ((rtx, rtx, rtx));
extern enum reg_class sh_cannot_change_mode_class
PARAMS ((enum machine_mode, enum machine_mode));
+extern void sh_mark_label PARAMS ((rtx, int));
#ifdef HARD_CONST
extern void fpscr_set_from_mem PARAMS ((int, HARD_REG_SET));
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index a26d92b..7ea35dc 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -7764,4 +7764,26 @@ sh_cannot_change_mode_class (from, to)
return NO_REGS;
}
+
+/* If ADDRESS refers to a CODE_LABEL, add NUSES to the number of times
+ that label is used. */
+
+void
+sh_mark_label (address, nuses)
+ rtx address;
+ int nuses;
+{
+ if (GOTOFF_P (address))
+ {
+ /* Extract the label or symbol. */
+ address = XEXP (address, 0);
+ if (GET_CODE (address) == PLUS)
+ address = XEXP (address, 0);
+ address = XVECEXP (address, 0, 0);
+ }
+ if (GET_CODE (address) == LABEL_REF
+ && GET_CODE (XEXP (address, 0)) == CODE_LABEL)
+ LABEL_NUSES (XEXP (address, 0)) += nuses;
+}
+
#include "gt-sh.h"
diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md
index c945496..d57583b 100644
--- a/gcc/config/sh/sh.md
+++ b/gcc/config/sh/sh.md
@@ -3867,14 +3867,7 @@
&& MOVI_SHORI_BASE_OPERAND_P (operands[1])"
"
{
- if (GET_CODE (operands[1]) == LABEL_REF
- && GET_CODE (XEXP (operands[1], 0)) == CODE_LABEL)
- LABEL_NUSES (XEXP (operands[1], 0)) += 4;
- else if (GOTOFF_P (operands[1])
- && GET_CODE (XVECEXP (XEXP (operands[1], 0), 0, 0)) == LABEL_REF
- && (GET_CODE (XEXP (XVECEXP (XEXP (operands[1], 0), 0, 0), 0))
- == CODE_LABEL))
- LABEL_NUSES (XEXP (XVECEXP (XEXP (operands[1], 0), 0, 0), 0)) += 4;
+ sh_mark_label (operands[1], 4);
}")
(define_expand "movdi_const_32bit"
@@ -3896,14 +3889,7 @@
&& MOVI_SHORI_BASE_OPERAND_P (operands[1])"
"
{
- if (GET_CODE (operands[1]) == LABEL_REF
- && GET_CODE (XEXP (operands[1], 0)) == CODE_LABEL)
- LABEL_NUSES (XEXP (operands[1], 0)) += 2;
- else if (GOTOFF_P (operands[1])
- && GET_CODE (XVECEXP (XEXP (operands[1], 0), 0, 0)) == LABEL_REF
- && (GET_CODE (XEXP (XVECEXP (XEXP (operands[1], 0), 0, 0), 0))
- == CODE_LABEL))
- LABEL_NUSES (XEXP (XVECEXP (XEXP (operands[1], 0), 0, 0), 0)) += 2;
+ sh_mark_label (operands[1], 2);
}")
(define_expand "movdi_const_16bit"