> Right, but it would seem this is a good canididate for combination. This > is especially true since often Volatile is used with the sense of Atomic > in Ada, and it is not a bad idea to combine these in practice, giving an > atomic update (right, nothing in the language requires it, but it is > definitely useful!)
I don't disagree that "this" is a good candidate for combination, but one problem is that by the time you're at that level, you don't easily have the source correspondance you want. E.g., y |= 2; and t1 = y | 2; y = t1; are very hard to tell apart at the RTL level. Though it's clear that a single instruction might best match the expect semantics of the former, it's a lot less clear that it would for the latter. >From a legacy perspective, it's dangerous to muck around much in this area. As to Ada's Atomic, it's just implementation convenience that it's mapped to GCC's volatile. Most things that GCC's volatile implies aren't needed for Ada's atomic (and it may even be the case that most of them aren't even needed for Volatile in Ada). One approach here would be to separate the properties we now consider part of "volatile" (e.g., "can't remove dead load", "can't change access size", "must keep same number of loads", etc.) into separate properties and test those in places where we now test the "volatile" attribute. That would be a fairly straightforward but large and pervasive change. It's not clear it'd be worth the effort, but I'm curious what others think.