+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>
* config/i386/cygwin.h: Fix -mno-cygwin search path for link.
;; Unconditional and other jump instructions.
;; 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"
[(return)
(use (reg:SI 2))
[(set_attr "type" "branch")
(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.
-;;
-;; 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"
[(return)
- (use (match_operand 0 "register_operand" "r"))
(use (reg:SI 2))
(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)
rtx x;
hppa_expand_epilogue ();
- x = gen_return_internal (gen_rtx_REG (word_mode,
- PIC_OFFSET_TABLE_REGNUM));
+ if (flag_pic)
+ x = gen_return_internal_pic (gen_rtx_REG (word_mode,
+ PIC_OFFSET_TABLE_REGNUM));
+ else
+ x = gen_return_internal ();
emit_jump_insn (x);
}
DONE;