> On Jan 5, 2015, at 1:47 PM, DJ Delorie <d...@redhat.com> wrote:
> 
> 
>> One question: do you have an example of a non-volatile-safe machine so
>> I can get a feel for the problems one might encounter?  At best I can
>> imagine a machine that optimizes "add 0, [mem]" to avoid the
>> read/write, but I'm not aware of such an ISA.
> 
> For example, the MSP430 backend uses a macro for movsi, addsipsi3,
> subpsi3, and a few others, which aren't volatile-safe.  Look for
> "general_operand" vs "msp_general_operand”.

To try to generalize from that: it looks like the operating principle is that 
an insn that expands into multiple references to a given operand isn’t 
volatile-safe, but one where there is only a single reference is safe?

That would translate (roughly, at least) into: a general_operand that fits in a 
machine word is safe, one that doesn’t isn’t safe.

It sure is unfortunate that this is not documented, especially since the 
default behavior is not to allow volatile.  (And that default, even though it 
hurts performance, makes sense — it is the safe choice for correctness.)

It sounds like all the back-end maintainers (at least those who have 
general_operand in their MD files) should plan to do this work, if it hasn’t 
already been done.  It sounds pretty simple and mechanical, at least if the 
summary I came up with above is accurate, or if someone can produce a 
description that is.

        paul

Reply via email to