alpha return patterns

Richard Henderson rth@cygnus.com
Sun Jan 30 12:31:00 GMT 2000


I discovered why alpha wasn't seeing the return out of the middle of the
function optimization.  It seems that jump would handle (return) but not
(parallel [(use (reg 26)) (return)]).

So I've tweeked the backend to mark reg 26 live via EPILOGUE_USES instead
of directly in the rtl.


r~


        * alpha.c (alpha_expand_epilogue): Don't emit the return insn.
        * alpha.h (EPILOGUE_USES): New.  Mark $26 live.
        * alpha.md (return): Turn into an expander.
        (return_internal): Don't use $26.
        (epilogue): Emit the return insn.

Index: alpha.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/alpha/alpha.c,v
retrieving revision 1.114
diff -c -p -d -r1.114 alpha.c
*** alpha.c	2000/01/27 10:17:36	1.114
--- alpha.c	2000/01/30 20:19:12
*************** alpha_expand_epilogue ()
*** 4721,4729 ****
  			       gen_rtx_REG (DImode, vms_save_fp_regno)));
          }
      }
- 
-   /* Return.  */
-   emit_jump_insn (gen_return_internal ());
  }
  
  /* Output the rest of the textual info surrounding the epilogue.  */
--- 4721,4726 ----
Index: alpha.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/alpha/alpha.h,v
retrieving revision 1.88
diff -c -p -d -r1.88 alpha.h
*** alpha.h	2000/01/24 20:10:02	1.88
--- alpha.h	2000/01/30 20:19:12
*************** struct machine_function
*** 1267,1272 ****
--- 1267,1276 ----
     No definition is equivalent to always zero.  */
  
  #define EXIT_IGNORE_STACK 1
+ 
+ /* Define registers used by the epilogue and return instruction.  */
+ 
+ #define EPILOGUE_USES(REGNO)	((REGNO) == 26)
  
  /* Output assembler code for a block containing the constant parts
     of a trampoline, leaving space for the variable parts.
Index: alpha.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/alpha/alpha.md,v
retrieving revision 1.108
diff -c -p -d -r1.108 alpha.md
*** alpha.md	2000/01/30 20:14:40	1.108
--- alpha.md	2000/01/30 20:19:12
***************
*** 3984,4000 ****
    "br $31,%l0"
    [(set_attr "type" "ibr")])
  
! (define_insn "return"
    [(return)]
    "direct_return ()"
!   "ret $31,($26),1"
!   [(set_attr "type" "ibr")])
  
! ;; Use a different pattern for functions which have non-trivial
! ;; epilogues so as not to confuse jump and reorg.
! (define_insn "return_internal"
!   [(use (reg:DI 26))
!    (return)]
    ""
    "ret $31,($26),1"
    [(set_attr "type" "ibr")])
--- 3984,3996 ----
    "br $31,%l0"
    [(set_attr "type" "ibr")])
  
! (define_expand "return"
    [(return)]
    "direct_return ()"
!   "")
  
! (define_insn "*return_internal"
!   [(return)]
    ""
    "ret $31,($26),1"
    [(set_attr "type" "ibr")])
***************
*** 5431,5439 ****
    "mov %1,%0")
  
  (define_expand "epilogue"
!   [(clobber (const_int 0))]
    ""
!   "alpha_expand_epilogue (); DONE;")
  
  (define_expand "eh_epilogue"
    [(use (match_operand:DI 0 "register_operand" "r"))
--- 5427,5435 ----
    "mov %1,%0")
  
  (define_expand "epilogue"
!   [(return)]
    ""
!   "alpha_expand_epilogue ();")
  
  (define_expand "eh_epilogue"
    [(use (match_operand:DI 0 "register_operand" "r"))


More information about the Gcc-patches mailing list