Commit 77480b0b by Richard Henderson Committed by Richard Henderson

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
parent a0134312
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> 2003-01-15 Roger Sayle <roger@eyesopen.com>
* gcse.c (one_cprop_pass): Change function arguments to take both * gcse.c (one_cprop_pass): Change function arguments to take both
......
/* Prototypes for alpha.c functions used in the md file & elsewhere. /* 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. This file is part of GNU CC.
...@@ -142,6 +142,8 @@ extern rtx function_arg PARAMS ((CUMULATIVE_ARGS, enum machine_mode, ...@@ -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_start_function PARAMS ((FILE *, const char *, tree));
extern void alpha_end_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 #ifdef REAL_VALUE_TYPE
extern int check_float_value PARAMS ((enum machine_mode, extern int check_float_value PARAMS ((enum machine_mode,
REAL_VALUE_TYPE *, int)); REAL_VALUE_TYPE *, int));
......
...@@ -155,7 +155,7 @@ static rtx alpha_expand_builtin ...@@ -155,7 +155,7 @@ static rtx alpha_expand_builtin
PARAMS ((tree, rtx, rtx, enum machine_mode, int)); PARAMS ((tree, rtx, rtx, enum machine_mode, int));
static void alpha_sa_mask static void alpha_sa_mask
PARAMS ((unsigned long *imaskP, unsigned long *fmaskP)); PARAMS ((unsigned long *imaskP, unsigned long *fmaskP));
static int find_lo_sum static int find_lo_sum_using_gp
PARAMS ((rtx *, void *)); PARAMS ((rtx *, void *));
static int alpha_does_function_need_gp static int alpha_does_function_need_gp
PARAMS ((void)); PARAMS ((void));
...@@ -6970,11 +6970,18 @@ const struct attribute_spec vms_attribute_table[] = ...@@ -6970,11 +6970,18 @@ const struct attribute_spec vms_attribute_table[] =
#endif #endif
static int static int
find_lo_sum (px, data) find_lo_sum_using_gp (px, data)
rtx *px; rtx *px;
void *data ATTRIBUTE_UNUSED; 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 static int
...@@ -7003,15 +7010,9 @@ alpha_does_function_need_gp () ...@@ -7003,15 +7010,9 @@ alpha_does_function_need_gp ()
for (; insn; insn = NEXT_INSN (insn)) for (; insn; insn = NEXT_INSN (insn))
if (INSN_P (insn) if (INSN_P (insn)
&& GET_CODE (PATTERN (insn)) != USE && GET_CODE (PATTERN (insn)) != USE
&& GET_CODE (PATTERN (insn)) != CLOBBER) && GET_CODE (PATTERN (insn)) != CLOBBER
{ && get_attr_usegp (insn))
enum attr_type type = get_attr_type (insn); return 1;
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;
}
return 0; return 0;
} }
......
...@@ -142,6 +142,18 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none" ...@@ -142,6 +142,18 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none"
(define_attr "length" "" (define_attr "length" ""
(const_int 4)) (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. ;; Include scheduling descriptions.
...@@ -402,7 +414,8 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none" ...@@ -402,7 +414,8 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none"
(plus:DI (match_operand:DI 1 "register_operand" "r") (plus:DI (match_operand:DI 1 "register_operand" "r")
(high:DI (match_operand:DI 2 "local_symbolic_operand" ""))))] (high:DI (match_operand:DI 2 "local_symbolic_operand" ""))))]
"TARGET_EXPLICIT_RELOCS" "TARGET_EXPLICIT_RELOCS"
"ldah %0,%2(%1)\t\t!gprelhigh") "ldah %0,%2(%1)\t\t!gprelhigh"
[(set_attr "usegp" "yes")])
(define_split (define_split
[(set (match_operand:DI 0 "register_operand" "") [(set (match_operand:DI 0 "register_operand" "")
...@@ -5304,7 +5317,8 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none" ...@@ -5304,7 +5317,8 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none"
return "lda %0,%2(%1)\t\t!gprel"; return "lda %0,%2(%1)\t\t!gprel";
else else
return "lda %0,%2(%1)\t\t!gprellow"; return "lda %0,%2(%1)\t\t!gprellow";
}) }
[(set_attr "usegp" "yes")])
(define_split (define_split
[(set (match_operand:DI 0 "register_operand" "") [(set (match_operand:DI 0 "register_operand" "")
...@@ -5426,7 +5440,8 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none" ...@@ -5426,7 +5440,8 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none"
UNSPEC_DTPREL))] UNSPEC_DTPREL))]
"HAVE_AS_TLS" "HAVE_AS_TLS"
"ldq %0,%2(%1)\t\t!gotdtprel" "ldq %0,%2(%1)\t\t!gotdtprel"
[(set_attr "type" "ild")]) [(set_attr "type" "ild")
(set_attr "usegp" "yes")])
(define_split (define_split
[(set (match_operand:DI 0 "register_operand" "") [(set (match_operand:DI 0 "register_operand" "")
...@@ -5447,7 +5462,8 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none" ...@@ -5447,7 +5462,8 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none"
UNSPEC_TPREL))] UNSPEC_TPREL))]
"HAVE_AS_TLS" "HAVE_AS_TLS"
"ldq %0,%2(%1)\t\t!gottprel" "ldq %0,%2(%1)\t\t!gottprel"
[(set_attr "type" "ild")]) [(set_attr "type" "ild")
(set_attr "usegp" "yes")])
(define_split (define_split
[(set (match_operand:DI 0 "register_operand" "") [(set (match_operand:DI 0 "register_operand" "")
...@@ -5478,7 +5494,8 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none" ...@@ -5478,7 +5494,8 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none"
fmov %R1,%0 fmov %R1,%0
ldt %0,%1 ldt %0,%1
stt %R1,%0" 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 ;; 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 ;; 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" ...@@ -5525,7 +5542,8 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none"
stt %R1,%0 stt %R1,%0
ftoit %1,%0 ftoit %1,%0
itoft %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" (define_insn "*movdi_fix"
[(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,m,*f,*f,Q,r,*f") [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,m,*f,*f,Q,r,*f")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment