|
LLVM 23.0.0git
|
#include "llvm/CodeGen/LiveRegMatrix.h"
Public Types | |
| enum | InterferenceKind { IK_Free = 0 , IK_VirtReg , IK_RegUnit , IK_RegMask } |
Public Member Functions | |
| LiveRegMatrix (LiveRegMatrix &&Other)=default | |
| void | init (MachineFunction &MF, LiveIntervals &LIS, VirtRegMap &VRM) |
| void | invalidateVirtRegs () |
| Invalidate cached interference queries after modifying virtual register live ranges. | |
| InterferenceKind | checkInterference (const LiveInterval &VirtReg, MCRegister PhysReg) |
| Check for interference before assigning VirtReg to PhysReg. | |
| bool | checkInterference (SlotIndex Start, SlotIndex End, MCRegister PhysReg) |
| Check for interference in the segment [Start, End) that may prevent assignment to PhysReg. | |
| LaneBitmask | checkInterferenceLanes (SlotIndex Start, SlotIndex End, MCRegister PhysReg) |
| Check for interference in the segment [Start, End) that may prevent assignment to PhysReg, like checkInterference. | |
| void | assign (const LiveInterval &VirtReg, MCRegister PhysReg) |
| Assign VirtReg to PhysReg. | |
| void | unassign (const LiveInterval &VirtReg, bool ClearAllReferencingSegments=false) |
| Unassign VirtReg from its PhysReg. | |
| bool | isPhysRegUsed (MCRegister PhysReg) const |
Returns true if the given PhysReg has any live intervals assigned. | |
| bool | checkRegMaskInterference (const LiveInterval &VirtReg, MCRegister PhysReg=MCRegister::NoRegister) |
| Check for regmask interference only. | |
| bool | checkRegUnitInterference (const LiveInterval &VirtReg, MCRegister PhysReg) |
| Check for regunit interference only. | |
| LiveIntervalUnion::Query & | query (const LiveRange &LR, MCRegUnit RegUnit) |
| Query a line of the assigned virtual register matrix directly. | |
| LiveIntervalUnion * | getLiveUnions () |
| Directly access the live interval unions per regunit. | |
| Register | getOneVReg (unsigned PhysReg) const |
| bool | isValid () const |
| This checks that each LiveInterval referenced in LiveIntervalUnion actually exists in LiveIntervals and is not a dangling pointer. | |
Friends | |
| class | LiveRegMatrixWrapperLegacy |
| class | LiveRegMatrixAnalysis |
Definition at line 40 of file LiveRegMatrix.h.
| Enumerator | |
|---|---|
| IK_Free | No interference, go ahead and assign. |
| IK_VirtReg | Virtual register interference. There are interfering virtual registers assigned to PhysReg or its aliases. This interference could be resolved by unassigning those other virtual registers. |
| IK_RegUnit | Register unit interference. A fixed live range is in the way, typically argument registers for a call. This can't be resolved by unassigning other virtual registers. |
| IK_RegMask | RegMask interference. The live range is crossing an instruction with a regmask operand that doesn't preserve PhysReg. This typically means VirtReg is live across a call, and PhysReg isn't call-preserved. |
Definition at line 84 of file LiveRegMatrix.h.
|
default |
References llvm::Other.
| void LiveRegMatrix::assign | ( | const LiveInterval & | VirtReg, |
| MCRegister | PhysReg ) |
Assign VirtReg to PhysReg.
This will mark VirtReg's live range as occupied in the LiveRegMatrix and update VirtRegMap. The live range is expected to be available in PhysReg.
Definition at line 113 of file LiveRegMatrix.cpp.
References assert(), llvm::dbgs(), foreachUnit(), LLVM_DEBUG, llvm::printReg(), llvm::printRegUnit(), Range, and llvm::LiveInterval::reg().
| LiveRegMatrix::InterferenceKind LiveRegMatrix::checkInterference | ( | const LiveInterval & | VirtReg, |
| MCRegister | PhysReg ) |
Check for interference before assigning VirtReg to PhysReg.
If this function returns IK_Free, it is legal to assign(VirtReg, PhysReg). When there is more than one kind of interference, the InterferenceKind with the highest enum value is returned.
Definition at line 203 of file LiveRegMatrix.cpp.
References llvm::LiveIntervalUnion::Query::checkInterference(), checkRegMaskInterference(), checkRegUnitInterference(), llvm::LiveRange::empty(), foreachUnit(), IK_Free, IK_RegMask, IK_RegUnit, IK_VirtReg, and query().
| bool LiveRegMatrix::checkInterference | ( | SlotIndex | Start, |
| SlotIndex | End, | ||
| MCRegister | PhysReg ) |
Check for interference in the segment [Start, End) that may prevent assignment to PhysReg.
If this function returns true, there is interference in the segment [Start, End) of some other interval already assigned to PhysReg. If this function returns false, PhysReg is free at the segment [Start, End).
Definition at line 227 of file LiveRegMatrix.cpp.
References llvm::LiveRange::addSegment(), llvm::LiveIntervalUnion::Query::checkInterference(), and llvm::LiveIntervalUnion::Query::reset().
| LaneBitmask LiveRegMatrix::checkInterferenceLanes | ( | SlotIndex | Start, |
| SlotIndex | End, | ||
| MCRegister | PhysReg ) |
Check for interference in the segment [Start, End) that may prevent assignment to PhysReg, like checkInterference.
Returns a lane mask of which lanes of the physical register interfere in the segment [Start, End) of some other interval already assigned to PhysReg.
If this function returns LaneBitmask::getNone(), PhysReg is completely free at the segment [Start, End).
Definition at line 257 of file LiveRegMatrix.cpp.
References llvm::LiveRange::addSegment(), llvm::LiveIntervalUnion::Query::checkInterference(), llvm::MCRegUnitMaskIterator::isValid(), and llvm::LiveIntervalUnion::Query::reset().
| bool LiveRegMatrix::checkRegMaskInterference | ( | const LiveInterval & | VirtReg, |
| MCRegister | PhysReg = MCRegister::NoRegister ) |
Check for regmask interference only.
Return true if VirtReg crosses a regmask operand that clobbers PhysReg. If PhysReg is null, check if VirtReg crosses any regmask operands.
Definition at line 162 of file LiveRegMatrix.cpp.
References llvm::MCRegister::id(), and llvm::LiveInterval::reg().
Referenced by checkInterference().
| bool LiveRegMatrix::checkRegUnitInterference | ( | const LiveInterval & | VirtReg, |
| MCRegister | PhysReg ) |
Check for regunit interference only.
Return true if VirtReg overlaps a fixed assignment of one of PhysRegs's register units.
Definition at line 181 of file LiveRegMatrix.cpp.
References llvm::LiveRange::empty(), foreachUnit(), Range, and llvm::LiveInterval::reg().
Referenced by checkInterference().
|
inline |
Directly access the live interval unions per regunit.
This returns an array indexed by the regunit number.
Definition at line 175 of file LiveRegMatrix.h.
Definition at line 292 of file LiveRegMatrix.cpp.
References getOneVReg(), llvm::MCRegister::NoRegister, and llvm::LiveInterval::reg().
Referenced by getOneVReg().
| void LiveRegMatrix::init | ( | MachineFunction & | MF, |
| LiveIntervals & | LIS, | ||
| VirtRegMap & | VRM ) |
Definition at line 62 of file LiveRegMatrix.cpp.
References llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), llvm::VirtRegMap::init(), and invalidateVirtRegs().
Referenced by llvm::LiveRegMatrixAnalysis::run().
|
inline |
Invalidate cached interference queries after modifying virtual register live ranges.
Interference checks may return stale information unless caches are invalidated.
Definition at line 82 of file LiveRegMatrix.h.
Referenced by init().
| bool LiveRegMatrix::isPhysRegUsed | ( | MCRegister | PhysReg | ) | const |
Returns true if the given PhysReg has any live intervals assigned.
Definition at line 154 of file LiveRegMatrix.cpp.
| bool LiveRegMatrix::isValid | ( | ) | const |
This checks that each LiveInterval referenced in LiveIntervalUnion actually exists in LiveIntervals and is not a dangling pointer.
Definition at line 303 of file LiveRegMatrix.cpp.
References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::contains(), llvm::dbgs(), I, llvm::Register::index2VirtReg(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), llvm::printRegUnit(), and Size.
| LiveIntervalUnion::Query & LiveRegMatrix::query | ( | const LiveRange & | LR, |
| MCRegUnit | RegUnit ) |
Query a line of the assigned virtual register matrix directly.
Use MCRegUnitIterator to enumerate all regunits in the desired PhysReg. This returns a reference to an internal Query data structure that is only valid until the next query() call.
Definition at line 195 of file LiveRegMatrix.cpp.
References llvm::LiveIntervalUnion::Query::init().
Referenced by checkInterference().
| void LiveRegMatrix::unassign | ( | const LiveInterval & | VirtReg, |
| bool | ClearAllReferencingSegments = false ) |
Unassign VirtReg from its PhysReg.
Assuming that VirtReg was previously assigned to a PhysReg, this undoes the assignment and updates VirtRegMap accordingly. ClearAllReferencingSegments changes the way segments are removed from the matrix:
Definition at line 130 of file LiveRegMatrix.cpp.
References llvm::dbgs(), foreachUnit(), LLVM_DEBUG, llvm::printReg(), llvm::printRegUnit(), Range, and llvm::LiveInterval::reg().
|
friend |
Definition at line 42 of file LiveRegMatrix.h.
References Allocator, and LiveRegMatrixAnalysis.
Referenced by LiveRegMatrixAnalysis.
|
friend |
Definition at line 41 of file LiveRegMatrix.h.
References LiveRegMatrixWrapperLegacy.
Referenced by LiveRegMatrixWrapperLegacy.