MCPcopy Create free account
hub / github.com/Chemiculs/qengine / updateStackFrame

Method updateStackFrame

src/qengine/extern/asmjit/core/rapass.cpp:1691–1724  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1689// =========================================
1690
1691Error BaseRAPass::updateStackFrame() noexcept {
1692 // Update some StackFrame information that we updated during allocation. The only information we don't have at the
1693 // moment is final local stack size, which is calculated last.
1694 FuncFrame& frame = func()->frame();
1695 for (RegGroup group : RegGroupVirtValues{})
1696 frame.addDirtyRegs(group, _clobberedRegs[group]);
1697 frame.setLocalStackAlignment(_stackAllocator.alignment());
1698
1699 // If there are stack arguments that are not assigned to registers upon entry and the function doesn't require
1700 // dynamic stack alignment we keep these arguments where they are. This will also mark all stack slots that match
1701 // these arguments as allocated.
1702 if (_numStackArgsToStackSlots)
1703 ASMJIT_PROPAGATE(_markStackArgsToKeep());
1704
1705 // Calculate offsets of all stack slots and update StackSize to reflect the calculated local stack size.
1706 ASMJIT_PROPAGATE(_stackAllocator.calculateStackFrame());
1707 frame.setLocalStackSize(_stackAllocator.stackSize());
1708
1709 // Update the stack frame based on `_argsAssignment` and finalize it. Finalization means to apply final calculation
1710 // to the stack layout.
1711 ASMJIT_PROPAGATE(_argsAssignment.updateFuncFrame(frame));
1712 ASMJIT_PROPAGATE(frame.finalize());
1713
1714 // StackAllocator allocates all stots starting from [0], adjust them when necessary.
1715 if (frame.localStackOffset() != 0)
1716 ASMJIT_PROPAGATE(_stackAllocator.adjustSlotOffsets(int32_t(frame.localStackOffset())));
1717
1718 // Again, if there are stack arguments allocated in function's stack we have to handle them. This handles all cases
1719 // (either regular or dynamic stack alignment).
1720 if (_numStackArgsToStackSlots)
1721 ASMJIT_PROPAGATE(_updateStackArgs());
1722
1723 return kErrorOk;
1724}
1725
1726Error BaseRAPass::_markStackArgsToKeep() noexcept {
1727 FuncFrame& frame = func()->frame();

Callers

nothing calls this directly

Calls 11

funcFunction · 0.85
addDirtyRegsMethod · 0.80
calculateStackFrameMethod · 0.80
setLocalStackSizeMethod · 0.80
stackSizeMethod · 0.80
updateFuncFrameMethod · 0.80
localStackOffsetMethod · 0.80
adjustSlotOffsetsMethod · 0.80
alignmentMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected