Commit 7ea9fcc6 by John David Anglin Committed by Jeff Law

pa.md (return): Revise comment for trivial return.

        * pa.md (return): Revise comment for trivial return.
        (return_internal): Non-trivial return pattern for non-PIC code.
        (return_internal_pic): Non-trivial return pattern for PIC code.
        It uses the PIC register to ensure it is restored after
        function calls.
        (epilogue): Generate appropriate return for PIC and non-PIC code.

Co-Authored-By: Jeff Law <law@redhat.com>

From-SVN: r39345
parent 05d9f8b0
2001-01-29 John David Anglin <dave@hiauly1.hia.nrc.ca>
Jeff Law <law@redhat.com>
* pa.md (return): Revise comment for trivial return.
(return_internal): Non-trivial return pattern for non-PIC code.
(return_internal_pic): Non-trivial return pattern for PIC code.
It uses the PIC register to ensure it is restored after
function calls.
(epilogue): Generate appropriate return for PIC and non-PIC code.
Mon Jan 29 23:53:14 2001 Christopher Faylor <cgf@cygnus.com> Mon Jan 29 23:53:14 2001 Christopher Faylor <cgf@cygnus.com>
* config/i386/cygwin.h: Fix -mno-cygwin search path for link. * config/i386/cygwin.h: Fix -mno-cygwin search path for link.
......
...@@ -5467,7 +5467,7 @@ ...@@ -5467,7 +5467,7 @@
;; Unconditional and other jump instructions. ;; Unconditional and other jump instructions.
;; This can only be used in a leaf function, so we do ;; This can only be used in a leaf function, so we do
;; not need to use the PIC register. ;; not need to use the PIC register when generating PIC code.
(define_insn "return" (define_insn "return"
[(return) [(return)
(use (reg:SI 2)) (use (reg:SI 2))
...@@ -5482,18 +5482,29 @@ ...@@ -5482,18 +5482,29 @@
[(set_attr "type" "branch") [(set_attr "type" "branch")
(set_attr "length" "4")]) (set_attr "length" "4")])
;; Use a different pattern for functions which have non-trivial ;; Emit a different pattern for functions which have non-trivial
;; epilogues so as not to confuse jump and reorg. ;; epilogues so as not to confuse jump and reorg.
;;
;; We use the PIC register to ensure it's restored after a
;; call in PIC mode. This can be non-optimal for non-PIC
;; code but the real world cost should be unmeasurable.
(define_insn "return_internal" (define_insn "return_internal"
[(return) [(return)
(use (match_operand 0 "register_operand" "r"))
(use (reg:SI 2)) (use (reg:SI 2))
(const_int 1)] (const_int 1)]
"true_regnum (operands[0]) == PIC_OFFSET_TABLE_REGNUM" "! flag_pic"
"*
{
if (TARGET_PA_20)
return \"bve%* (%%r2)\";
return \"bv%* %%r0(%%r2)\";
}"
[(set_attr "type" "branch")
(set_attr "length" "4")])
;; Use the PIC register to ensure it's restored after a
;; call in PIC mode.
(define_insn "return_internal_pic"
[(return)
(use (match_operand 0 "register_operand" "r"))
(use (reg:SI 2))]
"flag_pic && true_regnum (operands[0]) == PIC_OFFSET_TABLE_REGNUM"
"* "*
{ {
if (TARGET_PA_20) if (TARGET_PA_20)
...@@ -5531,8 +5542,11 @@ ...@@ -5531,8 +5542,11 @@
rtx x; rtx x;
hppa_expand_epilogue (); hppa_expand_epilogue ();
x = gen_return_internal (gen_rtx_REG (word_mode, if (flag_pic)
PIC_OFFSET_TABLE_REGNUM)); x = gen_return_internal_pic (gen_rtx_REG (word_mode,
PIC_OFFSET_TABLE_REGNUM));
else
x = gen_return_internal ();
emit_jump_insn (x); emit_jump_insn (x);
} }
DONE; DONE;
......
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