https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70908

            Bug ID: 70908
           Summary: [SH] Redirect function call returns
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: olegendo at gcc dot gnu.org
  Target Milestone: ---
            Target: sh*-*-*

In the CSiBE set e.g. in jikespg-1.3/src/spacetab.c there are sequences like:

-----------------

        ...
        bra     .L1965
        mov.l   @r3,r4
        .align 1

        ...
        < some constant pool data >
        ...

.L1965:
        jsr     @r5
        nop
        ...


-----------------

        ...
        jsr     @r5
        mov.l   @r3,r4
        bra     .L1965
        nop
        .align 1

        ...
        < some constant pool data >
        ...

.L1965:
        ...

-----------------

In such cases one branch can be avoided by redirecting the return address of
the invoked function like this:

        mova    .L1965,r0
        lds     r0,pr
        jmp     @r5
        mov.l   @r3,r4

This has to be done after constant pool placement by the sh_reorg pass. 
Probably PR 59189 should be fixed first.

Reply via email to