Stack

fileprivate struct Stack : Sendable

A stack of frames.

  • Returns true iff other describes the same number of frames having the same stacks of allocations.

    Declaration

    Swift

    func hasSameAllocations(as s: Stack) -> Bool
  • The frames in the stack, ordered from bottom to top.

    Declaration

    Swift

    private(set) var elements: [Frame] { get }
  • true iff the stack is empty.

    Declaration

    Swift

    var isEmpty: Bool { get }
  • The depth of the stack.

    Declaration

    Swift

    var depth: Int { get }
  • top

    Accesses the top frame.

    Requires

    The stack is not empty.

    Declaration

    Swift

    var top: Frame { get set }
  • Accesses the IR corresponding to d.

    Requires

    The stack is not empty.

    Complexity

    O(n) for read access where n is the number of frames in the stack. O(1) for write access.

    Declaration

    Swift

    subscript<T>(d: T) -> Operand? where T : DeclID { get set }
  • Pushes newFrame on the stack.

    Declaration

    Swift

    mutating func push(_ newFrame: Frame = .init())
  • Pops the top frame.

    Requires

    The stack is not empty.

    Declaration

    Swift

    @discardableResult
    mutating func pop() -> Frame