Patchwork [lra] patch to fix arm bootstrap.

login
register
mail settings
Submitter Vladimir Makarov
Date Feb. 28, 2012, 6:41 p.m.
Message ID <4F4D1FE9.20405@redhat.com>
Download mbox | patch
Permalink /patch/143531/
State New
Headers show

Comments

Vladimir Makarov - Feb. 28, 2012, 6:41 p.m.
After a few recent changes, I found that arm bootstrap broken again.  I 
found a latent bug whose occurrence is triggered by recent changes.  The 
following patch mostly fixes the bug.

The patch was successfully bootstrapped on x86/x86-64 (arm bootstrap 
result will be available only this night).

Committed as rev. 184637.

2012-02-28  Vladimir Makarov <vmakarov@redhat.com>

         * lra-constraints.c (get_op_mode): Use mode from the machine
         description first.
         (match_reload, process_addr_reg, simplify_operand_subreg)
         (curr_insn_transform): Put after-reloads before already existing
         ones.
         (process_address): Use find_regno_note instead find_reg_note.

Patch

Index: lra-constraints.c
===================================================================
--- lra-constraints.c	(revision 184631)
+++ lra-constraints.c	(working copy)
@@ -796,14 +796,16 @@  find_mode (rtx *where, enum machine_mode
 static inline enum machine_mode
 get_op_mode (int nop)
 {
-  rtx *loc = curr_id->operand_loc[nop];
-  enum machine_mode mode = GET_MODE (*loc);
+  rtx *loc;
+  enum machine_mode mode = curr_static_id->operand[nop].mode;
 
-  /* Take mode from the operand first.  */
+  /* Take mode from the machine description first.  */
   if (mode != VOIDmode)
     return mode;
-  /* Take mode from the machine description second.  */
-  if ((mode = curr_static_id->operand[nop].mode) != VOIDmode)
+  loc = curr_id->operand_loc[nop];
+  /* Take mode from the operand second.  */
+  mode = GET_MODE (*loc);
+  if (mode != VOIDmode)
     return mode;
   /* Here is a very rare case.  Take mode from the context.  */
   return find_mode (&PATTERN (curr_insn), VOIDmode, loc);
@@ -900,8 +902,9 @@  match_reload (signed char out, signed ch
   lra_update_dups (curr_id, ins);
   if (find_reg_note (curr_insn, REG_UNUSED, out_rtx) == NULL_RTX)
     {
-      push_to_sequence (*after);
+      start_sequence ();
       lra_emit_move (out_rtx, new_out_reg);
+      emit_insn (*after);
       *after = get_insns ();
       end_sequence ();
     }
@@ -1250,8 +1253,9 @@  process_addr_reg (rtx *loc, rtx *before,
       *loc = new_reg;
       if (after != NULL)
 	{
-	  push_to_sequence (*after);
+	  start_sequence ();
 	  lra_emit_move (reg, new_reg);
+	  emit_insn (*after);
 	  *after = get_insns ();
 	  end_sequence ();
 	}
@@ -1297,8 +1301,9 @@  process_addr_reg (rtx *loc, rtx *before,
       *loc = new_reg;
       if (after != NULL)
 	{
-	  push_to_sequence (*after);
+	  start_sequence ();
 	  lra_emit_move (reg, new_reg);
+	  emit_insn (*after);
 	  *after = get_insns ();
 	  end_sequence ();
 	}
@@ -1374,8 +1379,9 @@  simplify_operand_subreg (int nop, enum m
 	}
       if (type != OP_IN)
 	{
-	  push_to_sequence (after);
+	  start_sequence ();
 	  lra_emit_move (reg, new_reg);
+	  emit_insn (after);
 	  after = get_insns ();
 	  end_sequence ();
 	}
@@ -2508,13 +2514,13 @@  process_address (int nop, rtx *before, r
   change_p = equiv_address_substitution (&ad, addr_loc, mode, as, code);
   if (ad.base_reg_loc != NULL)
     {
-      if (process_addr_reg (ad.base_reg_loc, before,
-			    (ad.base_modify_p
-			     && find_reg_note (curr_insn, REG_DEAD,
-					       *ad.base_reg_loc) == NULL
-			     ? after : NULL),
-			    base_reg_class (mode, as, ad.base_outer_code,
-					    ad.index_code)))
+      if (process_addr_reg
+	  (ad.base_reg_loc, before,
+	   (ad.base_modify_p && REG_P (*ad.base_reg_loc)
+	    && find_regno_note (curr_insn, REG_DEAD,
+				REGNO (*ad.base_reg_loc)) == NULL
+	    ? after : NULL),
+	   base_reg_class (mode, as, ad.base_outer_code, ad.index_code)))
 	change_p = true;
       if (ad.base_reg_loc2 != NULL)
 	*ad.base_reg_loc2 = *ad.base_reg_loc;
@@ -3248,8 +3254,9 @@  curr_insn_transform (void)
 	    {
 	      if (find_reg_note (curr_insn, REG_UNUSED, old) == NULL_RTX)
 		{
-		  push_to_sequence (after);
+		  start_sequence ();
 		  lra_emit_move (old, new_reg);
+		  emit_insn (after);
 		  after = get_insns ();
 		  end_sequence ();
 		}