Richard Guenther <richard.guent...@gmail.com> writes: > On Tue, Aug 2, 2011 at 3:23 PM, Ian Lance Taylor <i...@google.com> wrote: >> Richard Guenther <richard.guent...@gmail.com> writes: >> >>> Or go one step further and deprecate local register variables alltogether >>> (they IMHO don't make much sense, and rather the targets should provide >>> a way to properly constrain asm inputs and outputs). >> >> No, local register variables are documented as working and many programs >> rely on them. They are a straightforward way to get an asm argument in >> a specific register, and I don't see any reason to break that. > > Well, maybe they look like so. But in reality there is _no_ connection > from the register setup to the actual asm. Which is the problem the > compiler faces here (apart from the libcall issue). If there should be > an implicit dependence of all asms to all local register var setters > and users then this isn't implemented on gimple (or rather it works > by chance there as we treat register vars as memory and do not > disambiguate anything across asms (yet)).
I'm not sure why we need to do anything at the GIMPLE level other than disable some optimizations. There is a connection from the register variable to the asm--the asm refers to the variable. There is nothing specific about the register in there, but at the GIMPLE level there doesn't have to be. We should not break a useful existing feature because we find it inconvenient. Let's just disable some optimizations so that it continues to work. >>> 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? Why not? > 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? I agree that it would be a good idea to permit asms to indicate the specific register the operand should go into. Ian