Added a possibility to reset a red zone in FuncFrame

This commit is contained in:
kobalicek
2023-01-08 14:34:07 +01:00
parent 9f6d677615
commit 6a414ea141
2 changed files with 10 additions and 1 deletions

View File

@@ -1120,6 +1120,15 @@ public:
inline uint32_t redZoneSize() const noexcept { return _redZoneSize; } inline uint32_t redZoneSize() const noexcept { return _redZoneSize; }
//! Returns the size of 'SpillZone'. //! Returns the size of 'SpillZone'.
inline uint32_t spillZoneSize() const noexcept { return _spillZoneSize; } inline uint32_t spillZoneSize() const noexcept { return _spillZoneSize; }
//! Resets the size of red zone, which would disable it entirely.
//!
//! \note Red zone is currently only used by an AMD64 SystemV calling convention, which expects 128
//! bytes of stack to be accessible below stack pointer. These bytes are then accessible within the
//! function and Compiler can use this space as a spill area. However, sometimes it's better to
//! disallow the use of red zone in case that a user wants to use this stack for a custom purpose.
inline void resetRedZone() noexcept { _redZoneSize = 0; }
//! Returns natural stack alignment (guaranteed stack alignment upon entry). //! Returns natural stack alignment (guaranteed stack alignment upon entry).
inline uint32_t naturalStackAlignment() const noexcept { return _naturalStackAlignment; } inline uint32_t naturalStackAlignment() const noexcept { return _naturalStackAlignment; }
//! Returns natural stack alignment (guaranteed stack alignment upon entry). //! Returns natural stack alignment (guaranteed stack alignment upon entry).

View File

@@ -62,7 +62,7 @@ Error RAStackAllocator::calculateStackFrame() noexcept {
// STEP 1: // STEP 1:
// //
// Update usage based on the size of the slot. We boost smaller slots in a way that 32-bit register has higher // Update usage based on the size of the slot. We boost smaller slots in a way that 32-bit register has a higher
// priority than a 128-bit register, however, if one 128-bit register is used 4 times more than some other 32-bit // priority than a 128-bit register, however, if one 128-bit register is used 4 times more than some other 32-bit
// register it will overweight it. // register it will overweight it.
for (RAStackSlot* slot : _slots) { for (RAStackSlot* slot : _slots) {