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]

[MIPS 16/30] Kill gpr_mode


The MIPS port has a variable called gpr_mode that gives the full
mode of a GPR.  This is a hang-over from the PS2 port, where the
GPRs were 128 bits.  On all FSF targets, gpr_mode == word_mode,
and we stopped making the distinction long ago.  Keeping gpr_mode
now seems to promise something that we don't deliver, so this patch
removes it.

Richard


gcc/
	* config/mips/mips.c (gpr_mode): Delete.
	(mips16e_build_save_restore): Use word_mode and UNITS_PER_WORD
	instead of gpr_mode.
	(mips_for_each_saved_reg): Likewise.
	(mips_expand_prologue, mips_expand_epilogue): Likewise.
	(override_options): Don't initialize gpr_mode.
	* config/mips/mips.md (eh_return): Use word_mode instead of gpr_mode.

Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c	2007-10-18 11:07:10.000000000 +0100
+++ gcc/config/mips/mips.c	2007-10-18 11:07:11.000000000 +0100
@@ -532,9 +532,6 @@ enum mips_code_readable_setting mips_cod
 /* If TRUE, we split addresses into their high and low parts in the RTL.  */
 int mips_split_addresses;
 
-/* Mode used for saving/restoring general purpose registers.  */
-static enum machine_mode gpr_mode;
-
 /* Array giving truth value on whether or not a given hard register
    can support a given mode.  */
 char mips_hard_regno_mode_ok[(int)MAX_MACHINE_MODE][FIRST_PSEUDO_REGISTER];
@@ -7510,7 +7507,7 @@ mips16e_build_save_restore (bool restore
   /* Save the arguments.  */
   for (i = 0; i < nargs; i++)
     {
-      offset = top_offset + i * GET_MODE_SIZE (gpr_mode);
+      offset = top_offset + i * UNITS_PER_WORD;
       set = mips16e_save_restore_reg (restore_p, offset, GP_ARG_FIRST + i);
       XVECEXP (pattern, 0, n++) = set;
     }
@@ -7558,7 +7555,7 @@ mips16e_save_restore_pattern_p (rtx patt
   top_offset = adjust > 0 ? adjust : 0;
 
   /* Interpret all other members of the PARALLEL.  */
-  save_offset = top_offset - GET_MODE_SIZE (gpr_mode);
+  save_offset = top_offset - UNITS_PER_WORD;
   mask = 0;
   nargs = 0;
   i = 0;
@@ -7587,7 +7584,7 @@ mips16e_save_restore_pattern_p (rtx patt
 	return false;
 
       /* Check for argument saves.  */
-      if (offset == top_offset + nargs * GET_MODE_SIZE (gpr_mode)
+      if (offset == top_offset + nargs * UNITS_PER_WORD
 	  && REGNO (reg) == GP_ARG_FIRST + nargs)
 	nargs++;
       else if (offset == save_offset)
@@ -7597,7 +7594,7 @@ mips16e_save_restore_pattern_p (rtx patt
 	      return false;
 
 	  mask |= 1 << REGNO (reg);
-	  save_offset -= GET_MODE_SIZE (gpr_mode);
+	  save_offset -= UNITS_PER_WORD;
 	}
       else
 	return false;
@@ -8198,8 +8195,8 @@ mips_for_each_saved_reg (HOST_WIDE_INT s
   for (regno = GP_REG_LAST; regno >= GP_REG_FIRST; regno--)
     if (BITSET_P (cfun->machine->frame.mask, regno - GP_REG_FIRST))
       {
-	mips_save_restore_reg (gpr_mode, regno, offset, fn);
-	offset -= GET_MODE_SIZE (gpr_mode);
+	mips_save_restore_reg (word_mode, regno, offset, fn);
+	offset -= UNITS_PER_WORD;
       }
 
   /* This loop must iterate over the same space as its companion in
@@ -8488,8 +8485,9 @@ mips_expand_prologue (void)
  	  for (regno = GP_REG_FIRST; regno < GP_REG_LAST; regno++)
  	    if (BITSET_P (mask, regno - GP_REG_FIRST))
  	      {
-		offset -= GET_MODE_SIZE (gpr_mode);
-		mips_save_restore_reg (gpr_mode, regno, offset, mips_save_reg);
+		offset -= UNITS_PER_WORD;
+		mips_save_restore_reg (word_mode, regno,
+				       offset, mips_save_reg);
  	      }
  	}
       else
@@ -8693,8 +8691,8 @@ mips_expand_epilogue (int sibcall_p)
       for (regno = GP_REG_FIRST; regno < GP_REG_LAST; regno++)
  	if (BITSET_P (mask, regno - GP_REG_FIRST))
  	  {
- 	    offset -= GET_MODE_SIZE (gpr_mode);
- 	    mips_save_restore_reg (gpr_mode, regno, offset, mips_restore_reg);
+ 	    offset -= UNITS_PER_WORD;
+ 	    mips_save_restore_reg (word_mode, regno, offset, mips_restore_reg);
  	  }
 
       /* Restore the remaining registers and deallocate the final bit
@@ -12201,10 +12199,6 @@ override_options (void)
       mips_hard_regno_mode_ok[(int)mode][regno]
 	= mips_hard_regno_mode_ok_p (regno, mode);
 
-  /* Save GPR registers in word_mode sized hunks.  word_mode hasn't been
-     initialized yet, so we can't use that here.  */
-  gpr_mode = TARGET_64BIT ? DImode : SImode;
-
   /* Function to allocate machine-dependent function status.  */
   init_machine_status = &mips_init_machine_status;
 
Index: gcc/config/mips/mips.md
===================================================================
--- gcc/config/mips/mips.md	2007-10-18 11:07:01.000000000 +0100
+++ gcc/config/mips/mips.md	2007-10-18 11:07:11.000000000 +0100
@@ -5548,10 +5548,8 @@ (define_expand "eh_return"
   [(use (match_operand 0 "general_operand"))]
   ""
 {
-  enum machine_mode gpr_mode = TARGET_64BIT ? DImode : SImode;
-
-  if (GET_MODE (operands[0]) != gpr_mode)
-    operands[0] = convert_to_mode (gpr_mode, operands[0], 0);
+  if (GET_MODE (operands[0]) != word_mode)
+    operands[0] = convert_to_mode (word_mode, operands[0], 0);
   if (TARGET_64BIT)
     emit_insn (gen_eh_set_lr_di (operands[0]));
   else


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