Volatile Memory accesses in Branch Delay Slots
Oleg Endo
oleg.endo@t-online.de
Tue Jul 25 12:38:00 GMT 2017
On Tue, 2017-07-25 at 10:47 +0200, Jakob Wenzel wrote:
>Â
> jr's delay slot is not filled. However, if the declaration of a isÂ
> changed to `extern int a`, the delay slot is filled with the sw.
>
> The function responsible for this behavior seems to beÂ
> resource_conflicts_p in reorg.c. Sadly, I could not find any
> commentsÂ
> explaining why volatile accesses cannot be put into delay slots.
>
> What is the reason for this behavior? I am unable to think of anyÂ
> situation where allowing volatile memory accesses in branch delay
> slots  leads to problems. Am I missing a case? Or are negative
> effects limited  to other architectures?
Maybe because the code that does the delay slot stuffing does not do
sophisticated checks whether such instruction reordering would not
violate anything? Â So it's playing safe and bails out if it sees
"volatile mem". Â Same thing happens also with insns that have multiple
sets. Â Ideally it should do some more fine grained checks and give the
backend an option to opt-in or opt-out.
Cheers,
Oleg
More information about the Gcc
mailing list