The optimization is not legal or illegal per se, the only thing that can
make it legal or illegal is a defined calling convention. The calling
convention can say who the "owner" of the arguments is: the caller or the
callee.
The kernel doesn't have a well-enough-defined calling convention to be
able to make a good judgement. We tend to use the same calling convention
as the native compiler in user space does, but even that's not always true
(ie it can be modified by things like -mregparm etc, on a per-architecture
basis).
I don't think the original iBCS2 calling convention (that Linux uses on
x86) is specific on this issue. That would be the thing that would decide
the legality of the optimization, I think.
Considering that Intel largely wrote iBCS2, I guess some Intel person can
know what the standard was ;)
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/