Represents an abstract stack frame until prolog/epilog code is inserted.

Synopsis

Declared in <llvm/CodeGen/MachineFrameInfo.h>

class MachineFrameInfo;

Description

This class is key to allowing stack frame representation optimizations, such as frame pointer elimination. It also allows more mundane (but still important) optimizations, such as reordering of abstract objects on the stack frame.

To support this, the class assigns unique integer identifiers to stack objects requested clients. These identifiers are negative integers for fixed stack objects (such as arguments passed on the stack) or nonnegative for objects that may be reordered. Instructions which refer to stack objects use a special MO_FrameIndex operand to represent these frame indexes.

Because this class keeps track of all references to the stack frame, it knows when a variable sized object is allocated on the stack. This is the sole condition which prevents frame pointer elimination, which is an important optimization on register‐poor architectures. Because original variable sized alloca's in the source program are the only source of variable sized stack objects, it is safe to decide whether there will be any variable sized objects before all stack objects are known (for example, register allocator spill code never needs variable sized objects).

When prolog/epilog code emission is performed, the final stack frame is built and the machine instructions are modified to refer to the actual stack offsets of the object, eliminating all MO_FrameIndex operands from the program.

Enums

Name

Description

SSPLayoutKind

Stack Smashing Protection (SSP) rules require that vulnerable stack allocations are located close the stack protector.

Member Functions

Name

Description

MachineFrameInfo [constructor]

Constructors

CreateFixedObject

Create a new object at a fixed location on the stack.

CreateFixedSpillStackObject

Create a spill slot at a fixed location on the stack. Returns an index with a negative value.

CreateSpillStackObject

Create a new statically sized stack object that represents a spill slot, returning a nonnegative identifier to represent it.

CreateStackObject

Create a new statically sized stack object, returning a nonnegative identifier to represent it.

CreateVariableSizedObject

Create a variable‐sized stack object and return its frame index.

RemoveStackObject

Remove or mark dead a statically sized stack object.

adjustsStack

Return true if this function adjusts the stack ‐‐ e.g., when calling another function. This is only valid during and after prolog/epilog code insertion.

clearObjectAllocation

Remove the underlying Alloca of the specified stack object if it exists. This generally should not be used and is for reduction tooling.

clearRestorePoints

Clear all shrink‐wrapping restore points.

clearSavePoints

Clear all shrink‐wrapping save points.

computeMaxCallFrameSize

Compute the maximum size of a call frame for this function.

contributesToMaxAlignment

Return true if this stack ID should be considered in MaxAlignment.

dump

Print the function frame info to stderr.

ensureMaxAlignment

Make sure the function's frame is at least Align bytes aligned.

estimateStackSize

Estimate and return the size of the stack frame.

getCVBytesOfCalleeSavedRegisters

Returns how many bytes of callee‐saved registers the target pushed in the prologue. Only used for debug info.

getCalleeSavedInfo

getCalleeSavedInfo overloads

getFramePointerPolicy

Return the frame‐pointer policy for this function.

getFunctionContextIndex

Return the index for the function context object. This object is used for SjLj exceptions.

getLocalFrameMaxAlign

Return the required alignment of the local object blob.

getLocalFrameObjectCount

Return the number of objects allocated into the local object block.

getLocalFrameObjectMap

Get the local offset mapping for an object.

getLocalFrameSize

Get the size of the local object blob.

getMaxAlign

Return alignment of this function's frame.

getMaxCallFrameSize

Return the maximum size of a call frame that must be allocated.

getNumFixedObjects

Return the number of fixed objects.

getNumObjects

Return the number of objects.

getObjectAlign

Return the alignment of the specified stack object.

getObjectAllocation

Return the underlying Alloca of the specified stack object if it exists. Returns 0 if none exists.

getObjectIndexBegin

Return the minimum frame object index.

getObjectIndexEnd

Return one past the maximum frame object index.

getObjectOffset

Return the assigned stack offset of the specified object from the incoming stack pointer.

getObjectSSPLayout

Return the SSP layout kind for the specified object.

getObjectSize

Return the size of the specified object.

getOffsetAdjustment

Return the correction for frame offsets.

getPristineRegs

Return a set of physical registers that are pristine.

getRestorePoints

Return the shrink‐wrapping restore points for this function.

getSavePoints

Return the shrink‐wrapping save points for this function.

getStackID

Return the stack ID associated with the specified object.

getStackProtectorIndex

Return the index for the stack protector object.

getStackSize

Return the number of bytes allocated for fixed‐size frame objects.

getUnsafeStackSize

Return the size of the unsafe stack frame.

getUseLocalStackAllocationBlock

Get whether the local allocation blob should be allocated together or let PEI allocate the locals in it directly.

hasCalls

Return true if the current function has any function calls.

hasCopyImplyingStackAdjustment

Returns true if the function contains operations which will lower down to instructions which manipulate the stack pointer.

hasFunctionContextIndex

Return true if a function context frame index has been set.

hasMustTailInVarArgFunc

Returns true if the function is variadic and contains a musttail call.

hasOpaqueSPAdjustment

Returns true if the function contains opaque dynamic stack adjustments.

hasPatchPoint

This method may be called any time after instruction selection is complete to determine if there is a call to builtin @llvm.experimental.patchpoint.

hasScalableStackID

Return true if the object uses a scalable‐vector stack ID.

hasStackMap

This method may be called any time after instruction selection is complete to determine if there is a call to builtin @llvm.experimental.stackmap.

hasStackObjects

Return true if there are any stack objects in this function.

hasStackProtectorIndex

Return true if a stack protector frame index has been set.

hasTailCall

Returns true if the function contains a tail call.

hasVAStart

Returns true if the function calls the llvm.va_start intrinsic.

hasVarSizedObjects

Return true if the stack frame contains any variable‐sized objects.

isAliasedObjectIndex

Returns true if the specified index corresponds to an object that might be pointed to by an LLVM IR value.

isCalleeSavedInfoValid

Has the callee saved info been calculated yet?

isCalleeSavedObjectIndex

Return true if the index is a callee‐saved spill slot.

isDeadObjectIndex

Returns true if the specified index corresponds to a dead object.

isFixedObjectIndex

Returns true if the specified index corresponds to a fixed stack object.

isFrameAddressTaken

This method may be called any time after instruction selection is complete to determine if there is a call to @llvm.frameaddress in this function.

isImmutableObjectIndex

Returns true if the specified index corresponds to an immutable object.

isMaxCallFrameSizeComputed

Return true if the maximum call‐frame size has been computed.

isObjectPreAllocated

Return true if the object was pre‐allocated into the local block.

isObjectSExt

Return true if the object has been sign‐extended.

isObjectZExt

Return true if the object has been zero‐extended.

isReturnAddressTaken

This method may be called any time after instruction selection is complete to determine if there is a call to @llvm.returnaddress in this function.

isScalableStackID

Return true if StackID identifies a scalable‐vector stack.

isSpillSlotObjectIndex

Returns true if the specified index corresponds to a spill slot.

isStackRealignable

Return true if the stack may be realigned.

isStatepointSpillSlotObjectIndex

Return true if the index is a statepoint spill slot.

isVariableSizedObjectIndex

Returns true if the specified index corresponds to a variable sized object.

mapLocalFrameObject

Map a frame index into the local object block.

markAsStatepointSpillSlotObjectIndex

Mark the specified object as a statepoint spill slot.

needsSplitStackProlog

Return true if this function requires a split stack prolog.

print

Used by the MachineFunction printer to print information about stack objects. Implemented in MachineFunction.cpp.

setAdjustsStack

Record whether this function adjusts the stack.

setCVBytesOfCalleeSavedRegisters

Set how many bytes of callee‐saved registers to report for CodeView.

setCalleeSavedInfo

Used by prolog/epilog inserter to set the function's callee saved information.

setCalleeSavedInfoValid

Record whether the callee‐saved info has been calculated.

setFrameAddressIsTaken

Record whether @llvm.frameaddress is taken in this function.

setFramePointerPolicy

Set the frame‐pointer policy for this function.

setFunctionContextIndex

Set the frame index of the SjLj function context object.

setHasCalls

Record whether the current function has any function calls.

setHasCopyImplyingStackAdjustment

Record whether copies imply a stack‐pointer adjustment.

setHasMustTailInVarArgFunc

Record whether this varargs function contains a musttail call.

setHasOpaqueSPAdjustment

Record whether the function contains opaque dynamic stack adjustments.

setHasPatchPoint

Record whether this function contains an @llvm.experimental.patchpoint.

setHasStackMap

Record whether this function contains an @llvm.experimental.stackmap.

setHasTailCall

Record whether the function contains a tail call.

setHasVAStart

Record whether the function calls llvm.va_start.

setIsAliasedObjectIndex

Set "maybe pointed to by an LLVM IR value" for an object.

setIsCalleeSavedObjectIndex

Mark whether the index is a callee‐saved spill slot.

setIsImmutableObjectIndex

Marks the immutability of an object.

setLocalFrameMaxAlign

Set the required alignment of the local object blob.

setLocalFrameSize

Set the size of the local object blob.

setMaxAlign

Overwrite alignment of this function's frame.

setMaxCallFrameSize

Set the maximum size of an outgoing call frame.

setObjectAlignment

Change the alignment of the specified stack object.

setObjectOffset

Set the stack frame offset of the specified object. The offset is relative to the stack pointer on entry to the function.

setObjectSExt

Set whether the object has been sign‐extended.

setObjectSSPLayout

Set the SSP layout kind for the specified object.

setObjectSize

Change the size of the specified stack object.

setObjectZExt

Set whether the object has been zero‐extended.

setOffsetAdjustment

Set the correction for frame offsets.

setRestorePoints

Set the shrink‐wrapping restore points for this function.

setReturnAddressIsTaken

Record whether @llvm.returnaddress is taken in this function.

setSavePoints

Set the shrink‐wrapping save points for this function.

setStackID

Set the stack ID associated with the specified object.

setStackProtectorIndex

Set the frame index of the stack protector object.

setStackSize

Set the size of the stack.

setUnsafeStackSize

Set the size of the unsafe stack frame.

setUseLocalStackAllocationBlock

Set whether the local allocation blob should be allocated together.

shouldRealignStack

Return true if stack realignment is forced by function attributes or if the stack alignment.

Created with MrDocs