This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Avoid stack references in inline assembly


On 18/06/2019 at 00:05, Jeff Law wrote:
If you're going to insist on doing this with an ASM you're likely going to need to only use registers and constants for constraints since otherwise you run the risk of getting a stack address.

Thanks for all your clarifications and suggestions.

To optimally solve this issue, it might be useful to implement in GCC a pseudo "push" assembler opcode. It would be usable in the assembler template, and interpreted by GCC. So GCC could understand it and emit the real push instruction for the target processor. But as a side effect, it could also remember the number of bytes already pushed on the stack. So next references to stack variables could be adjusted with the proper offset. This way GCC would produce valid and optimal code.

--
Vincent Rivière


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]