buildAlignSection

Aligned sections are implemented by taking the local variables that need alignment that is larger than the stack alignment. They are allocated into a separate chunk of memory on the stack called an align section, which is aligned on function entry.

buildAlignSection() inserts code just after the function prolog is complete. It allocates memory for the align closure by making a local stack variable to contain that memory, allocates a local variable (salignSection) to point to it. In VarExp::toElem and SymOffExp::toElem, when referring to a variable that is in an align closure, take the offset from salignSection rather than from the frame pointer. A variable cannot be in both a closure and an align section. They go in the closure and then that closure is aligned.

getEthis() and NewExp::toElem need to use sclosure, if set, rather than the current frame pointer??

Run after buildClosure, as buildClosure gets first dibs on inAlignSection variables

extern (C++)
void
buildAlignSection

Parameters

fd FuncDeclaration

function in which all this occurs

irs IRState

state of the intermediate code generation Reference: buildClosure() is very similar.

https://github.com/dlang/dmd/pull/9143 was an incomplete attempt to solve this problem that was merged. It should probably be removed.

Meta