Inserting the prologue-epilogue code
Inserting the prologue-epilogue code involves stack unwinding, finalizing the function layout, saving callee-saved registers and emitting the prologue and epilogue code. It also replaces abstract frame indexes with appropriate references. This pass runs after the register allocation phase.
How to do it…
The skeleton and the important functions defined in the PrologueEpilogueInserter
class are as follows:
- The prologue epilogue inserter pass runs on a machine function, hence it inherits the
MachineFunctionPass
class. Its constructor initializes the pass:class PEI : public MachineFunctionPass { public: static char ID; PEI() : MachineFunctionPass(ID) { initializePEIPass(*PassRegistry::getPassRegistry()); }
- There are ...
Get LLVM Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.