-
Book Overview & Buying
-
Table Of Contents
LLVM Essentials
By :
Frame lowering involves emitting function prologue and epilogue. The prologue happens at the beginning of a function. It sets up the stack frame of the called function. The epilogue happens last in a function, it restores the stack frame of the calling (parent) function.
The "stack" serves several purposes in the execution of a program, as follows:
Keeping track of return address, when calling a function
Storage of local variables in the context of a function call
Passing arguments from the caller to the callee.
Thus there are 2 main functions that need to be defined when implementing frame lowering – emitPrologue() and emitEpilogue().
The emitPrologue() function can be defined as follows:
void TOYFrameLowering::emitPrologue(MachineFunction &MF) const {
const TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo();
MachineBasicBlock &MBB = MF.front();
MachineBasicBlock::iterator MBBI = MBB.begin();
uint64_t StackSize = computeStackSize(MF);
if...
Change the font size
Change margin width
Change background colour