Committed, MMIX: minor cleanups. Switch to TARGET_CPU_CPP_BUILTINS.

Hans-Peter Nilsson hp@bitrange.com
Mon Jun 10 15:27:00 GMT 2002


Minor cleanup; remove code that was never executed or was
duplicated.  Also switches to TARGET_CPU_CPP_BUILTINS, though
unfortunately it can't be used to detect contradicting machine
options.  I see other ports drop such detection, so I figured oh
well.

	* config/mmix/mmix.h: Improve comments.
	(CPP_SPEC, CPP_PREDEFINES): Don't define.
	(TARGET_CPU_CPP_BUILTINS): Define.
	(CANONICALIZE_COMPARISON): Don't define, replace with comment.
	(PREDICATE_CODES) <"mmix_reg_or_8bit_or_256_operand">: Remove
	unused predicate.
	* config/mmix/mmix.c (MMIX_OUTPUT_REGNO): Add cast to avoid
	compiler warning.
	(mmix_constant_address_p): Remove another
	redundant test before case.
	(mmix_canonicalize_comparison): Remove unused function.
	(mmix_print_operand_address): Don't test and adjust for operand in
	non-canonical format.
	(mmix_reg_or_8bit_or_256_operand): Remove unused predicate.
	(mmix_gen_compare_reg): Don't use CANONICALIZE_COMPARISON.

Index: mmix.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mmix/mmix.c,v
retrieving revision 1.31
diff -p -c -r1.31 mmix.c
*** mmix.c	7 Jun 2002 05:21:47 -0000	1.31
--- mmix.c	10 Jun 2002 11:50:02 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 71,78 ****
     increasing rL and clearing unused (unset) registers with lower numbers.  */
  #define MMIX_OUTPUT_REGNO(N)					\
   (TARGET_ABI_GNU 						\
!   || (N) < MMIX_RETURN_VALUE_REGNUM				\
!   || (N) > MMIX_LAST_STACK_REGISTER_REGNUM			\
    ? (N) : ((N) - MMIX_RETURN_VALUE_REGNUM			\
  	   + cfun->machine->highest_saved_stack_register + 1))

--- 71,78 ----
     increasing rL and clearing unused (unset) registers with lower numbers.  */
  #define MMIX_OUTPUT_REGNO(N)					\
   (TARGET_ABI_GNU 						\
!   || (int) (N) < MMIX_RETURN_VALUE_REGNUM				\
!   || (int) (N) > MMIX_LAST_STACK_REGISTER_REGNUM			\
    ? (N) : ((N) - MMIX_RETURN_VALUE_REGNUM			\
  	   + cfun->machine->highest_saved_stack_register + 1))

*************** mmix_constant_address_p (x)
*** 1454,1463 ****
    /* When using "base addresses", anything constant goes.  */
    int constant_ok = TARGET_BASE_ADDRESSES != 0;

-   if (code == CONSTANT_P_RTX || code == HIGH)
-     /* FIXME: Don't know how to dissect these.  Avoid them for now.  */
-     return constant_ok;
-
    switch (code)
      {
      case LABEL_REF:
--- 1454,1459 ----
*************** mmix_select_cc_mode (op, x, y)
*** 1620,1656 ****
    return CCmode;
  }

- /* CANONICALIZE_COMPARISON.
-    FIXME: Check if the number adjustments trig.  */
-
- void
- mmix_canonicalize_comparison (codep, op0p, op1p)
-      RTX_CODE * codep;
-      rtx * op0p ATTRIBUTE_UNUSED;
-      rtx * op1p;
- {
-   /* Change -1 to zero, if possible.  */
-   if ((*codep == LE || *codep == GT)
-       && GET_CODE (*op1p) == CONST_INT
-       && *op1p == constm1_rtx)
-     {
-       *codep = *codep == LE ? LT : GE;
-       *op1p = const0_rtx;
-     }
-
-   /* Fix up 256 to 255, if possible.  */
-   if ((*codep == LT || *codep == LTU || *codep == GE || *codep == GEU)
-       && GET_CODE (*op1p) == CONST_INT
-       && INTVAL (*op1p) == 256)
-     {
-       /* FIXME: Remove when I know this trigs.  */
-       fatal_insn ("oops, not debugged; fixing up value:", *op1p);
-       *codep = *codep == LT ? LE : *codep == LTU ? LEU : *codep
- 	== GE ? GT : GTU;
-       *op1p = GEN_INT (255);
-     }
- }
-
  /* REVERSIBLE_CC_MODE.  */

  int
--- 1616,1621 ----
*************** mmix_print_operand_address (stream, x)
*** 2360,2373 ****
        rtx x1 = XEXP (x, 0);
        rtx x2 = XEXP (x, 1);

-       /* Try swap the order.  FIXME: Do we need this?  */
-       if (! REG_P (x1))
- 	{
- 	  rtx tem = x1;
- 	  x1 = x2;
- 	  x2 = tem;
- 	}
-
        if (REG_P (x1))
  	{
  	  fprintf (stream, "%s,", reg_names[MMIX_OUTPUT_REGNO (REGNO (x1))]);
--- 2325,2330 ----
*************** mmix_reg_or_8bit_operand (op, mode)
*** 2787,2806 ****
  	&& CONST_OK_FOR_LETTER_P (INTVAL (op), 'I'));
  }

- /* True if this is a register or an int 0..256.  We include 256,
-    because it can be canonicalized into 255 for comparisons, which is
-    currently the only use of this predicate.
-    FIXME:  Check that this happens and does TRT.  */
-
- int
- mmix_reg_or_8bit_or_256_operand (op, mode)
-      rtx op;
-      enum machine_mode mode;
- {
-   return mmix_reg_or_8bit_operand (op, mode)
-     || (GET_CODE (op) == CONST_INT && INTVAL (op) == 256);
- }
-
  /* Returns zero if code and mode is not a valid condition from a
     compare-type insn.  Nonzero if it is.  The parameter op, if non-NULL,
     is the comparison of mode is CC-somethingmode.  */
--- 2744,2749 ----
*************** mmix_gen_compare_reg (code, x, y)
*** 2859,2866 ****
    /* FIXME:  Can we avoid emitting a compare insn here?  */
    if (! REG_P (x) && ! REG_P (y))
      x = force_reg (mode, x);
-
-   CANONICALIZE_COMPARISON (code, x, y);

    /* If it's not quite right yet, put y in a register.  */
    if (! REG_P (y)
--- 2802,2807 ----
Index: mmix.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mmix/mmix.h,v
retrieving revision 1.30
diff -p -c -r1.30 mmix.h
*** mmix.h	4 Jun 2002 07:09:19 -0000	1.30
--- mmix.h	10 Jun 2002 11:50:03 -0000
*************** struct machine_function GTY(())
*** 105,118 ****

  /* Node: Driver */

- /* When both ABI:s work, this is how we tell them apart in code.  The
-    GNU abi is implied the default.  Also implied in TARGET_DEFAULT.  */
- #define CPP_SPEC \
-  "%{mabi=gnu:-D__MMIX_ABI_GNU__\
-     %{mabi=mmixware:\
-       %eoptions -mabi=mmixware and -mabi=gnu are mutually exclusive}}\
-   %{!mabi=gnu:-D__MMIX_ABI_MMIXWARE__}"
-
  /* User symbols are in the same name-space as built-in symbols, but we
     don't need the built-in symbols, so remove those and instead apply
     stricter operand checking.  Don't warn when expanding insns.  */
--- 105,110 ----
*************** extern const char *mmix_cc1_ignored_opti
*** 148,154 ****
  /* Node: Run-time Target */

  /* Define __LONG_MAX__, since we're advised not to change glimits.h.  */
! #define CPP_PREDEFINES "-D__mmix__ -D__MMIX__ -D__LONG_MAX__=9223372036854775807L"

  extern int target_flags;

--- 140,157 ----
  /* Node: Run-time Target */

  /* Define __LONG_MAX__, since we're advised not to change glimits.h.  */
! #define TARGET_CPU_CPP_BUILTINS()				\
!   do								\
!     {								\
!       builtin_define ("__mmix__");				\
!       builtin_define ("__MMIX__");				\
!       builtin_define ("__LONG_MAX__=9223372036854775807L");	\
!       if (TARGET_ABI_GNU)					\
! 	builtin_define ("__MMIX_ABI_GNU__");			\
!       else							\
! 	builtin_define ("__MMIX_ABI_MMIXWARE__");		\
!     }								\
!   while (0)

  extern int target_flags;

*************** extern int target_flags;
*** 167,173 ****
     a constant pool in global registers, code offseting from those
     registers (automatically causing a request for a suitable constant base
     address register) without having to know the specific register or the
!    specific offset.  */
  #define TARGET_MASK_BASE_ADDRESSES 128

  /* FIXME: Get rid of this one.  */
--- 170,178 ----
     a constant pool in global registers, code offseting from those
     registers (automatically causing a request for a suitable constant base
     address register) without having to know the specific register or the
!    specific offset.  The setback is that there's a limited number of
!    registers, and you'll not find out until link time whether you
!    should've compiled with -mno-base-addresses.  */
  #define TARGET_MASK_BASE_ADDRESSES 128

  /* FIXME: Get rid of this one.  */
*************** typedef struct { int regs; int lib; int
*** 855,862 ****
  #define SELECT_CC_MODE(OP, X, Y)		\
   mmix_select_cc_mode (OP, X, Y)

! #define CANONICALIZE_COMPARISON(CODE, OP0, OP1)		\
!  mmix_canonicalize_comparison (&(CODE), &(OP0), &(OP1));

  #define REVERSIBLE_CC_MODE(MODE)		\
   mmix_reversible_cc_mode (MODE)
--- 860,872 ----
  #define SELECT_CC_MODE(OP, X, Y)		\
   mmix_select_cc_mode (OP, X, Y)

! /* A definition of CANONICALIZE_COMPARISON that changed LE and GT
!    comparisons with -1 to LT and GE respectively, and LT, LTU, GE or GEU
!    comparisons with 256 to 255 and LE, LEU, GT and GTU has been
!    ineffective; the code path for performing the changes did not trig for
!    neither the GCC test-suite nor ghostscript-6.52 nor Knuth's mmix.tar.gz
!    itself (core GCC functionality supposedly handling it) with sources
!    from 2002-06-06.  */

  #define REVERSIBLE_CC_MODE(MODE)		\
   mmix_reversible_cc_mode (MODE)
*************** typedef struct { int regs; int lib; int
*** 999,1006 ****


  /* Node: Macros for Initialization */
! /* We're compiling to ELF and linking to MMO; all ELF features that GCC
!    care for are there.  FIXME: Are they?  */

  /* These must be constant strings, since they're used in crtstuff.c.  */
  #define INIT_SECTION_ASM_OP "\t.section .init,\"ax\" ! mmixal-incompatible"
--- 1009,1016 ----


  /* Node: Macros for Initialization */
! /* We're compiling to ELF and linking to MMO; fundamental ELF features
!    that GCC depend on are there.  */

  /* These must be constant strings, since they're used in crtstuff.c.  */
  #define INIT_SECTION_ASM_OP "\t.section .init,\"ax\" ! mmixal-incompatible"
*************** typedef struct { int regs; int lib; int
*** 1126,1133 ****
    {SYMBOL_REF, LABEL_REF, CONST,		\
     SUBREG, REG, PLUS}},				\
   {"mmix_reg_or_constant_operand",		\
-   {CONST_INT, CONST_DOUBLE, SUBREG, REG}},	\
-  {"mmix_reg_or_8bit_or_256_operand",		\
    {CONST_INT, CONST_DOUBLE, SUBREG, REG}},	\
   {"mmix_reg_or_8bit_operand",			\
    {CONST_INT, CONST_DOUBLE, SUBREG, REG}},	\
--- 1136,1141 ----

brgds, H-P



More information about the Gcc-patches mailing list