"Jose E. Marchesi" <jose.march...@oracle.com> writes: > . Dynamic stack allocation (alloca and VLAs) is achieved by using what > otherwise would be a perfectly normal general register, %r9, as a > pseudo stack pointer. This has the disadvantage of making the > register "fixed" and therefore not available for general register > allocation. Hopefully there is a way to conditionalize this, since > both alloca and VLAs are relatively uncommon; I haven't found it > yet.
In principle it's possible to define register eliminations for target-specific registers as well as the usual FRAME/ARG_POINTER_REGNUM crowd. So you could have a fake fixed register to represent the pseudo stack pointer, then allow that to be "eliminated" to %r9 in functions that need it. Functions that don't need it can continue (not) using the fake register and leave %r9 free for general use. Richard