pa.md bugfix

John David Anglin dave@hiauly1.hia.nrc.ca
Sat Jan 27 13:46:00 GMT 2001


> > There is a problem with the patch with respect rename registers, although not
> > not the one I thought would occur.  It relates to having the use for r19
> > present in the return for non PIC code.  This causes a failure in
> > verify_local_live_at_start.

Here is a revised patch which should apply correctly with the current
source.  Bootstrapped and checked under hpux 10.20.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2001-01-27  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* 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.

--- pa.md.orig	Sat Jan 27 00:21:51 2001
+++ pa.md	Sat Jan 27 01:09:39 2001
@@ -5467,7 +5467,7 @@
 ;; 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))
@@ -5482,17 +5482,28 @@
   [(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)]
+  ""
+  "*
+{
+  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))]
   "true_regnum (operands[0]) == PIC_OFFSET_TABLE_REGNUM"
   "*
 {
@@ -5531,8 +5542,11 @@
       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;


More information about the Gcc-bugs mailing list