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]
Other format: [Raw text]

MMIX: fix for gcc.c-torture/compile/20011229-1.c committed


The cause for gcc.c-torture/compile/20011229-1.c was of course a
bug in the MMIX port.  In the 'U'-constraint (used only for call
insns), REG_OK_STRICT wasn't considered, indirectly.  This
caused global register allocation to think constraints matched
for a pseudo-register and didn't assign a register class and
things went downward from that.  I think some papering-over this
bug was done in mmix_secondary_reload_class (sorry about that),
so I removed what looked bogus; only special registers should
need reloading through anything else than memory.  No effect on
test results.

Tested on mmix-knuth-mmixware of course.  (Except for the
ATTRIBUTE_UNUSED marks on mmix_secondary_reload_class, I must
confess; though I consider those trivial and without effect on
code, so I just rebuilt cc1.)

	* config/mmix/mmix.md ("*call_real"): Fix typo in comment.
	* config/mmix/mmix.h (EXTRA_CONSTRAINT): Pass MMIX_REG_OK_STRICT
	to mmix_extra_constraint.
	* config/mmix/mmix.c (mmix_secondary_reload_class): Only handle
	non-global register classes.  Mark now unused parameters as such.
	(mmix_extra_constraint, 'U'): Use new parameter strict and call
	calling memory_operand_p or strict_memory_address_p, not
	address_operand.
	* config/mmix/mmix-protos.h (mmix_extra_constraint): Add parameter.

Index: config/mmix/mmix-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mmix/mmix-protos.h,v
retrieving revision 1.4
diff -p -c -r1.4 mmix-protos.h
*** mmix-protos.h	2001/12/20 17:36:36	1.4
--- mmix-protos.h	2001/12/30 16:01:39
*************** extern enum reg_class mmix_secondary_rel
*** 108,114 ****
    PARAMS ((enum reg_class, enum machine_mode, rtx, int));
  extern int mmix_const_ok_for_letter_p PARAMS ((HOST_WIDE_INT, int));
  extern int mmix_const_double_ok_for_letter_p PARAMS ((rtx, int));
! extern int mmix_extra_constraint PARAMS ((rtx, int));
  extern rtx mmix_dynamic_chain_address PARAMS ((rtx));
  extern rtx mmix_return_addr_rtx PARAMS ((int, rtx));
  extern rtx mmix_eh_return_stackadj_rtx PARAMS ((void));
--- 108,114 ----
    PARAMS ((enum reg_class, enum machine_mode, rtx, int));
  extern int mmix_const_ok_for_letter_p PARAMS ((HOST_WIDE_INT, int));
  extern int mmix_const_double_ok_for_letter_p PARAMS ((rtx, int));
! extern int mmix_extra_constraint PARAMS ((rtx, int, int));
  extern rtx mmix_dynamic_chain_address PARAMS ((rtx));
  extern rtx mmix_return_addr_rtx PARAMS ((int, rtx));
  extern rtx mmix_eh_return_stackadj_rtx PARAMS ((void));
Index: config/mmix/mmix.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mmix/mmix.c,v
retrieving revision 1.8
diff -p -c -r1.8 mmix.c
*** mmix.c	2001/12/20 17:36:36	1.8
--- mmix.c	2001/12/30 16:01:43
*************** mmix_preferred_output_reload_class (x, c
*** 269,296 ****
  enum reg_class
  mmix_secondary_reload_class (class, mode, x, in_p)
       enum reg_class class;
!      enum machine_mode mode;
!      rtx x;
!      int in_p;
  {
    if (class == REMAINDER_REG
        || class == HIMULT_REG
        || class == SYSTEM_REGS)
      return GENERAL_REGS;

-   if (mode != DImode || in_p)
-     return NO_REGS;
-
-   /* We have to help reload. */
-   if (mode == DImode && GET_CODE (x) == MEM
-       && ! address_operand (XEXP (x, 0), GET_MODE (x)))
-     return GENERAL_REGS;
-
-   /* FIXME: Optimize this; there are lots of PLUS:es that don't need a
-      reload register.  */
-   if (GET_CODE (x) == PLUS)
-     return GENERAL_REGS;
-
    return NO_REGS;
  }

--- 269,283 ----
  enum reg_class
  mmix_secondary_reload_class (class, mode, x, in_p)
       enum reg_class class;
!      enum machine_mode mode ATTRIBUTE_UNUSED;
!      rtx x ATTRIBUTE_UNUSED;
!      int in_p ATTRIBUTE_UNUSED;
  {
    if (class == REMAINDER_REG
        || class == HIMULT_REG
        || class == SYSTEM_REGS)
      return GENERAL_REGS;

    return NO_REGS;
  }

*************** mmix_const_double_ok_for_letter_p (value
*** 330,343 ****
     CONST_INT:s, but rather often as CONST_DOUBLE:s.  */

  int
! mmix_extra_constraint (x, c)
       rtx x;
       int c;
  {
    HOST_WIDEST_INT value;

    if (c == 'U')
!     return address_operand (x, Pmode);

    if (GET_CODE (x) != CONST_DOUBLE || GET_MODE (x) != VOIDmode)
      return 0;
--- 317,338 ----
     CONST_INT:s, but rather often as CONST_DOUBLE:s.  */

  int
! mmix_extra_constraint (x, c, strict)
       rtx x;
       int c;
+      int strict;
  {
    HOST_WIDEST_INT value;

+   /* When checking for an address, we need to handle strict vs. non-strict
+      register checks.  Don't use address_operand, but instead its
+      equivalent (its callee, which it is just a wrapper for),
+      memory_operand_p and the strict-equivalent strict_memory_address_p.  */
    if (c == 'U')
!     return
!       strict
!       ? strict_memory_address_p (Pmode, x)
!       : memory_address_p (Pmode, x);

    if (GET_CODE (x) != CONST_DOUBLE || GET_MODE (x) != VOIDmode)
      return 0;
Index: config/mmix/mmix.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mmix/mmix.h,v
retrieving revision 1.7
diff -p -c -r1.7 mmix.h
*** mmix.h	2001/12/20 17:36:36	1.7
--- mmix.h	2001/12/30 16:01:44
*************** enum reg_class
*** 589,595 ****
   mmix_const_ok_for_letter_p (VALUE, C)

  #define EXTRA_CONSTRAINT(VALUE, C)	\
!  mmix_extra_constraint (VALUE, C)

  /* Do we need anything serious here?  Yes, any FLOT constant.  */
  #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C)			\
--- 589,595 ----
   mmix_const_ok_for_letter_p (VALUE, C)

  #define EXTRA_CONSTRAINT(VALUE, C)	\
!  mmix_extra_constraint (VALUE, C, MMIX_REG_OK_STRICT)

  /* Do we need anything serious here?  Yes, any FLOT constant.  */
  #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C)			\
Index: config/mmix/mmix.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mmix/mmix.md,v
retrieving revision 1.2
diff -p -c -r1.2 mmix.md
*** mmix.md	2001/11/03 22:49:46	1.2
--- mmix.md	2001/12/30 16:01:45
*************** DIVU %1,%1,%2\;GET %0,:rR\;NEGU %2,0,%0\
*** 1038,1044 ****
  ;; rarely compared to addresses in registers, disparaging the
  ;; first ("p") alternative by adding ? in the first operand
  ;; might do the trick.  We define 'U' as a synonym to 'p', but without the
! ;; caveats (and vary small advantages) of 'p'.
  (define_insn "*call_real"
    [(call (mem:QI
  	  (match_operand:DI 0 "mmix_symbolic_or_address_operand" "s,rU"))
--- 1038,1044 ----
  ;; rarely compared to addresses in registers, disparaging the
  ;; first ("p") alternative by adding ? in the first operand
  ;; might do the trick.  We define 'U' as a synonym to 'p', but without the
! ;; caveats (and very small advantages) of 'p'.
  (define_insn "*call_real"
    [(call (mem:QI
  	  (match_operand:DI 0 "mmix_symbolic_or_address_operand" "s,rU"))

brgds, H-P


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