14#ifndef LLVM_CODEGEN_ANTIDEPBREAKER_H
15#define LLVM_CODEGEN_ANTIDEPBREAKER_H
27class RegisterClassInfo;
34 std::vector<std::pair<MachineInstr *, MachineInstr *>>;
46 unsigned InsertPosIndex,
52 unsigned InsertPosIndex) = 0;
60 if (
MI.isDebugValue()) {
61 if (
MI.getDebugOperand(0).isReg() &&
62 MI.getDebugOperand(0).getReg() == OldReg)
63 MI.getDebugOperand(0).setReg(NewReg);
64 }
else if (
MI.isDebugPHI()) {
65 if (
MI.getOperand(0).isReg() &&
66 MI.getOperand(0).getReg() == OldReg)
67 MI.getOperand(0).setReg(NewReg);
76 unsigned OldReg,
unsigned NewReg) {
80 for (
const auto &DV :
make_range(DbgValues.crbegin(), DbgValues.crend())) {
82 if ((PrevMI == ParentMI) || (PrevMI == PrevDbgMI)) {
86 }
else if (PrevDbgMI) {
94 MachineFunction &MFi,
const RegisterClassInfo &RCI,
98 const RegisterClassInfo &RCI);
This class works in conjunction with the post-RA scheduler to rename registers to break register anti...
virtual void FinishBlock()=0
Finish anti-dep breaking for a basic block.
virtual unsigned BreakAntiDependencies(const std::vector< SUnit > &SUnits, MachineBasicBlock::iterator Begin, MachineBasicBlock::iterator End, unsigned InsertPosIndex, DbgValueVector &DbgValues)=0
Identifiy anti-dependencies within a basic-block region and break them by renaming registers.
void UpdateDbgValue(MachineInstr &MI, unsigned OldReg, unsigned NewReg)
Update DBG_VALUE or DBG_PHI if dependency breaker is updating other machine instruction to use NewReg...
virtual void Observe(MachineInstr &MI, unsigned Count, unsigned InsertPosIndex)=0
Update liveness information to account for the current instruction, which will not be scheduled.
virtual ~AntiDepBreaker()
void UpdateDbgValues(const DbgValueVector &DbgValues, MachineInstr *ParentMI, unsigned OldReg, unsigned NewReg)
Update all DBG_VALUE instructions that may be affected by the dependency breaker's update of ParentMI...
virtual void StartBlock(MachineBasicBlock *BB)=0
Initialize anti-dep breaking for a new basic block.
std::vector< std::pair< MachineInstr *, MachineInstr * > > DbgValueVector
Representation of each machine instruction.
SmallVectorImpl< const TargetRegisterClass * > RegClassVector
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
AntiDepBreaker * createAggressiveAntiDepBreaker(MachineFunction &MFi, const RegisterClassInfo &RCI, TargetSubtargetInfo::RegClassVector &CriticalPathRCs)
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
AntiDepBreaker * createCriticalAntiDepBreaker(MachineFunction &MFi, const RegisterClassInfo &RCI)