Richard Guenther wrote: > On Tue, Aug 2, 2011 at 3:23 PM, Ian Lance Taylor <i...@google.com> wrote: > > Richard Guenther <richard.guent...@gmail.com> writes: > >> I suggest to amend the documentation for local call-clobbered register > >> variables to say that the only valid sequence using them is from a > >> non-inlinable function that contains only direct initializations of the > >> register variables from constants or parameters. > > > > Let's just implement those requirements in the compiler itself. > > Doesn't work for existing code, no? And if thinking new code then > I'd rather have explicit dependences (and a way to represent them). > Thus, for example > > asm ("scall" : : "asm("r0")" (10), ...) > > thus, why force new constraints when we already can figure out > local register vars by register name? Why not extend the constraint > syntax somehow to allow specifying the same effect?
Maybe it would be possible to implement this while keeping the syntax of existing code by (re-)defining the semantics of register asm to basically say that: If a variable X is declared as register asm for register Y, and X is later on used as operand to an inline asm, the register allocator will choose register Y to hold that asm operand. (And this is the full specification of register asm semantics, nothing beyond this is guaranteed.) It seems this semantics could be implemented very early on, probably in the frontend itself. The frontend would mark the *asm* statement as using the specified register (there would be no special handling of the *variable* as such, after the frontend is done). The optimizers would then simply be required to pass the asm-statement register annotations though, much like today they pass constraints through. At the point where register allocation decisions are made, those register annotations would then be acted on. Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE ulrich.weig...@de.ibm.com