[llvm-dev] Optimised stack direction?

Samuel Williams via llvm-dev llvm-dev at lists.llvm.org
Tue Jun 25 14:10:01 PDT 2019


Thanks for all the detailed replies.

> You can't rely on x and y being laid out in any particular order even
during multiple calls to stack_direction within a single compilation

But according to the assembly being generated, there is a fixed layout on
the stack. I agree, the code is pretty ambiguous. But it should be well
defined within the compiler. If it changes from compilation unit to
compilation unit, so be it, at least given some specific instance of the
function, it should be a constant.

> If there turned out to be a compelling enough use-case, an intrinsic
could be added to get the result more efficiently.

We need this operation in Ruby, and generally in coroutines to know how to
layout the stack. Some architectures decided it would be a great idea for
the stack to grow upwards.

- Where to put guard page.
- What should be the initial stack pointer.
- How to alloca for custom stack allocations.

Thanks
Samuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190626/ee6be6b9/attachment.html>


More information about the llvm-dev mailing list