Messages in this thread | | | Date | Mon, 29 Nov 1999 15:49:41 +0100 | From | Jamie Lokier <> | Subject | Re: spinlock |
| |
Marc Lehmann wrote: > > We should not do such tricks. gcc 2.95 may not be clever enough, but > > I'd say it is plain impossible on x86 to save 100 words in registers ;->
It's not about registers -- registers aren't (or shouldn't be) permitted by the spinlock asm constraints anyway.
The asm spec says "substite an operand representing this VALUE". It's possible for the compiler to /copy/ the VALUE and use an operand referring to that.
The type cast simply affects the typing system in C. The value can still be copied -- even 100 words if the compiler decides that's a good idea.
Object based alias inference means the compiler can decide it only needs to copy the original object words despite the type cast, so it might actually be efficient to do so in some circumstances. We might hope that any solution to the existing -fstrict-aliasing problems would apply equally here, but object-based alias inference is a different fish to type-based alias inference, and current work (and -fno-strict-aliasing) apply only to type-based aliasing. (E.g. the __typealias work).
Work on putting structure elements in registers will presumably lead to GCC being good at analysing the use of structure members in detail. I would not be surprised to find GCC is good at noticing the type cast is meaningless as a result.
-- Jamie
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |