LLVM: lib/Target/AArch64/AArch64LowerHomogeneousPrologEpilog.cpp File Reference (original) (raw)
Go to the source code of this file.
| Macros | |
|---|---|
| #define | AARCH64_LOWER_HOMOGENEOUS_PROLOG_EPILOG_NAME "AArch64 homogeneous prolog/epilog lowering pass" |
| Enumerations | |
|---|---|
| enum | FrameHelperType { Prolog, PrologFrame, Epilog, EpilogTail } |
| Functions | |
|---|---|
| INITIALIZE_PASS (AArch64LowerHomogeneousPrologEpilog, "aarch64-lower-homogeneous-prolog-epilog", AARCH64_LOWER_HOMOGENEOUS_PROLOG_EPILOG_NAME, false, false) bool AArch64LowerHomogeneousPrologEpilog | |
| static std::string | getFrameHelperName (SmallVectorImpl< unsigned > &Regs, FrameHelperType Type, unsigned FpOffset) |
| Return a frame helper name with the given CSRs and the helper type. | |
| static MachineFunction & | createFrameHelperMachineFunction (Module *M, MachineModuleInfo *MMI, StringRef Name) |
| Create a Function for the unique frame helper with the given name. | |
| static void | emitStore (MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator Pos, const TargetInstrInfo &TII, unsigned Reg1, unsigned Reg2, int Offset, bool IsPreDec) |
| Emit a store-pair instruction for frame-setup. | |
| static void | emitLoad (MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator Pos, const TargetInstrInfo &TII, unsigned Reg1, unsigned Reg2, int Offset, bool IsPostDec) |
| Emit a load-pair instruction for frame-destroy. | |
| static Function * | getOrCreateFrameHelper (Module *M, MachineModuleInfo *MMI, SmallVectorImpl< unsigned > &Regs, FrameHelperType Type, unsigned FpOffset=0) |
| Return a unique function if a helper can be formed with the given Regs and frame type. | |
| static bool | shouldUseFrameHelper (MachineBasicBlock &MBB, MachineBasicBlock::iterator &NextMBBI, SmallVectorImpl< unsigned > &Regs, FrameHelperType Type) |
| This function checks if a frame helper should be used for HOM_Prolog/HOM_Epilog pseudo instruction expansion. |
| Variables | |
|---|---|
| static cl::opt< int > | FrameHelperSizeThreshold ("frame-helper-size-threshold", cl::init(2), cl::Hidden, cl::desc("The minimum number of instructions that are outlined in a frame " "helper (default = 2)")) |
◆ AARCH64_LOWER_HOMOGENEOUS_PROLOG_EPILOG_NAME
#define AARCH64_LOWER_HOMOGENEOUS_PROLOG_EPILOG_NAME "AArch64 homogeneous prolog/epilog lowering pass"
◆ FrameHelperType
◆ createFrameHelperMachineFunction()
Create a Function for the unique frame helper with the given name.
Return a newly created MachineFunction with an empty MachineBasicBlock.
Definition at line 155 of file AArch64LowerHomogeneousPrologEpilog.cpp.
References assert(), llvm::MachineFunction::begin(), llvm::CallingConv::C, llvm::BasicBlock::Create(), llvm::Function::Create(), llvm::MachineFunction::CreateMachineBasicBlock(), llvm::GlobalValue::ExternalLinkage, F, llvm::MachineRegisterInfo::freezeReservedRegs(), llvm::FunctionType::get(), llvm::MachineModuleInfo::getOrCreateMachineFunction(), llvm::MachineFunction::getProperties(), llvm::MachineFunction::getRegInfo(), llvm::Type::getVoidTy(), llvm::GlobalValue::Global, llvm::MachineFunction::insert(), llvm::GlobalValue::LinkOnceODRLinkage, and MBB.
Referenced by getOrCreateFrameHelper().
◆ emitLoad()
Emit a load-pair instruction for frame-destroy.
If Reg2 is AArch64::NoRegister, emit LDR instead.
Definition at line 234 of file AArch64LowerHomogeneousPrologEpilog.cpp.
References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), assert(), llvm::BuildMI(), contains(), llvm::dwarf_linker::DebugLoc, llvm::MachineInstr::FrameDestroy, llvm::getDefRegState(), llvm::AArch64InstrInfo::getMemOpInfo(), MBB, llvm::Offset, Opc, llvm::MachineInstrBuilder::setMIFlag(), Success, and TII.
Referenced by getOrCreateFrameHelper().
◆ emitStore()
Emit a store-pair instruction for frame-setup.
If Reg2 is AArch64::NoRegister, emit STR instead.
Definition at line 193 of file AArch64LowerHomogeneousPrologEpilog.cpp.
References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), assert(), llvm::BuildMI(), contains(), llvm::dwarf_linker::DebugLoc, llvm::MachineInstr::FrameSetup, llvm::AArch64InstrInfo::getMemOpInfo(), MBB, llvm::Offset, Opc, llvm::MachineInstrBuilder::setMIFlag(), Success, and TII.
Referenced by getOrCreateFrameHelper().
◆ getFrameHelperName()
◆ getOrCreateFrameHelper()
Return a unique function if a helper can be formed with the given Regs and frame type.
_OUTLINED_FUNCTION_PROLOG_x30x29x19x20x21x22: stp x22, x21, [sp, #-32]! ; x29/x30 has been stored at the caller stp x20, x19, [sp, #16] ret
_OUTLINED_FUNCTION_PROLOG_FRAME32_x30x29x19x20x21x22: stp x22, x21, [sp, #-32]! ; x29/x30 has been stored at the caller stp x20, x19, [sp, #16] add fp, sp, #32 ret
_OUTLINED_FUNCTION_EPILOG_x30x29x19x20x21x22: mov x16, x30 ldp x29, x30, [sp, #32] ldp x20, x19, [sp, #16] ldp x22, x21, [sp], #48 ret x16
_OUTLINED_FUNCTION_EPILOG_TAIL_x30x29x19x20x21x22: ldp x29, x30, [sp, #32] ldp x20, x19, [sp, #16] ldp x22, x21, [sp], #48 ret
Parameters
| M | module |
|---|---|
| MMI | machine module info |
| Regs | callee save regs that the helper will handle |
| Type | frame helper type |
Returns
a helper function
Definition at line 303 of file AArch64LowerHomogeneousPrologEpilog.cpp.
References llvm::MachineInstrBuilder::addDef(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::MachineInstrBuilder::addUse(), assert(), llvm::MachineFunction::begin(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::BuildMI(), createFrameHelperMachineFunction(), emitLoad(), emitStore(), Epilog, EpilogTail, F, llvm::find(), llvm::MachineInstr::FrameSetup, getFrameHelperName(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MachineFunction::getSubtarget(), I, MBB, Prolog, PrologFrame, llvm::MachineInstrBuilder::setMIFlag(), Size, llvm::SmallVectorTemplateCommon< T, typename >::size(), and TII.
◆ INITIALIZE_PASS()
| INITIALIZE_PASS | ( | AArch64LowerHomogeneousPrologEpilog | , |
|---|---|---|---|
| "aarch64-lower-homogeneous-prolog-epilog" | , | ||
| AARCH64_LOWER_HOMOGENEOUS_PROLOG_EPILOG_NAME | , | ||
| false | , | ||
| false | ) |
◆ shouldUseFrameHelper()
This function checks if a frame helper should be used for HOM_Prolog/HOM_Epilog pseudo instruction expansion.
Parameters
| MBB | machine basic block |
|---|---|
| NextMBBI | next instruction following HOM_Prolog/HOM_Epilog |
| Regs | callee save registers that are saved or restored. |
| Type | frame helper type |
Returns
True if a use of helper is qualified.
Definition at line 385 of file AArch64LowerHomogeneousPrologEpilog.cpp.
References assert(), Epilog, EpilogTail, FrameHelperSizeThreshold, llvm::is_contained(), MBB, Prolog, PrologFrame, llvm::SmallVectorTemplateCommon< T, typename >::size(), and TRI.
◆ FrameHelperSizeThreshold
| cl::opt< int > FrameHelperSizeThreshold("frame-helper-size-threshold", cl::init(2), cl::Hidden, cl::desc("The minimum number of instructions that are outlined in a frame " "helper (default = 2)")) ( "frame-helper-size-threshold" , cl::init(2) , cl::Hidden , cl::desc("The minimum number of instructions that are outlined in a frame " "helper (default = 2)") ) | static |
|---|