aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2003-01-15 17:50:54 -0800
committerRichard Henderson <rth@gcc.gnu.org>2003-01-15 17:50:54 -0800
commit77480b0beabae22664e1f226d3343ef8e0bddbcf (patch)
treee6a48abd87d10b6eaadbe77769e70f1488e793c1 /gcc
parenta013431213f7f27e2866350c9aaea8f12046d81c (diff)
downloadgcc-77480b0beabae22664e1f226d3343ef8e0bddbcf.zip
gcc-77480b0beabae22664e1f226d3343ef8e0bddbcf.tar.gz
gcc-77480b0beabae22664e1f226d3343ef8e0bddbcf.tar.bz2
alpha.c (find_lo_sum_using_gp): Rename from find_lo_sum; also check that GP is being used.
* config/alpha/alpha.c (find_lo_sum_using_gp): Rename from find_lo_sum; also check that GP is being used. (alpha_find_lo_sum_using_gp): New. (alpha_does_function_need_gp): Use get_attr_usegp. * config/alpha/alpha-protos.h: Update. * config/alpha/alpha.md (attr usegp): New. Annotate patterns as needed. From-SVN: r61376
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/config/alpha/alpha-protos.h4
-rw-r--r--gcc/config/alpha/alpha.c25
-rw-r--r--gcc/config/alpha/alpha.md30
4 files changed, 50 insertions, 19 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a98b2b3..3b7e2f6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2003-01-15 Richard Henderson <rth@redhat.com>
+
+ * config/alpha/alpha.c (find_lo_sum_using_gp): Rename from find_lo_sum;
+ also check that GP is being used.
+ (alpha_find_lo_sum_using_gp): New.
+ (alpha_does_function_need_gp): Use get_attr_usegp.
+ * config/alpha/alpha-protos.h: Update.
+ * config/alpha/alpha.md (attr usegp): New. Annotate patterns
+ as needed.
+
2003-01-15 Roger Sayle <roger@eyesopen.com>
* gcse.c (one_cprop_pass): Change function arguments to take both
diff --git a/gcc/config/alpha/alpha-protos.h b/gcc/config/alpha/alpha-protos.h
index e19f7cb..3bd852c 100644
--- a/gcc/config/alpha/alpha-protos.h
+++ b/gcc/config/alpha/alpha-protos.h
@@ -1,5 +1,5 @@
/* Prototypes for alpha.c functions used in the md file & elsewhere.
- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -142,6 +142,8 @@ extern rtx function_arg PARAMS ((CUMULATIVE_ARGS, enum machine_mode,
extern void alpha_start_function PARAMS ((FILE *, const char *, tree));
extern void alpha_end_function PARAMS ((FILE *, const char *, tree));
+extern int alpha_find_lo_sum_using_gp PARAMS ((rtx));
+
#ifdef REAL_VALUE_TYPE
extern int check_float_value PARAMS ((enum machine_mode,
REAL_VALUE_TYPE *, int));
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 1857374..2d38f2c 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -155,7 +155,7 @@ static rtx alpha_expand_builtin
PARAMS ((tree, rtx, rtx, enum machine_mode, int));
static void alpha_sa_mask
PARAMS ((unsigned long *imaskP, unsigned long *fmaskP));
-static int find_lo_sum
+static int find_lo_sum_using_gp
PARAMS ((rtx *, void *));
static int alpha_does_function_need_gp
PARAMS ((void));
@@ -6970,11 +6970,18 @@ const struct attribute_spec vms_attribute_table[] =
#endif
static int
-find_lo_sum (px, data)
+find_lo_sum_using_gp (px, data)
rtx *px;
void *data ATTRIBUTE_UNUSED;
{
- return GET_CODE (*px) == LO_SUM;
+ return GET_CODE (*px) == LO_SUM && XEXP (*px, 0) == pic_offset_table_rtx;
+}
+
+int
+alpha_find_lo_sum_using_gp (insn)
+ rtx insn;
+{
+ return for_each_rtx (&PATTERN (insn), find_lo_sum_using_gp, NULL) > 0;
}
static int
@@ -7003,15 +7010,9 @@ alpha_does_function_need_gp ()
for (; insn; insn = NEXT_INSN (insn))
if (INSN_P (insn)
&& GET_CODE (PATTERN (insn)) != USE
- && GET_CODE (PATTERN (insn)) != CLOBBER)
- {
- enum attr_type type = get_attr_type (insn);
- if (type == TYPE_LDSYM || type == TYPE_JSR)
- return 1;
- if (TARGET_EXPLICIT_RELOCS
- && for_each_rtx (&PATTERN (insn), find_lo_sum, NULL) > 0)
- return 1;
- }
+ && GET_CODE (PATTERN (insn)) != CLOBBER
+ && get_attr_usegp (insn))
+ return 1;
return 0;
}
diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md
index ed93441..c943527 100644
--- a/gcc/config/alpha/alpha.md
+++ b/gcc/config/alpha/alpha.md
@@ -142,6 +142,18 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none"
(define_attr "length" ""
(const_int 4))
+
+;; The USEGP attribute marks instructions that have relocations that use
+;; the GP.
+
+(define_attr "usegp" "no,yes"
+ (cond [(eq_attr "type" "ldsym,jsr")
+ (const_string "yes")
+ (eq_attr "type" "ild,fld,ist,fst")
+ (symbol_ref "alpha_find_lo_sum_using_gp(insn)")
+ ]
+ (const_string "no")))
+
;; Include scheduling descriptions.
@@ -402,7 +414,8 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none"
(plus:DI (match_operand:DI 1 "register_operand" "r")
(high:DI (match_operand:DI 2 "local_symbolic_operand" ""))))]
"TARGET_EXPLICIT_RELOCS"
- "ldah %0,%2(%1)\t\t!gprelhigh")
+ "ldah %0,%2(%1)\t\t!gprelhigh"
+ [(set_attr "usegp" "yes")])
(define_split
[(set (match_operand:DI 0 "register_operand" "")
@@ -5304,7 +5317,8 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none"
return "lda %0,%2(%1)\t\t!gprel";
else
return "lda %0,%2(%1)\t\t!gprellow";
-})
+}
+ [(set_attr "usegp" "yes")])
(define_split
[(set (match_operand:DI 0 "register_operand" "")
@@ -5426,7 +5440,8 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none"
UNSPEC_DTPREL))]
"HAVE_AS_TLS"
"ldq %0,%2(%1)\t\t!gotdtprel"
- [(set_attr "type" "ild")])
+ [(set_attr "type" "ild")
+ (set_attr "usegp" "yes")])
(define_split
[(set (match_operand:DI 0 "register_operand" "")
@@ -5447,7 +5462,8 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none"
UNSPEC_TPREL))]
"HAVE_AS_TLS"
"ldq %0,%2(%1)\t\t!gottprel"
- [(set_attr "type" "ild")])
+ [(set_attr "type" "ild")
+ (set_attr "usegp" "yes")])
(define_split
[(set (match_operand:DI 0 "register_operand" "")
@@ -5478,7 +5494,8 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none"
fmov %R1,%0
ldt %0,%1
stt %R1,%0"
- [(set_attr "type" "ilog,iadd,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst")])
+ [(set_attr "type" "ilog,iadd,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst")
+ (set_attr "usegp" "*,*,*,yes,*,*,*,*,*,*")])
;; The 'U' constraint matches symbolic operands on Unicos/Mk. Those should
;; have been split up by the rules above but we shouldn't reject the
@@ -5525,7 +5542,8 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none"
stt %R1,%0
ftoit %1,%0
itoft %1,%0"
- [(set_attr "type" "ilog,iadd,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst,ftoi,itof")])
+ [(set_attr "type" "ilog,iadd,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst,ftoi,itof")
+ (set_attr "usegp" "*,*,*,yes,*,*,*,*,*,*,*,*")])
(define_insn "*movdi_fix"
[(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,m,*f,*f,Q,r,*f")