public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Question on gcc RTL and scheduling step.
@ 2020-02-26 15:10 Henri Cloetens
  2020-02-26 16:39 ` Segher Boessenkool
  0 siblings, 1 reply; 6+ messages in thread
From: Henri Cloetens @ 2020-02-26 15:10 UTC (permalink / raw)
  To: gcc-help

Hello All,

I have a problem with GCC during scheduling.

The code I have after scheduling is given below (below the text).
What happens, is follows:

1. The epilogue generator emits an instruction "popret_internal" that
     a. Restores R18 in mode DI. (which corresponds to R18 and R19 in 
mode SI)
     b. Does the function return.
2. Then, during scheduling, the compiler shifts an add instruction PAST 
this return
     instruction, which is incorrect, because:
    (a.) The instruction writes R19. (it restores R18 and R19). The 
scheduler should see this.
    (b.) The instruction changes the PC (program counter).
Q. Why is this happening ?. How can I prevent this ?.

Best Regards,

Henri.

(insn:TI 44 15 18 2 (parallel [
             (parallel [
                     (set (reg/f:SI 31 %r31)
                         (plus:SI (reg/f:SI 31 %r31)
                             (const_int 24 [0x18])))
                     (set (reg:DI 0 %r0)
                         (mem/c:DI (plus:SI (reg/f:SI 31 %r31)
                                 (const_int 16 [0x10])) [2  S8 A64]))
                     (set (reg:DI 18 %r18)
                         (mem/c:DI (plus:SI (reg/f:SI 31 %r31)
                                 (const_int 8 [0x8])) [2  S8 A64]))
                 ])
             (set (pc)
                 (return))
         ]) "use_manyregs.c":9:1 1 {popret_internal}
      (nil))
(insn:TI 18 44 21 2 (set (reg:SI 21 %r21 [88])
         (plus:SI (reg:SI 19 %r19 [orig:87 b1 ] [87])
             (reg:SI 30 %r30 [orig:75 a1.0_2 ] [75]))) 
"use_manyregs.c":8:10 8 {addsi3_internal}
      (expr_list:REG_DEAD (reg:SI 19 %r19 [orig:87 b1 ] [87])
         (nil)))

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-02-26 22:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-26 15:10 Question on gcc RTL and scheduling step Henri Cloetens
2020-02-26 16:39 ` Segher Boessenkool
2020-02-26 17:02   ` Henri Cloetens
2020-02-26 22:00     ` Segher Boessenkool
2020-02-27  7:43       ` Henri Cloetens
2020-02-27  9:23         ` Segher Boessenkool

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).