]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
spu.c (spu_machine_dependent_reorg): Make sure branch label on hint instruction is...
authorTrevor Smigiel <Trevor_Smigiel@playstation.sony.com>
Mon, 27 Apr 2009 19:33:20 +0000 (19:33 +0000)
committerTrevor Smigiel <tsmigiel@gcc.gnu.org>
Mon, 27 Apr 2009 19:33:20 +0000 (19:33 +0000)
* spu.c (spu_machine_dependent_reorg): Make sure branch label on hint
instruction is correct.

From-SVN: r146852

gcc/ChangeLog
gcc/config/spu/spu.c

index 013c0fcea4e2a1bf331868fc42a03bced46ec0ac..b8d331be1e2aae3e8ce5bb658e6397656eab18b2 100644 (file)
@@ -1,3 +1,9 @@
+2009-04-27  Trevor Smigiel <trevor_smigiel@playstation.sony.com>
+
+       * spu.c (spu_machine_dependent_reorg): Make sure branch label on hint
+       instruction is correct.
+
+
 2009-04-27  Trevor Smigiel <trevor_smigiel@playstation.sony.com>
 
        Allow non-constant arguments to conversion intrinsics.
index 56abdf8deb383ac1606476d8090eb168c2b832ad..20d769e9e16c3a2a2f3d9e22cfdd8d9780bdd8b4 100644 (file)
@@ -2764,6 +2764,25 @@ spu_machine_dependent_reorg (void)
 
   pad_bb ();
 
+  for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
+    if (NONJUMP_INSN_P (insn) && INSN_CODE (insn) == CODE_FOR_hbr)
+      {
+       /* Adjust the LABEL_REF in a hint when we have inserted a nop
+          between its branch label and the branch .  We don't move the
+          label because GCC expects it at the beginning of the block. */
+       rtx unspec = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
+       rtx label_ref = XVECEXP (unspec, 0, 0);
+       rtx label = XEXP (label_ref, 0);
+       rtx branch;
+       int offset = 0;
+       for (branch = NEXT_INSN (label);
+            !JUMP_P (branch) && !CALL_P (branch);
+            branch = NEXT_INSN (branch))
+         if (NONJUMP_INSN_P (branch))
+           offset += get_attr_length (branch);
+       if (offset > 0)
+         XVECEXP (unspec, 0, 0) = plus_constant (label_ref, offset);
+      }
 
   if (spu_flag_var_tracking)
     {