diff options
author | Geoffrey Keating <geoffk@cygnus.com> | 2000-01-04 22:44:54 +0000 |
---|---|---|
committer | Geoffrey Keating <geoffk@cygnus.com> | 2000-01-04 22:44:54 +0000 |
commit | 4735528d569c48d293ac712191f2b59c5d25f40a (patch) | |
tree | ecb0fd6a879bff40abf75bfc017f0f7e88f21de6 | |
parent | ecd08efc522b7ccabb02ca2626b25ab770dafaa1 (diff) |
* rs6000.c: Correct comment, the `minimal' TOCs are actually
one per translation unit, not one per function.
(output_toc): Also do duplicate constant elimination
for per-translation-unit TOCs.
* rs6000.md (nonlocal_goto_receiver): Put it back as before. Add
a comment explaining _exactly_ when this pattern gets used.
(builtin_setjmp_receiver): New pattern for better clarity.
(init_v4_pic): Move it into a section dealing with TOC registers.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/newppc-branch@31219 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/config/rs6000/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 14 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.md | 52 |
3 files changed, 45 insertions, 33 deletions
diff --git a/gcc/config/rs6000/ChangeLog b/gcc/config/rs6000/ChangeLog index d6082d1c3c9..7fb5b0293c4 100644 --- a/gcc/config/rs6000/ChangeLog +++ b/gcc/config/rs6000/ChangeLog @@ -1,3 +1,15 @@ +2000-01-04 Geoff Keating <geoffk@cygnus.com> + + * rs6000.c: Correct comment, the `minimal' TOCs are actually + one per translation unit, not one per function. + (output_toc): Also do duplicate constant elimination + for per-translation-unit TOCs. + + * rs6000.md (nonlocal_goto_receiver): Put it back as before. Add + a comment explaining _exactly_ when this pattern gets used. + (builtin_setjmp_receiver): New pattern for better clarity. + (init_v4_pic): Move it into a section dealing with TOC registers. + 1999-12-30 Geoff Keating <geoffk@cygnus.com> * rs6000.c (toc_hash_table): New variable. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 5dad4241596..96be67e1190 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -1,5 +1,5 @@ /* Subroutines used for code generation on IBM RS/6000. - Copyright (C) 1991, 93-8, 1999 Free Software Foundation, Inc. + Copyright (C) 1991, 93-8, 1999, 2000 Free Software Foundation, Inc. Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) This file is part of GNU CC. @@ -5091,11 +5091,10 @@ output_mi_thunk (file, thunk_fndecl, delta, function) Target Flags Name One table per AIX (none) AIX TOC object file AIX -mfull-toc AIX TOC object file - AIX -mminimal-toc AIX minimal TOC function + AIX -mminimal-toc AIX minimal TOC translation unit SVR4/EABI (none) SVR4 SDATA object file - SVR4/EABI -mtoc AIX minimal TOC function SVR4/EABI -fpic SVR4 pic object file - SVR4/EABI -fPIC SVR4 PIC function + SVR4/EABI -fPIC SVR4 PIC translation unit SVR4/EABI -mrelocatable EABI TOC function Name Reg. Set by entries contains: @@ -5268,11 +5267,12 @@ output_toc (file, x, labelno) if (TARGET_NO_TOC) abort (); - /* When the TOC is shared among the whole file, - don't output duplicate entries. + /* When the linker won't eliminate them, don't output duplicate + TOC entries (this happens on AIX if there is any kind of TOC, + and on SVR4 under -fPIC or -mrelocatable). This won't work if we are not garbage collecting, so we don't do it, sorry. */ - if (! TARGET_ELF && ! TARGET_MINIMAL_TOC && ggc_p) + if (TARGET_TOC && ggc_p) { struct toc_hash_struct *h; hash_table_entry_t * found; diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 4220189a929..db917ecaaf0 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -1,5 +1,5 @@ ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler -;; Copyright (C) 1990, 91-98, 1999 Free Software Foundation, Inc. +;; Copyright (C) 1990, 91-98, 1999, 2000 Free Software Foundation, Inc. ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) ;; This file is part of GNU CC. @@ -8013,27 +8013,38 @@ emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp); DONE; }") + +;; TOC register handling. -;; If we have -mminimal-toc, we need to reload r30 after a nonlocal goto. +;; Code to initialize the PIC register for SVR4 -fpic. -(define_expand "nonlocal_goto_receiver" - [(unspec_volatile [(const_int 0)] 1)] - "(TARGET_TOC && TARGET_MINIMAL_TOC) - || ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && flag_pic == 1)" +(define_insn "init_v4_pic" + [(set (match_operand:SI 0 "register_operand" "=l") + (unspec [(const_int 0)] 7))] + "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS" + "bl _GLOBAL_OFFSET_TABLE_@local-4" + [(set_attr "type" "branch") + (set_attr "length" "4")]) + +;; If the TOC is shared over a translation unit, as in SVR4 -fpic +;; we need to restore the TOC pointer only when jumping over units +;; of translation. + +(define_expand "builtin_setjmp_receiver" + [(use (label_ref (match_operand 0 "" "")))] + "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && flag_pic == 1" " { - if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && flag_pic == 1) - { - rtx temp = gen_reg_rtx (Pmode); - emit_insn (gen_init_v4_pic (temp)); - emit_move_insn (gen_rtx_REG (Pmode, PIC_OFFSET_TABLE_REGNUM), temp); - DONE; - } + rtx temp = gen_reg_rtx (Pmode); + emit_insn (gen_init_v4_pic (temp)); + emit_move_insn (gen_rtx_REG (Pmode, PIC_OFFSET_TABLE_REGNUM), temp); + DONE; }") -;; If we have -mminimal-toc, we need to reload r30 after a nonlocal goto. +;; If the TOC is procedure-specific (as in AIX -mminimal-toc and SVR4 -fPIC), +;; we must restore it with every nonlocal goto. -(define_insn "" +(define_insn "nonlocal_goto_receiver" [(unspec_volatile [(const_int 0)] 1)] "TARGET_TOC && TARGET_MINIMAL_TOC" "* @@ -8611,17 +8622,6 @@ [(unspec_volatile [(const_int 0)] 0)] "" "") - -;; V.4 specific code to initialize the PIC register - -(define_insn "init_v4_pic" - [(set (match_operand:SI 0 "register_operand" "=l") - (unspec [(const_int 0)] 7))] - "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS" - "bl _GLOBAL_OFFSET_TABLE_@local-4" - [(set_attr "type" "branch") - (set_attr "length" "4")]) - ;; Compare insns are next. Note that the RS/6000 has two types of compares, ;; signed & unsigned, and one type of branch. |