mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 12:19:53 +00:00
MachineSink: make shouldSink a TII target hook
Some targets may disagree on what they want sunk or not sunk, so make this a target hook instead of hardcoded. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264799 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d6dc9e03af
commit
513c245e44
@ -256,6 +256,18 @@ public:
|
||||
return MI->isAsCheapAsAMove();
|
||||
}
|
||||
|
||||
/// Return true if the instruction should be sunk by MachineSink.
|
||||
///
|
||||
/// MachineSink determines on its own whether the instruction is safe to sink;
|
||||
/// this gives the target a hook to override the default behavior with regards
|
||||
/// to which instructions should be sunk.
|
||||
/// The default behavior is to not sink insert_subreg, subreg_to_reg, and
|
||||
/// reg_sequence. These are meant to be close to the source to make it easier
|
||||
/// to coalesce.
|
||||
virtual bool shouldSink(const MachineInstr &MI) const {
|
||||
return !MI.isInsertSubreg() && !MI.isSubregToReg() && !MI.isRegSequence();
|
||||
}
|
||||
|
||||
/// Re-issue the specified 'original' instruction at the
|
||||
/// specific location targeting a new destination register.
|
||||
/// The register in Orig->getOperand(0).getReg() will be substituted by
|
||||
|
@ -472,10 +472,6 @@ bool MachineSinking::PostponeSplitCriticalEdge(MachineInstr *MI,
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool AvoidsSinking(MachineInstr *MI, MachineRegisterInfo *MRI) {
|
||||
return MI->isInsertSubreg() || MI->isSubregToReg() || MI->isRegSequence();
|
||||
}
|
||||
|
||||
/// collectDebgValues - Scan instructions following MI and collect any
|
||||
/// matching DBG_VALUEs.
|
||||
static void collectDebugValues(MachineInstr *MI,
|
||||
@ -724,9 +720,8 @@ static bool SinkingPreventsImplicitNullCheck(MachineInstr *MI,
|
||||
/// instruction out of its current block into a successor.
|
||||
bool MachineSinking::SinkInstruction(MachineInstr *MI, bool &SawStore,
|
||||
AllSuccsCache &AllSuccessors) {
|
||||
// Don't sink insert_subreg, subreg_to_reg, reg_sequence. These are meant to
|
||||
// be close to the source to make it easier to coalesce.
|
||||
if (AvoidsSinking(MI, MRI))
|
||||
// Don't sink instructions that the target prefers not to sink.
|
||||
if (!TII->shouldSink(*MI))
|
||||
return false;
|
||||
|
||||
// Check if it's safe to move the instruction.
|
||||
|
Loading…
Reference in New Issue
Block a user