diff mbox

RFA: MN10300: Add jump label to Lcc insn

Message ID m3obyx3jvj.fsf@redhat.com
State New
Headers show

Commit Message

Nick Clifton Sept. 6, 2011, 1:01 p.m. UTC
Hi Jeff, Hi Alex,

  The MN10300 target is currently failing to build in the mainline FSF
  sources because of this error when creating libgcc:

    gcc/libgcc2.c: In function '__popcountsi2':
    gcc/libgcc2.c:834:1: internal compiler error: in create_trace_edges, at dwarf2cfi.c:2325

  This turns out to be because the code in create_trace_edges does not
  handle jumps inside parallel insns, like this:

    (jump_insn 72 52 31 3 (parallel [
            (set (pc)
                (if_then_else (ne (reg:CC 51 EPSW)
                        (const_int 0 [0]))
                    (label_ref 29)
                    (pc)))
            (unspec [
                    (const_int 1 [0x1])
                ] 9)
        ]) gcc/libgcc2.c:830 -1
     (insn_list:REG_LABEL_OPERAND 29 (nil)))

  I am not sure if create_trace_edges should handle this, but I felt
  that the easiest thing to do was to fix the MN10300 backend so that
  when it was creating this insn, it would also set the label on the
  parallel container.  That is what the patch below does and with this
  applied I can build the toolchain again.

  OK to apply, or is there a better way to fix the problem ?

Cheers
  Nick

gcc/ChangeLog
2011-09-06  Nick Clifton  <nickc@redhat.com>

	* config/mn10300/mn10300.c (mn10300_insert_setlb_lcc): Set the
	jump label on the parallel part of the insn.

Comments

Jeff Law Sept. 6, 2011, 3:24 p.m. UTC | #1
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/06/11 07:01, Nick Clifton wrote:
> Hi Jeff, Hi Alex,
> 
> The MN10300 target is currently failing to build in the mainline FSF 
> sources because of this error when creating libgcc:
> 
> gcc/libgcc2.c: In function '__popcountsi2': gcc/libgcc2.c:834:1:
> internal compiler error: in create_trace_edges, at dwarf2cfi.c:2325
> 
> This turns out to be because the code in create_trace_edges does not 
> handle jumps inside parallel insns, like this:
> 
> (jump_insn 72 52 31 3 (parallel [ (set (pc) (if_then_else (ne (reg:CC
> 51 EPSW) (const_int 0 [0])) (label_ref 29) (pc))) (unspec [ 
> (const_int 1 [0x1]) ] 9) ]) gcc/libgcc2.c:830 -1 
> (insn_list:REG_LABEL_OPERAND 29 (nil)))
> 
> I am not sure if create_trace_edges should handle this, but I felt 
> that the easiest thing to do was to fix the MN10300 backend so that 
> when it was creating this insn, it would also set the label on the 
> parallel container.  That is what the patch below does and with this 
> applied I can build the toolchain again.
> 
> OK to apply, or is there a better way to fix the problem ?
> 
> Cheers Nick
> 
> gcc/ChangeLog 2011-09-06  Nick Clifton  <nickc@redhat.com>
> 
> * config/mn10300/mn10300.c (mn10300_insert_setlb_lcc): Set the jump
> label on the parallel part of the insn.
Normally the JUMP_LABEL is set by the generic parts of the compiler;
however, jumps created via the md_reorg hook need explicitly have their
JUMP_LABEL set by the backend.

OK.

jeff

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOZjs5AAoJEBRtltQi2kC7jJkH/0XQmZiche6+zgwdkq9rxLAs
BBILnHF4cHsj8lb12lL3r7CY32JrXVE+jl1o2xz5uR1gWUd4Hnf3EVQ0z7feNfda
CQLUJUHTbCVTIOLZqLtMuwB4IVQFiRKFSdNxTE/ZYUG3gvHuN6vVEjbJW/+rzPei
MMhc0jq2uFUvazdnHJQ9rW6mQuk51Y66CWOTft21mrOnm2SzeKZ+tKM0TiTOYOOT
xSkT3Ni6wMPQe9sey1Bub+r4S0LWo2ER2aV2/Owg6j5k/ChDFYYcKCci+pLBSKGe
J4QdG4LdJjzLIvFf4YB4OQo9NGFVvlD5+lRXYW+QgYNmsM+nrqmFpC4C2eW04fk=
=jpY2
-----END PGP SIGNATURE-----
diff mbox

Patch

Index: gcc/config/mn10300/mn10300.c
===================================================================
--- gcc/config/mn10300/mn10300.c	(revision 178566)
+++ gcc/config/mn10300/mn10300.c	(working copy)
@@ -3150,6 +3150,7 @@ 
 
   lcc = emit_jump_insn_before (lcc, branch);
   mark_jump_label (XVECEXP (PATTERN (lcc), 0, 0), lcc, 0);
+  JUMP_LABEL (lcc) = label;
   DUMP ("Replacing branch insn...", branch);
   DUMP ("... with Lcc insn:", lcc);  
   delete_insn (branch);