14 #define DEBUG_TYPE "regalloc"
28 STATISTIC(NumAssigned ,
"Number of registers assigned");
29 STATISTIC(NumUnassigned ,
"Number of registers unassigned");
33 "Live Register Matrix",
false,
false)
40 UserTag(0), RegMaskTag(0), RegMaskVirtReg(0) {}
42 void LiveRegMatrix::getAnalysisUsage(
AnalysisUsage &AU)
const {
52 LIS = &getAnalysis<LiveIntervals>();
53 VRM = &getAnalysis<VirtRegMap>();
56 if (NumRegUnits != Matrix.
size())
58 Matrix.
init(LIUAlloc, NumRegUnits);
65 void LiveRegMatrix::releaseMemory() {
66 for (
unsigned i = 0, e = Matrix.
size(); i != e; ++i) {
74 <<
" to " <<
PrintReg(PhysReg, TRI) <<
':');
75 assert(!VRM->hasPhys(VirtReg.
reg) &&
"Duplicate VirtReg assignment");
76 VRM->assignVirt2Phys(VirtReg.
reg, PhysReg);
80 Matrix[*Units].unify(VirtReg);
87 unsigned PhysReg = VRM->getPhys(VirtReg.
reg);
89 <<
" from " <<
PrintReg(PhysReg, TRI) <<
':');
90 VRM->clearVirt(VirtReg.
reg);
93 Matrix[*Units].extract(VirtReg);
104 if (RegMaskVirtReg != VirtReg.
reg || RegMaskTag != UserTag) {
105 RegMaskVirtReg = VirtReg.
reg;
106 RegMaskTag = UserTag;
107 RegMaskUsable.
clear();
114 return !RegMaskUsable.
empty() && (!PhysReg || !RegMaskUsable.
test(PhysReg));
133 Q.
init(UserTag, &VirtReg, &Matrix[RegUnit]);
void setPhysRegUsed(unsigned Reg)
No interference, go ahead and assign.
bool isValid() const
isValid - returns true if this iterator is not yet at the end.
InterferenceKind checkInterference(LiveInterval &VirtReg, unsigned PhysReg)
void init(unsigned UTag, LiveInterval *VReg, LiveIntervalUnion *LIU)
bool checkRegMaskInterference(LiveInterval &LI, BitVector &UsableRegs)
#define INITIALIZE_PASS_DEPENDENCY(depName)
void clear()
clear - Clear all bits.
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
ID
LLVM Calling Convention Representation.
void assign(LiveInterval &VirtReg, unsigned PhysReg)
void invalidateVirtRegs()
SlotIndexes * getSlotIndexes() const
bool empty() const
empty - Tests whether there are no bits in this bitvector.
bool overlaps(const LiveRange &other) const
void unassign(LiveInterval &VirtReg)
bool test(unsigned Idx) const
bool checkRegUnitInterference(LiveInterval &VirtReg, unsigned PhysReg)
void init(LiveIntervalUnion::Allocator &, unsigned Size)
Promote Memory to Register
raw_ostream & dbgs()
dbgs - Return a circular-buffered debug stream.
STATISTIC(NumAssigned,"Number of registers assigned")
unsigned getNumRegUnits() const
Return the number of (native) register units in the target. Register units are numbered from 0 to get...
MachineRegisterInfo & getRegInfo()
virtual void getAnalysisUsage(AnalysisUsage &AU) const
const TargetMachine & getTarget() const
virtual const TargetRegisterInfo * getRegisterInfo() const
AnalysisUsage & addRequiredTransitive()
LiveIntervalUnion::Query & query(LiveInterval &VirtReg, unsigned RegUnit)
bool checkRegMaskInterference(LiveInterval &VirtReg, unsigned PhysReg=0)
LiveRange & getRegUnit(unsigned Unit)
INITIALIZE_PASS_BEGIN(LiveRegMatrix,"liveregmatrix","Live Register Matrix", false, false) INITIALIZE_PASS_END(LiveRegMatrix