public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* patch to fix mips16 LRA register shuffling
@ 2013-10-31 16:27 Vladimir Makarov
  0 siblings, 0 replies; only message in thread
From: Vladimir Makarov @ 2013-10-31 16:27 UTC (permalink / raw)
  To: gcc-patches; +Cc: Matthew Fortune

[-- Attachment #1: Type: text/plain, Size: 635 bytes --]

  The following patch fixes a problem reported by Matt Fortune.  LRA
generated additional moves for frame pointer eliminated into stack pointer.

  LRA uses register number of the elimination result when matching
constraints.  But it did not substitute RTL operand itself and that
resulted in EXTRA_CONSTRAINT hooks failure and worse code generation.

  The patch was bootstrapped on x86/x86-64 and ppc64 (with LRA).

  Committed as rev. 204267.

2013-10-31  Vladimir Makarov  <vmakarov@redhat.com>

        * lra-constraints (process_alt_operands): Use the result
        elimination register for operand when matching constraints.



[-- Attachment #2: mips16.patch --]
[-- Type: text/x-patch, Size: 1704 bytes --]

Index: lra-constraints.c
===================================================================
--- lra-constraints.c	(revision 204245)
+++ lra-constraints.c	(working copy)
@@ -1466,23 +1466,32 @@
      function.	*/
   for (nop = 0; nop < n_operands; nop++)
     {
+      rtx reg;
+
       op = no_subreg_reg_operand[nop] = *curr_id->operand_loc[nop];
       /* The real hard regno of the operand after the allocation.  */
       hard_regno[nop] = get_hard_regno (op);
 
-      operand_reg[nop] = op;
-      biggest_mode[nop] = GET_MODE (operand_reg[nop]);
-      if (GET_CODE (operand_reg[nop]) == SUBREG)
+      operand_reg[nop] = reg = op;
+      biggest_mode[nop] = GET_MODE (op);
+      if (GET_CODE (op) == SUBREG)
 	{
-	  operand_reg[nop] = SUBREG_REG (operand_reg[nop]);
+	  operand_reg[nop] = reg = SUBREG_REG (op);
 	  if (GET_MODE_SIZE (biggest_mode[nop])
-	      < GET_MODE_SIZE (GET_MODE (operand_reg[nop])))
-	    biggest_mode[nop] = GET_MODE (operand_reg[nop]);
+	      < GET_MODE_SIZE (GET_MODE (reg)))
+	    biggest_mode[nop] = GET_MODE (reg);
 	}
-      if (REG_P (operand_reg[nop]))
-	no_subreg_reg_operand[nop] = operand_reg[nop];
+      if (! REG_P (reg))
+	operand_reg[nop] = NULL_RTX;
+      else if (REGNO (reg) >= FIRST_PSEUDO_REGISTER
+	       || ((int) REGNO (reg)
+		   == lra_get_elimination_hard_regno (REGNO (reg))))
+	no_subreg_reg_operand[nop] = reg;
       else
-	operand_reg[nop] = NULL_RTX;
+	operand_reg[nop] = no_subreg_reg_operand[nop]
+	  /* Just use natural mode for elimination result.  It should
+	     be enough for extra constraints hooks.  */
+	  = regno_reg_rtx[hard_regno[nop]];
     }
 
   /* The constraints are made of several alternatives.	Each operand's

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-10-31 16:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-31 16:27 patch to fix mips16 LRA register shuffling Vladimir Makarov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).