This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: pa.md bugfix


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

This patch fixes the problem and regains the use of the PIC register in
non PIC code.  I didn't try to fix the 64 bit mode problem that you
mentioned.  I presume this applies to r2 as well.

I have now done a complete bootstrap under 10.20 with this patch and
this one <http://gcc.gnu.org/ml/gcc-patches/2001-01/msg01785.html>
which I previously warned as being untested.  I did do several bootstraps
with it when it included EPILOGUE_USES.

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

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

	* pa.md (return): Revise comment.
	(return_internal): Don't use PIC register.
	(return_internal_pic): New pattern.  Use PIC register.
	(epilogue): Generate return_internal or return_internal_pic depending
	on mode.

--- pa.md.save	Wed Jan 24 13:27:15 2001
+++ pa.md	Wed Jan 24 13:42:49 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 for PIC mode.
 (define_insn "return"
   [(return)
    (use (reg:SI 2))
@@ -5482,17 +5482,29 @@
   [(set_attr "type" "branch")
    (set_attr "length" "4")])
 
-;; Use 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.
+;; Use a different return pattern for functions which have
+;; non-trivial epilogues so as not to confuse jump and reorg.
+;; This is for non PIC mode.
 (define_insn "return_internal"
   [(return)
-   (use (match_operand:SI 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")])
+
+;; We use the PIC register to ensure it's restored after a
+;; call in PIC mode.
+(define_insn "return_internal_pic"
+  [(return)
+   (use (match_operand:SI 0 "register_operand" "r"))
+   (use (reg:SI 2))]
   "true_regnum (operands[0]) == PIC_OFFSET_TABLE_REGNUM"
   "*
 {
@@ -5525,14 +5537,17 @@
   /* Try to use the trivial return first.  Else use the full
      epilogue.  */
   if (hppa_can_use_return_insn_p ())
-   emit_jump_insn (gen_return ());
+    emit_jump_insn (gen_return ());
   else
     {
       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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]