This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: msp430 port


On 08/19/2013 02:49 PM, DJ Delorie wrote:
I'd say it's not as simple as you make it out to be.  You can't blindly
combine operations on volatile memory.

I'm not blindly combining them, I'm combining them when I know the
hardware will do the volatile-correct thing.
You're missing the point. If the programmer wrote two statements which hit volatile memory and you've got some pattern which matches those two statements, then with your change you'll end up combining them, that's wrong.


ie, the programmer may have written them as separate statements and
if they're volatile you should leave them alone.

Most of the programmers I know would expect "port |= 0x80;" to do a
hardware-specific "set bits" operation, not a series of
volatile-pedantic operations, especially when the ISA has a set of
insns specifically designed to do bit operations on volatile I/O
registers.
I fully understand that. But that doesn't change the fact that if the programmer wrote separate statements with volatile operands you can't combine them. Your change allows such combinations as far as I can tell.

You simply don't have enough context at any point to know if what you're doing is safe or not.


Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]