pa.md bugfix

Jeffrey A Law law@redhat.com
Mon Jan 22 19:53:00 GMT 2001


	* pa.md (return_internal): Add a USE of the PIC register to ensure
	it is restored after each call.
	(return expander): Corresponding changes.

Index: pa.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/pa/pa.md,v
retrieving revision 1.76
diff -c -3 -p -r1.76 pa.md
*** pa.md	2001/01/17 05:23:21	1.76
--- pa.md	2001/01/23 03:48:04
***************
*** 5466,5471 ****
--- 5466,5473 ----
  
  ;; Unconditional and other jump instructions.
  
+ ;; This can only be used in a leaf function, so we do
+ ;; not need to use the PIC register.
  (define_insn "return"
    [(return)
     (use (reg:SI 2))
***************
*** 5482,5492 ****
  
  ;; Use a different pattern for functions which have non-trivial
  ;; epilogues so as not to confuse jump and reorg.
  (define_insn "return_internal"
    [(return)
     (use (reg:SI 2))
     (const_int 1)]
!   ""
    "*
  {
    if (TARGET_PA_20)
--- 5484,5499 ----
  
  ;; 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.
  (define_insn "return_internal"
    [(return)
+    (use (match_operand:SI 0 "register_operand" "r"))
     (use (reg:SI 2))
     (const_int 1)]
!   "true_regnum (operands[0]) == PIC_OFFSET_TABLE_REGNUM"
    "*
  {
    if (TARGET_PA_20)
***************
*** 5521,5528 ****
     emit_jump_insn (gen_return ());
    else
      {
        hppa_expand_epilogue ();
!       emit_jump_insn (gen_return_internal ());
      }
    DONE;
  }")
--- 5528,5539 ----
     emit_jump_insn (gen_return ());
    else
      {
+       rtx x;
+ 
        hppa_expand_epilogue ();
!       x = gen_return_internal (gen_rtx_REG (word_mode,
! 					    PIC_OFFSET_TABLE_REGNUM));
!       emit_jump_insn (x);
      }
    DONE;
  }")






More information about the Gcc-patches mailing list