AIX indirect call register allocation

David Edelsohn dje@watson.ibm.com
Tue Jan 19 14:42:00 GMT 1999


	The following patch works around the register allocation problem
for address operands.

	* rs6000.c (offsettable_addr_operand): Delete.
	(offsettable_mem_operand): New function.
	* rs6000.h (PREDICATE_CODES): Reflect function change.
	(RS6000_SAVE_TOC): Represent address as MEM.
	* win-nt.h (RS6000_SAVE_TOC): Same.
	* rs6000.md (indirect calls): Change offsettable address parameter
	to offsettable memory parameter.

Index: rs6000.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.56
diff -c -p -r1.56 rs6000.c
*** rs6000.c	1999/01/15 22:40:35	1.56
--- rs6000.c	1999/01/18 20:15:14
*************** volatile_mem_operand (op, mode)
*** 823,837 ****
    return memory_address_p (mode, XEXP (op, 0));
  }
  
! /* Return 1 if the operand is an offsettable memory address.  */
  
  int
! offsettable_addr_operand (op, mode)
       register rtx op;
       enum machine_mode mode;
  {
!   return offsettable_address_p (reload_completed | reload_in_progress,
! 				mode, op);
  }
  
  /* Return 1 if the operand is either an easy FP constant (see above) or
--- 823,838 ----
    return memory_address_p (mode, XEXP (op, 0));
  }
  
! /* Return 1 if the operand is an offsettable memory operand.  */
  
  int
! offsettable_mem_operand (op, mode)
       register rtx op;
       enum machine_mode mode;
  {
!   return ((GET_CODE (op) == MEM)
! 	  && offsettable_address_p (reload_completed | reload_in_progress,
! 				    mode, XEXP (op, 0)));
  }
  
  /* Return 1 if the operand is either an easy FP constant (see above) or
Index: rs6000.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/rs6000/rs6000.h,v
retrieving revision 1.37
diff -c -p -r1.37 rs6000.h
*** rs6000.h	1999/01/15 22:40:37	1.37
--- rs6000.h	1999/01/18 20:15:15
*************** typedef struct rs6000_stack {
*** 1233,1239 ****
  #define RS6000_SAVE_AREA (TARGET_32BIT ? 24 : 48)
  
  /* Address to save the TOC register */
! #define RS6000_SAVE_TOC plus_constant (stack_pointer_rtx, (TARGET_32BIT ? 20 : 40))
  
  /* Offset & size for fpmem stack locations used for converting between
     float and integral types.  */
--- 1233,1241 ----
  #define RS6000_SAVE_AREA (TARGET_32BIT ? 24 : 48)
  
  /* Address to save the TOC register */
! #define RS6000_SAVE_TOC gen_rtx_MEM (Pmode, \
! 				     plus_constant (stack_pointer_rtx, \
! 						    (TARGET_32BIT ? 20 : 40)))
  
  /* Offset & size for fpmem stack locations used for converting between
     float and integral types.  */
*************** do {									\
*** 3184,3190 ****
    {"reg_or_mem_operand", {SUBREG, MEM, REG}},			\
    {"lwa_operand", {SUBREG, MEM, REG}},				\
    {"volatile_mem_operand", {MEM}},				\
!   {"offsettable_addr_operand", {REG, SUBREG, PLUS}},		\
    {"mem_or_easy_const_operand", {SUBREG, MEM, CONST_DOUBLE}},	\
    {"add_operand", {SUBREG, REG, CONST_INT}},			\
    {"non_add_cint_operand", {CONST_INT}},			\
--- 3186,3192 ----
    {"reg_or_mem_operand", {SUBREG, MEM, REG}},			\
    {"lwa_operand", {SUBREG, MEM, REG}},				\
    {"volatile_mem_operand", {MEM}},				\
!   {"offsettable_mem_operand", {MEM}},				\
    {"mem_or_easy_const_operand", {SUBREG, MEM, CONST_DOUBLE}},	\
    {"add_operand", {SUBREG, REG, CONST_INT}},			\
    {"non_add_cint_operand", {CONST_INT}},			\
Index: rs6000.md
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/rs6000/rs6000.md,v
retrieving revision 1.37
diff -c -p -r1.37 rs6000.md
*** rs6000.md	1999/01/15 22:40:34	1.37
--- rs6000.md	1999/01/18 20:15:16
***************
*** 7331,7344 ****
    [(call (mem:SI (match_operand:SI 0 "register_operand" "b"))
  	 (match_operand 1 "const_int_operand" "n"))
     (use (match_operand 2 "const_int_operand" "n"))
!    (use (match_operand 3 "offsettable_addr_operand" "p"))
     (use (match_operand 4 "register_operand" "r"))
     (clobber (match_operand 5 "register_operand" "=r"))
     (clobber (match_scratch:SI 6 "=&r"))
     (clobber (match_scratch:SI 7 "=l"))]
    "DEFAULT_ABI == ABI_AIX
     && (INTVAL (operands[2]) == CALL_NORMAL || (INTVAL (operands[2]) & CALL_LONG) != 0)"
!   "{st|stw} %4,%a3\;{l|lwz} %6,0(%0)\;{l|lwz} %4,4(%0)\;mt%7 %6\;{l|lwz} %5,8(%0)\;{brl|blrl}\;{l|lwz} %4,%a3"
    [(set_attr "type" "load")
     (set_attr "length" "28")])
  
--- 7331,7344 ----
    [(call (mem:SI (match_operand:SI 0 "register_operand" "b"))
  	 (match_operand 1 "const_int_operand" "n"))
     (use (match_operand 2 "const_int_operand" "n"))
!    (use (match_operand 3 "offsettable_mem_operand" "o"))
     (use (match_operand 4 "register_operand" "r"))
     (clobber (match_operand 5 "register_operand" "=r"))
     (clobber (match_scratch:SI 6 "=&r"))
     (clobber (match_scratch:SI 7 "=l"))]
    "DEFAULT_ABI == ABI_AIX
     && (INTVAL (operands[2]) == CALL_NORMAL || (INTVAL (operands[2]) & CALL_LONG) != 0)"
!   "{st|stw} %4,%3\;{l|lwz} %6,0(%0)\;{l|lwz} %4,4(%0)\;mt%7 %6\;{l|lwz} %5,8(%0)\;{brl|blrl}\;{l|lwz} %4,%3"
    [(set_attr "type" "load")
     (set_attr "length" "28")])
  
***************
*** 7346,7359 ****
    [(call (mem:SI (match_operand:DI 0 "register_operand" "b"))
  	 (match_operand 1 "const_int_operand" "n"))
     (use (match_operand 2 "const_int_operand" "n"))
!    (use (match_operand 3 "offsettable_addr_operand" "p"))
     (use (match_operand 4 "register_operand" "r"))
     (clobber (match_operand 5 "register_operand" "=r"))
     (clobber (match_scratch:SI 6 "=&r"))
     (clobber (match_scratch:SI 7 "=l"))]
    "TARGET_64BIT && DEFAULT_ABI == ABI_AIX
     && (INTVAL (operands[2]) == CALL_NORMAL || (INTVAL (operands[2]) & CALL_LONG) != 0)"
!   "std %4,%a3\;ld %6,0(%0)\;ld %4,8(%0)\;mt%7 %6\;ld %5,16(%0)\;blrl\;ld %4,%a3"
    [(set_attr "type" "load")
     (set_attr "length" "28")])
  
--- 7346,7359 ----
    [(call (mem:SI (match_operand:DI 0 "register_operand" "b"))
  	 (match_operand 1 "const_int_operand" "n"))
     (use (match_operand 2 "const_int_operand" "n"))
!    (use (match_operand 3 "offsettable_mem_operand" "o"))
     (use (match_operand 4 "register_operand" "r"))
     (clobber (match_operand 5 "register_operand" "=r"))
     (clobber (match_scratch:SI 6 "=&r"))
     (clobber (match_scratch:SI 7 "=l"))]
    "TARGET_64BIT && DEFAULT_ABI == ABI_AIX
     && (INTVAL (operands[2]) == CALL_NORMAL || (INTVAL (operands[2]) & CALL_LONG) != 0)"
!   "std %4,%3\;ld %6,0(%0)\;ld %4,8(%0)\;mt%7 %6\;ld %5,16(%0)\;blrl\;ld %4,%3"
    [(set_attr "type" "load")
     (set_attr "length" "28")])
  
***************
*** 7362,7375 ****
  	(call (mem:SI (match_operand:SI 1 "register_operand" "b"))
  	      (match_operand 2 "const_int_operand" "n")))
     (use (match_operand 3 "const_int_operand" "n"))
!    (use (match_operand 4 "offsettable_addr_operand" "p"))
     (use (match_operand 5 "register_operand" "r"))
     (clobber (match_operand 6 "register_operand" "=r"))
     (clobber (match_scratch:SI 7 "=&r"))
     (clobber (match_scratch:SI 8 "=l"))]
    "DEFAULT_ABI == ABI_AIX
     && (INTVAL (operands[3]) == CALL_NORMAL || (INTVAL (operands[3]) & CALL_LONG) != 0)"
!   "{st|stw} %5,%a4\;{l|lwz} %7,0(%1)\;{l|lwz} %5,4(%1)\;mt%8 %7\;{l|lwz} %6,8(%1)\;{brl|blrl}\;{l|lwz} %5,%a4"
    [(set_attr "type" "load")
     (set_attr "length" "28")])
  
--- 7362,7375 ----
  	(call (mem:SI (match_operand:SI 1 "register_operand" "b"))
  	      (match_operand 2 "const_int_operand" "n")))
     (use (match_operand 3 "const_int_operand" "n"))
!    (use (match_operand 4 "offsettable_mem_operand" "o"))
     (use (match_operand 5 "register_operand" "r"))
     (clobber (match_operand 6 "register_operand" "=r"))
     (clobber (match_scratch:SI 7 "=&r"))
     (clobber (match_scratch:SI 8 "=l"))]
    "DEFAULT_ABI == ABI_AIX
     && (INTVAL (operands[3]) == CALL_NORMAL || (INTVAL (operands[3]) & CALL_LONG) != 0)"
!   "{st|stw} %5,%4\;{l|lwz} %7,0(%1)\;{l|lwz} %5,4(%1)\;mt%8 %7\;{l|lwz} %6,8(%1)\;{brl|blrl}\;{l|lwz} %5,%4"
    [(set_attr "type" "load")
     (set_attr "length" "28")])
  
***************
*** 7378,7391 ****
  	(call (mem:SI (match_operand:DI 1 "register_operand" "b"))
  	      (match_operand 2 "const_int_operand" "n")))
     (use (match_operand 3 "const_int_operand" "n"))
!    (use (match_operand 4 "offsettable_addr_operand" "p"))
     (use (match_operand 5 "register_operand" "r"))
     (clobber (match_operand 6 "register_operand" "=r"))
     (clobber (match_scratch:SI 7 "=&r"))
     (clobber (match_scratch:SI 8 "=l"))]
    "TARGET_64BIT && DEFAULT_ABI == ABI_AIX
     && (INTVAL (operands[3]) == CALL_NORMAL || (INTVAL (operands[3]) & CALL_LONG) != 0)"
!   "std %5,%a4\;ld %7,0(%1)\;ld %5,8(%1)\;mt%8 %7\;ld %6,16(%1)\;blrl\;ld %5,%a4"
    [(set_attr "type" "load")
     (set_attr "length" "28")])
  
--- 7378,7391 ----
  	(call (mem:SI (match_operand:DI 1 "register_operand" "b"))
  	      (match_operand 2 "const_int_operand" "n")))
     (use (match_operand 3 "const_int_operand" "n"))
!    (use (match_operand 4 "offsettable_mem_operand" "o"))
     (use (match_operand 5 "register_operand" "r"))
     (clobber (match_operand 6 "register_operand" "=r"))
     (clobber (match_scratch:SI 7 "=&r"))
     (clobber (match_scratch:SI 8 "=l"))]
    "TARGET_64BIT && DEFAULT_ABI == ABI_AIX
     && (INTVAL (operands[3]) == CALL_NORMAL || (INTVAL (operands[3]) & CALL_LONG) != 0)"
!   "std %5,%4\;ld %7,0(%1)\;ld %5,8(%1)\;mt%8 %7\;ld %6,16(%1)\;blrl\;ld %5,%4"
    [(set_attr "type" "load")
     (set_attr "length" "28")])
  
***************
*** 7407,7413 ****
    [(call (mem:SI (match_operand:SI 0 "register_operand" "b"))
  	 (match_operand 1 "const_int_operand" "n"))
     (use (match_operand 2 "const_int_operand" "n"))
!    (use (match_operand 3 "offsettable_addr_operand" "p"))
     (use (match_operand 4 "register_operand" "r"))
     (clobber (match_scratch:SI 5 "=&r"))
     (clobber (match_scratch:SI 6 "=l"))]
--- 7407,7413 ----
    [(call (mem:SI (match_operand:SI 0 "register_operand" "b"))
  	 (match_operand 1 "const_int_operand" "n"))
     (use (match_operand 2 "const_int_operand" "n"))
!    (use (match_operand 3 "offsettable_mem_operand" "o"))
     (use (match_operand 4 "register_operand" "r"))
     (clobber (match_scratch:SI 5 "=&r"))
     (clobber (match_scratch:SI 6 "=l"))]
***************
*** 7422,7428 ****
  	(call (mem:SI (match_operand:SI 1 "register_operand" "b"))
  	      (match_operand 2 "const_int_operand" "n")))
     (use (match_operand 3 "const_int_operand" "n"))
!    (use (match_operand 4 "offsettable_addr_operand" "p"))
     (use (match_operand 5 "register_operand" "r"))
     (clobber (match_scratch:SI 6 "=&r"))
     (clobber (match_scratch:SI 7 "=l"))]
--- 7422,7428 ----
  	(call (mem:SI (match_operand:SI 1 "register_operand" "b"))
  	      (match_operand 2 "const_int_operand" "n")))
     (use (match_operand 3 "const_int_operand" "n"))
!    (use (match_operand 4 "offsettable_mem_operand" "o"))
     (use (match_operand 5 "register_operand" "r"))
     (clobber (match_scratch:SI 6 "=&r"))
     (clobber (match_scratch:SI 7 "=l"))]



More information about the Gcc-patches mailing list