Question on gcc RTL and scheduling step.

Henri Cloetens
Wed Feb 26 17:02:00 GMT 2020

Hello Segher, all,

- On the issue of the restore of R18 in mode DI, it seems from
   analysing the log file that the compiler does not understand this
   also affects R19. This looks a bug to me ??. Anyway, I have resolved
   this, by adding a 'clobber' statement to R19 when R18 is written
   in mode 'DI'.
- The other issue, I have changed ((set) (pc) (return)) to (return),
   but, as far as I understand the logfiles, and the documentation,
   both forms are equivalent. Anyway, after fixing the first issue, I do
   not see the second issue any more.

Best Regards and thanks,


On 02/26/2020 01:59 PM, Segher Boessenkool wrote:
> 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