[MachineOutliner] NFC: Remove insertOutlinerPrologue, rename insertOutlinerEpilogue

insertOutlinerPrologue was not used by any target, and prologue-esque code was
beginning to appear in insertOutlinerEpilogue. Refactor that into one function,
buildOutlinedFrame.

This just removes insertOutlinerPrologue and renames insertOutlinerEpilogue.

llvm-svn: 335076
This commit is contained in:
Jessica Paquette 2018-06-19 21:14:48 +00:00
parent 75f7b503ba
commit 0a78d09ccb
6 changed files with 9 additions and 37 deletions

View File

@ -1626,14 +1626,12 @@ public:
return 0x0;
}
/// Insert a custom epilogue for outlined functions.
/// This may be empty, in which case no epilogue or return statement will be
/// emitted.
virtual void insertOutlinerEpilogue(MachineBasicBlock &MBB,
/// Insert a custom frame for outlined functions.
virtual void buildOutlinedFrame(MachineBasicBlock &MBB,
MachineFunction &MF,
const outliner::TargetCostInfo &TCI) const {
llvm_unreachable(
"Target didn't implement TargetInstrInfo::insertOutlinerEpilogue!");
"Target didn't implement TargetInstrInfo::buildOutlinedFrame!");
}
/// Insert a call to an outlined function into the program.
@ -1647,15 +1645,6 @@ public:
"Target didn't implement TargetInstrInfo::insertOutlinedCall!");
}
/// Insert a custom prologue for outlined functions.
/// This may be empty, in which case no prologue will be emitted.
virtual void insertOutlinerPrologue(MachineBasicBlock &MBB,
MachineFunction &MF,
const outliner::TargetCostInfo &TCI) const {
llvm_unreachable(
"Target didn't implement TargetInstrInfo::insertOutlinerPrologue!");
}
/// Return true if the function can safely be outlined from.
/// A function \p MF is considered safe for outlining if an outlined function
/// produced from instructions in F will produce a program which produces the

View File

@ -25,9 +25,8 @@
///
/// Targets must implement
/// * getOutliningCandidateInfo
/// * insertOutlinerEpilogue
/// * buildOutlinedFrame
/// * insertOutlinedCall
/// * insertOutlinerPrologue
/// * isFunctionSafeToOutlineFrom
///
/// in order to make use of the MachineOutliner.
@ -1150,8 +1149,6 @@ MachineOutliner::createOutlinedFunction(Module &M, const OutlinedFunction &OF,
// Insert the new function into the module.
MF.insert(MF.begin(), &MBB);
TII.insertOutlinerPrologue(MBB, MF, OF.TCI);
// Copy over the instructions for the function using the integer mappings in
// its sequence.
for (unsigned Str : OF.Sequence) {
@ -1164,7 +1161,7 @@ MachineOutliner::createOutlinedFunction(Module &M, const OutlinedFunction &OF,
MBB.insert(MBB.end(), NewMI);
}
TII.insertOutlinerEpilogue(MBB, MF, OF.TCI);
TII.buildOutlinedFrame(MBB, MF, OF.TCI);
// If there's a DISubprogram associated with this outlined function, then
// emit debug info for the outlined function.

View File

@ -5302,7 +5302,7 @@ void AArch64InstrInfo::fixupPostOutline(MachineBasicBlock &MBB) const {
}
}
void AArch64InstrInfo::insertOutlinerEpilogue(
void AArch64InstrInfo::buildOutlinedFrame(
MachineBasicBlock &MBB, MachineFunction &MF,
const outliner::TargetCostInfo &TCI) const {
// For thunk outlining, rewrite the last instruction from a call to a
@ -5399,10 +5399,6 @@ void AArch64InstrInfo::insertOutlinerEpilogue(
fixupPostOutline(MBB);
}
void AArch64InstrInfo::insertOutlinerPrologue(
MachineBasicBlock &MBB, MachineFunction &MF,
const outliner::TargetCostInfo &TCI) const {}
MachineBasicBlock::iterator AArch64InstrInfo::insertOutlinedCall(
Module &M, MachineBasicBlock &MBB, MachineBasicBlock::iterator &It,
MachineFunction &MF, const outliner::TargetCostInfo &TCI) const {

View File

@ -248,9 +248,7 @@ public:
outliner::InstrType
getOutliningType(MachineBasicBlock::iterator &MIT, unsigned Flags) const override;
unsigned getMachineOutlinerMBBFlags(MachineBasicBlock &MBB) const override;
void insertOutlinerEpilogue(MachineBasicBlock &MBB, MachineFunction &MF,
const outliner::TargetCostInfo &TCI) const override;
void insertOutlinerPrologue(MachineBasicBlock &MBB, MachineFunction &MF,
void buildOutlinedFrame(MachineBasicBlock &MBB, MachineFunction &MF,
const outliner::TargetCostInfo &TCI) const override;
MachineBasicBlock::iterator
insertOutlinedCall(Module &M, MachineBasicBlock &MBB,

View File

@ -13017,7 +13017,7 @@ X86InstrInfo::getOutliningType(MachineBasicBlock::iterator &MIT, unsigned Flags
return outliner::InstrType::Legal;
}
void X86InstrInfo::insertOutlinerEpilogue(MachineBasicBlock &MBB,
void X86InstrInfo::buildOutlinedFrame(MachineBasicBlock &MBB,
MachineFunction &MF,
const outliner::TargetCostInfo &TCI)
const {
@ -13031,11 +13031,6 @@ void X86InstrInfo::insertOutlinerEpilogue(MachineBasicBlock &MBB,
MBB.insert(MBB.end(), retq);
}
void X86InstrInfo::insertOutlinerPrologue(MachineBasicBlock &MBB,
MachineFunction &MF,
const outliner::TargetCostInfo &TCI)
const {}
MachineBasicBlock::iterator
X86InstrInfo::insertOutlinedCall(Module &M, MachineBasicBlock &MBB,
MachineBasicBlock::iterator &It,

View File

@ -602,10 +602,7 @@ public:
outliner::InstrType
getOutliningType(MachineBasicBlock::iterator &MIT, unsigned Flags) const override;
void insertOutlinerEpilogue(MachineBasicBlock &MBB, MachineFunction &MF,
const outliner::TargetCostInfo &TCI) const override;
void insertOutlinerPrologue(MachineBasicBlock &MBB, MachineFunction &MF,
void buildOutlinedFrame(MachineBasicBlock &MBB, MachineFunction &MF,
const outliner::TargetCostInfo &TCI) const override;
MachineBasicBlock::iterator