LLVM API Documentation
#include <MachineFrameInfo.h>
Collaboration diagram for llvm::MachineFrameInfo:
Public Member Functions | |
MachineFrameInfo () | |
bool | hasStackObjects () const |
bool | hasVarSizedObjects () const |
int | getObjectIndexBegin () const |
int | getObjectIndexEnd () const |
int | getObjectSize (int ObjectIdx) const |
int | getObjectAlignment (int ObjectIdx) const |
getObjectAlignment - Return the alignment of the specified stack object... | |
int | getObjectOffset (int ObjectIdx) const |
void | setObjectOffset (int ObjectIdx, int SPOffset) |
unsigned | getStackSize () const |
void | setStackSize (unsigned Size) |
unsigned | getMaxAlignment () const |
void | setMaxAlignment (unsigned Align) |
bool | hasCalls () const |
void | setHasCalls (bool V) |
unsigned | getMaxCallFrameSize () const |
void | setMaxCallFrameSize (unsigned S) |
int | CreateFixedObject (unsigned Size, int SPOffset) |
int | CreateStackObject (unsigned Size, unsigned Alignment) |
int | CreateVariableSizedObject () |
MachineDebugInfo * | getMachineDebugInfo () const |
void | setMachineDebugInfo (MachineDebugInfo *DI) |
void | print (const MachineFunction &MF, std::ostream &OS) const |
void | dump (const MachineFunction &MF) const |
dump - Call print(MF, std::cerr) to be called from the debugger. | |
Classes | |
struct | StackObject |
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted. 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 positive 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.
Definition at line 53 of file MachineFrameInfo.h.
llvm::MachineFrameInfo::MachineFrameInfo | ( | ) | [inline] |
Definition at line 122 of file MachineFrameInfo.h.
bool llvm::MachineFrameInfo::hasStackObjects | ( | ) | const [inline] |
hasStackObjects - Return true if there are any stack objects in this function.
Definition at line 133 of file MachineFrameInfo.h.
bool llvm::MachineFrameInfo::hasVarSizedObjects | ( | ) | const [inline] |
hasVarSizedObjects - This method may be called any time after instruction selection is complete to determine if the stack frame for this function contains any variable sized objects.
Definition at line 139 of file MachineFrameInfo.h.
Referenced by llvm::X86RegisterInfo::emitPrologue(), and hasFP().
int llvm::MachineFrameInfo::getObjectIndexBegin | ( | ) | const [inline] |
getObjectIndexBegin - Return the minimum frame object index...
Definition at line 143 of file MachineFrameInfo.h.
Referenced by llvm::X86RegisterInfo::emitPrologue(), and llvm::X86RegisterInfo::processFunctionBeforeFrameFinalized().
int llvm::MachineFrameInfo::getObjectIndexEnd | ( | ) | const [inline] |
getObjectIndexEnd - Return one past the maximum frame object index...
Definition at line 147 of file MachineFrameInfo.h.
Referenced by llvm::X86RegisterInfo::emitEpilogue().
int llvm::MachineFrameInfo::getObjectSize | ( | int | ObjectIdx | ) | const [inline] |
getObjectSize - Return the size of the specified object
Definition at line 151 of file MachineFrameInfo.h.
Referenced by isConsecutiveLoad().
int llvm::MachineFrameInfo::getObjectAlignment | ( | int | ObjectIdx | ) | const [inline] |
getObjectAlignment - Return the alignment of the specified stack object...
Definition at line 157 of file MachineFrameInfo.h.
Referenced by isBaseAlignment16().
int llvm::MachineFrameInfo::getObjectOffset | ( | int | ObjectIdx | ) | const [inline] |
getObjectOffset - Return the assigned stack offset of the specified object from the incoming stack pointer.
Definition at line 165 of file MachineFrameInfo.h.
Referenced by llvm::SparcRegisterInfo::eliminateFrameIndex(), llvm::IA64RegisterInfo::eliminateFrameIndex(), llvm::ARMRegisterInfo::eliminateFrameIndex(), llvm::AlphaRegisterInfo::eliminateFrameIndex(), llvm::X86RegisterInfo::emitEpilogue(), llvm::X86RegisterInfo::emitPrologue(), llvm::MRegisterInfo::getLocation(), isBaseAlignment16(), and isConsecutiveLoad().
void llvm::MachineFrameInfo::setObjectOffset | ( | int | ObjectIdx, | |
int | SPOffset | |||
) | [inline] |
setObjectOffset - Set the stack frame offset of the specified object. The offset is relative to the stack pointer on entry to the function.
Definition at line 173 of file MachineFrameInfo.h.
unsigned llvm::MachineFrameInfo::getStackSize | ( | ) | const [inline] |
getStackSize - Return the number of bytes that must be allocated to hold all of the fixed size frame objects. This is only valid after Prolog/Epilog code insertion has finalized the stack frame layout.
Definition at line 182 of file MachineFrameInfo.h.
Referenced by llvm::IA64RegisterInfo::eliminateFrameIndex(), llvm::ARMRegisterInfo::eliminateFrameIndex(), llvm::AlphaRegisterInfo::eliminateFrameIndex(), llvm::X86RegisterInfo::emitEpilogue(), llvm::IA64RegisterInfo::emitEpilogue(), llvm::AlphaRegisterInfo::emitEpilogue(), llvm::X86RegisterInfo::emitPrologue(), llvm::SparcRegisterInfo::emitPrologue(), llvm::PPCRegisterInfo::emitPrologue(), llvm::IA64RegisterInfo::emitPrologue(), llvm::ARMRegisterInfo::emitPrologue(), llvm::AlphaRegisterInfo::emitPrologue(), and llvm::MRegisterInfo::getLocation().
void llvm::MachineFrameInfo::setStackSize | ( | unsigned | Size | ) | [inline] |
setStackSize - Set the size of the stack...
Definition at line 186 of file MachineFrameInfo.h.
Referenced by llvm::X86RegisterInfo::emitPrologue(), llvm::PPCRegisterInfo::emitPrologue(), llvm::IA64RegisterInfo::emitPrologue(), and llvm::AlphaRegisterInfo::emitPrologue().
unsigned llvm::MachineFrameInfo::getMaxAlignment | ( | ) | const [inline] |
getMaxAlignment - Return the alignment in bytes that this function must be aligned to, which is greater than the default stack alignment provided by the target.
Definition at line 192 of file MachineFrameInfo.h.
Referenced by llvm::PPCRegisterInfo::emitPrologue().
void llvm::MachineFrameInfo::setMaxAlignment | ( | unsigned | Align | ) | [inline] |
setMaxAlignment - Set the preferred alignment.
Definition at line 196 of file MachineFrameInfo.h.
bool llvm::MachineFrameInfo::hasCalls | ( | ) | const [inline] |
hasCalls - Return true if the current function has no function calls. This is only valid during or after prolog/epilog code emission.
Definition at line 201 of file MachineFrameInfo.h.
Referenced by llvm::X86RegisterInfo::emitPrologue(), llvm::PPCRegisterInfo::emitPrologue(), llvm::IA64RegisterInfo::emitPrologue(), and llvm::AlphaRegisterInfo::emitPrologue().
void llvm::MachineFrameInfo::setHasCalls | ( | bool | V | ) | [inline] |
Definition at line 202 of file MachineFrameInfo.h.
unsigned llvm::MachineFrameInfo::getMaxCallFrameSize | ( | ) | const [inline] |
getMaxCallFrameSize - Return the maximum size of a call frame that must be allocated for an outgoing function call. This is only available if CallFrameSetup/Destroy pseudo instructions are used by the target, and then only during or after prolog/epilog code insertion.
Definition at line 209 of file MachineFrameInfo.h.
Referenced by llvm::X86RegisterInfo::emitPrologue(), llvm::PPCRegisterInfo::emitPrologue(), llvm::IA64RegisterInfo::emitPrologue(), and llvm::AlphaRegisterInfo::emitPrologue().
void llvm::MachineFrameInfo::setMaxCallFrameSize | ( | unsigned | S | ) | [inline] |
Definition at line 210 of file MachineFrameInfo.h.
int llvm::MachineFrameInfo::CreateFixedObject | ( | unsigned | Size, | |
int | SPOffset | |||
) | [inline] |
CreateFixedObject - Create a new object at a fixed location on the stack. All fixed objects should be created before other objects are created for efficiency. This returns an index with a negative value.
Definition at line 216 of file MachineFrameInfo.h.
Referenced by llvm::X86TargetLowering::getReturnAddressFrameIndex(), llvm::IA64TargetLowering::LowerArguments(), LowerFORMAL_ARGUMENT(), LowerFORMAL_ARGUMENTS(), and llvm::X86RegisterInfo::processFunctionBeforeFrameFinalized().
int llvm::MachineFrameInfo::CreateStackObject | ( | unsigned | Size, | |
unsigned | Alignment | |||
) | [inline] |
CreateStackObject - Create a new statically sized stack object, returning a postive identifier to represent it.
Definition at line 225 of file MachineFrameInfo.h.
Referenced by llvm::VirtRegMap::assignVirt2StackSlot(), llvm::FunctionLoweringInfo::FunctionLoweringInfo(), llvm::AlphaTargetLowering::LowerOperation(), LowerSCALAR_TO_VECTOR(), and LowerSINT_TO_FP().
int llvm::MachineFrameInfo::CreateVariableSizedObject | ( | ) | [inline] |
CreateVariableSizedObject - Notify the MachineFrameInfo object that a variable sized object has been created. This must be created whenever a variable sized object is created, whether or not the index returned is actually used.
Definition at line 239 of file MachineFrameInfo.h.
Referenced by llvm::SelectionDAGLowering::visitAlloca().
MachineDebugInfo* llvm::MachineFrameInfo::getMachineDebugInfo | ( | ) | const [inline] |
getMachineDebugInfo - Used by a prologue/epilogue emitter (MRegisterInfo) to provide frame layout information.
Definition at line 248 of file MachineFrameInfo.h.
Referenced by llvm::PPCRegisterInfo::emitPrologue().
void llvm::MachineFrameInfo::setMachineDebugInfo | ( | MachineDebugInfo * | DI | ) | [inline] |
setMachineDebugInfo - Used by a debug consumer (DwarfWriter) to indicate that frame layout information should be gathered.
Definition at line 252 of file MachineFrameInfo.h.
void MachineFrameInfo::print | ( | const MachineFunction & | MF, | |
std::ostream & | OS | |||
) | const |
print - Used by the MachineFunction printer to print information about stack objects. Implemented in MachineFunction.cpp
Definition at line 276 of file MachineFunction.cpp.
References llvm::TargetMachine::getFrameInfo(), llvm::TargetFrameInfo::getOffsetOfLocalArea(), llvm::MachineFunction::getTarget(), MF, and Objects.
Referenced by dump(), and llvm::MachineFunction::print().
void MachineFrameInfo::dump | ( | const MachineFunction & | MF | ) | const |
dump - Call print(MF, std::cerr) to be called from the debugger.
Definition at line 307 of file MachineFunction.cpp.