This is the mail archive of the
mailing list for the GCC project.
Re: [PING][RFC][PATCH] RL78 - Add predicates to reduce code bloat when accessing volatile memory.
- From: Richard Hulme <peper03 at yahoo dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 12 May 2014 22:03:29 +0200
- Subject: Re: [PING][RFC][PATCH] RL78 - Add predicates to reduce code bloat when accessing volatile memory.
- Authentication-results: sourceware.org; auth=none
- References: <535179B5 dot 6010607 at yahoo dot com> <536D259D dot 9080404 at yahoo dot com> <201405091920 dot s49JKtF4027627 at greed dot delorie dot com>
On 09/05/14 21:20, DJ Delorie wrote:
The key to the msp430 change is that I reviewed every pattern that
used the predicates, and only changed the ones where the pattern was
known to be volatile-safe. For the RL78, the devirtualizer may make a
pattern non-volatile-safe, and many patterns are macros which are not
So, just changing the predicates is probably not enough. Did you
review every pattern that used the changed predicates, to ensure that
they're each volatile safe?
Well, I've done my best to confirm that it doesn't break anything. I've
looked over the patterns as best I could and looked at the code being
generated (obviously not every pattern is being used), which didn't show
anything that seemed wrong, and I've had no issues with running the
My understanding of 'volatile' is that even the resulting code I gave as
an example is not actually volatile-safe:
mov a, !240
or a, #32
mov !240, a
as the value stored in address 240 could change just before and/or just
after the 'or', and get overwritten by the second move.
Given that the 'bsf' and 'bcf' instructions (bit set/bit clear) have not
been included in any patterns, that is as volatile-safe as it can get,
As I understand it, one of the reasons for having the virtual pass was
to make the instruction set appear completely orthogonal. Why then,
when every instruction can use every virtual register in any addressing
mode, does it think that:
movw r10, #240
movw ax, r10
movw hl, ax
mov a, [hl]
or a, #32
mov [hl], a
is more volatile-safe? Unless I'm missing something (which I'm quite
prepared to accept) it's not less volatile-safe but it's certainly more
bloated, and makes further optimizations harder.