This is the mail archive of the gcc-patches@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]

fr30 call pattern fixes



A call always has the for (call (mem (addr))).  Some code in GCC is aware
of that convention (resource.c for example).

The fr30 wuld allow expressions like (call (reg)), which lost pretty badly
when resource tried to examine what should have been the (addr) part of
a call expression.  This problem shows up as core dumps when building some
of the c-torture tests.

This patch fixes up the call patterns and their support routines on the
fr30 and kills a handful of c-torture failures.

	* fr30.c (call_operand): Tighten and rework to match rules for
	call RTL expressions.
	* fr30.h (PREDICATE_CODES, case call_operand): Only allow MEMs.
	* fr30.md (call patterns): Improve constraints.
	

Index: fr30.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/config/fr30/fr30.c,v
retrieving revision 1.34
diff -c -3 -p -r1.34 fr30.c
*** fr30.c	2000/01/14 06:48:46	1.34
--- fr30.c	2000/01/14 07:18:11
*************** low_register_operand (operand, mode)
*** 847,857 ****
  int
  call_operand (operand, mode)
       rtx operand;
!      Mmode mode;
  {
!   return nonimmediate_operand (operand, mode)
!     || (GET_CODE (operand) == MEM
! 	&& GET_CODE (XEXP (operand, 0)) == SYMBOL_REF);
  }
  
  /* Returns true iff all the registers in the operands array
--- 847,857 ----
  int
  call_operand (operand, mode)
       rtx operand;
!      Mmode mode ATTRIBUTE_UNUSED;
  {
!   return (GET_CODE (operand) == MEM
! 	  && (GET_CODE (XEXP (operand, 0)) == SYMBOL_REF
! 	      || GET_CODE (XEXP (operand, 0)) == REG));
  }
  
  /* Returns true iff all the registers in the operands array
Index: fr30.h
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/config/fr30/fr30.h,v
retrieving revision 1.37
diff -c -3 -p -r1.37 fr30.h
*** fr30.h	2000/01/05 09:48:04	1.37
--- fr30.h	2000/01/14 07:18:15
*************** extern struct rtx_def * fr30_compare_op1
*** 1746,1752 ****
    { "stack_add_operand",	{ CONST_INT }},		\
    { "high_register_operand",	{ REG }},		\
    { "low_register_operand",	{ REG }},		\
!   { "call_operand",		{ REG, MEM }},		\
    { "fp_displacement_operand",	{ CONST_INT }},		\
    { "sp_displacement_operand",	{ CONST_INT }},		\
    { "add_immediate_operand",	{ REG, CONST_INT }},
--- 1746,1752 ----
    { "stack_add_operand",	{ CONST_INT }},		\
    { "high_register_operand",	{ REG }},		\
    { "low_register_operand",	{ REG }},		\
!   { "call_operand",		{ MEM }},		\
    { "fp_displacement_operand",	{ CONST_INT }},		\
    { "sp_displacement_operand",	{ CONST_INT }},		\
    { "add_immediate_operand",	{ REG, CONST_INT }},
Index: fr30.md
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/config/fr30/fr30.md,v
retrieving revision 1.40
diff -c -3 -p -r1.40 fr30.md
*** fr30.md	1999/11/08 07:47:41	1.40
--- fr30.md	2000/01/14 07:18:16
***************
*** 1233,1239 ****
  ;; registers used as operands.
  
  (define_insn "call"
!   [(call (match_operand 0 "call_operand" "Qrm")
  	 (match_operand 1 ""             "g"))
     (clobber (reg:SI 17))]
    ""
--- 1233,1239 ----
  ;; registers used as operands.
  
  (define_insn "call"
!   [(call (match_operand 0 "call_operand" "Qm")
  	 (match_operand 1 ""             "g"))
     (clobber (reg:SI 17))]
    ""
***************
*** 1250,1256 ****
  
  (define_insn "call_value"
    [(set (match_operand 0 "register_operand"  "=r")
! 	(call (match_operand 1 "call_operand" "Qrm")
  	      (match_operand 2 ""             "g")))
     (clobber (reg:SI 17))]
    ""
--- 1250,1256 ----
  
  (define_insn "call_value"
    [(set (match_operand 0 "register_operand"  "=r")
! 	(call (match_operand 1 "call_operand" "Qm")
  	      (match_operand 2 ""             "g")))
     (clobber (reg:SI 17))]
    ""





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