Question on gcc RTL and scheduling step.

Segher Boessenkool segher@kernel.crashing.org
Wed Feb 26 16:39:00 GMT 2020


Hi!

On Wed, Feb 26, 2020 at 01:02:46PM +0100, Henri Cloetens wrote:
> 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.

Yes.  So why doesn't it?  Look at the various dump files to see what the
df ("dataflow") framework thinks about this.

>    (b.) The instruction changes the PC (program counter).

The documentation says you should write just
  (return)
instead of
  (set (pc) (return))
(unlikely to be causing any of this, but a good cleanup to make).

> Q. Why is this happening ?. How can I prevent this ?.

You can have the scheduler print much more debugging info, but I'd
start with the usual stuff: -dap.


Segher



More information about the Gcc-help mailing list