From 3291e7353e586662cd2df534a80702ea7ccb1437 Mon Sep 17 00:00:00 2001 From: Jessica Paquette Date: Tue, 9 Jan 2018 00:26:18 +0000 Subject: [MachineOutliner] AArch64: Handle instrs that use SP and will never need fixups This commit does two things. Firstly, it adds a collection of flags which can be passed along to the target to encode information about the MBB that an instruction lives in to the outliner. Second, it adds some of those flags to the AArch64 outliner in order to add more stack instructions to the list of legal instructions that are handled by the outliner. The two flags added check if - There are calls in the MachineBasicBlock containing the instruction - The link register is available in the entire block If the link register is available and there are no calls, then a stack instruction can always be outlined without fixups, regardless of what it is, since in this case, the outliner will never modify the stack to create a call or outlined frame. The motivation for doing this was checking which instructions are most often missed by the outliner. Instructions like, say %sp = ADDXri %sp, 32, 0; flags: FrameDestroy are very common, but cannot be outlined in the case that the outliner might modify the stack. This commit allows us to outline instructions like this. llvm-svn: 322048 --- llvm/lib/Target/X86/X86InstrInfo.cpp | 4 ++-- llvm/lib/Target/X86/X86InstrInfo.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Target/X86') diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp index 4f6b0b5f26b..b8093641308 100644 --- a/llvm/lib/Target/X86/X86InstrInfo.cpp +++ b/llvm/lib/Target/X86/X86InstrInfo.cpp @@ -10937,8 +10937,8 @@ bool X86InstrInfo::isFunctionSafeToOutlineFrom(MachineFunction &MF, } X86GenInstrInfo::MachineOutlinerInstrType -X86InstrInfo::getOutliningType(MachineInstr &MI) const { - +X86InstrInfo::getOutliningType(MachineBasicBlock::iterator &MIT, unsigned Flags) const { + MachineInstr &MI = *MIT; // Don't allow debug values to impact outlining type. if (MI.isDebugValue() || MI.isIndirectDebugValue()) return MachineOutlinerInstrType::Invisible; diff --git a/llvm/lib/Target/X86/X86InstrInfo.h b/llvm/lib/Target/X86/X86InstrInfo.h index 02a09c340ce..0f76ed76abd 100644 --- a/llvm/lib/Target/X86/X86InstrInfo.h +++ b/llvm/lib/Target/X86/X86InstrInfo.h @@ -568,7 +568,7 @@ public: bool OutlineFromLinkOnceODRs) const override; llvm::X86GenInstrInfo::MachineOutlinerInstrType - getOutliningType(MachineInstr &MI) const override; + getOutliningType(MachineBasicBlock::iterator &MIT, unsigned Flags) const override; void insertOutlinerEpilogue(MachineBasicBlock &MBB, MachineFunction &MF, const MachineOutlinerInfo &MInfo) const override; -- cgit v1.2.3