53 #define DEBUG_TYPE "regalloc" 55 STATISTIC(NumStores,
"Number of stores added");
56 STATISTIC(NumLoads ,
"Number of loads added");
57 STATISTIC(NumCoalesced,
"Number of copies coalesced");
88 unsigned short LastOpNum = 0;
91 explicit LiveReg(
Register VirtReg) : VirtReg(VirtReg) {}
93 unsigned getSparseSetIndex()
const {
101 LiveRegMap LiveVirtRegs;
130 std::vector<unsigned> PhysRegState;
138 RegUnitSet UsedInInstr;
140 void setPhysRegState(
MCPhysReg PhysReg,
unsigned NewState);
143 void markRegUsedInInstr(
MCPhysReg PhysReg) {
145 UsedInInstr.insert(*Units);
149 bool isRegUsedInInstr(
MCPhysReg PhysReg)
const {
151 if (UsedInInstr.count(*Units))
160 spillImpossible = ~0u
164 StringRef getPassName()
const override {
return "Fast Register Allocator"; }
191 void addKillFlag(
const LiveReg &LRI);
192 void killVirtReg(LiveReg &LR);
200 unsigned calcSpillCost(
MCPhysReg PhysReg)
const;
201 void assignVirtToPhysReg(LiveReg &,
MCPhysReg PhysReg);
203 LiveRegMap::iterator findLiveVirtReg(
Register VirtReg) {
207 LiveRegMap::const_iterator findLiveVirtReg(
Register VirtReg)
const {
223 int getStackSpaceFor(
Register VirtReg);
242 void RegAllocFast::setPhysRegState(
MCPhysReg PhysReg,
unsigned NewState) {
243 PhysRegState[PhysReg] = NewState;
248 int RegAllocFast::getStackSpaceFor(
Register VirtReg) {
250 int SS = StackSlotForVirtReg[VirtReg];
262 StackSlotForVirtReg[VirtReg] = FrameIdx;
267 bool RegAllocFast::mayLiveOut(
Register VirtReg) {
282 static const unsigned Limit = 8;
285 if (UseInst.getParent() != MBB || ++C >= Limit) {
296 bool RegAllocFast::mayLiveIn(
Register VirtReg) {
301 static const unsigned Limit = 8;
304 if (DefInst.getParent() != MBB || ++C >= Limit) {
318 <<
" in " <<
printReg(AssignedReg, TRI));
319 int FI = getStackSpaceFor(VirtReg);
334 LLVM_DEBUG(
dbgs() <<
"Inserting debug info due to spill:\n" << *NewDV);
339 LRIDbgValues.clear();
347 int FI = getStackSpaceFor(VirtReg);
355 bool RegAllocFast::isLastUseOfLocalReg(
const MachineOperand &MO)
const {
358 if (StackSlotForVirtReg[MO.
getReg()] != -1)
369 void RegAllocFast::addKillFlag(
const LiveReg &LR) {
370 if (!LR.LastUse)
return;
372 if (MO.
isUse() && !LR.LastUse->isRegTiedToDefOperand(LR.LastOpNum)) {
373 if (MO.
getReg() == LR.PhysReg)
388 void RegAllocFast::killVirtReg(LiveReg &LR) {
390 assert(PhysRegState[LR.PhysReg] == LR.VirtReg &&
391 "Broken RegState mapping");
392 setPhysRegState(LR.PhysReg, regFree);
397 void RegAllocFast::killVirtReg(
Register VirtReg) {
399 "killVirtReg needs a virtual register");
400 LiveRegMap::iterator LRI = findLiveVirtReg(VirtReg);
401 if (LRI != LiveVirtRegs.end() && LRI->PhysReg)
410 "Spilling a physical register is illegal!");
411 LiveRegMap::iterator LRI = findLiveVirtReg(VirtReg);
412 assert(LRI != LiveVirtRegs.end() && LRI->PhysReg &&
413 "Spilling unmapped virtual register");
414 spillVirtReg(MI, *LRI);
419 assert(PhysRegState[LR.PhysReg] == LR.VirtReg &&
"Broken RegState mapping");
427 spill(MI, LR.VirtReg, LR.PhysReg, SpillKill);
430 LR.LastUse =
nullptr;
437 if (LiveVirtRegs.empty())
441 for (LiveReg &LR : LiveVirtRegs) {
444 if (OnlyLiveOut && !mayLiveOut(LR.VirtReg))
446 spillVirtReg(MI, LR);
448 LiveVirtRegs.clear();
462 markRegUsedInInstr(PhysReg);
463 switch (PhysRegState[PhysReg]) {
467 PhysRegState[PhysReg] = regFree;
481 switch (PhysRegState[Alias]) {
496 "Instruction is not using a subregister of a reserved register");
501 setPhysRegState(Alias, regFree);
506 setPhysRegState(Alias, regDisabled);
514 setPhysRegState(PhysReg, regFree);
523 markRegUsedInInstr(PhysReg);
524 switch (
Register VirtReg = PhysRegState[PhysReg]) {
528 spillVirtReg(MI, VirtReg);
532 setPhysRegState(PhysReg, NewState);
537 setPhysRegState(PhysReg, NewState);
540 switch (
Register VirtReg = PhysRegState[Alias]) {
544 spillVirtReg(MI, VirtReg);
548 setPhysRegState(Alias, regDisabled);
560 unsigned RegAllocFast::calcSpillCost(
MCPhysReg PhysReg)
const {
561 if (isRegUsedInInstr(PhysReg)) {
563 <<
" is already used in instr.\n");
564 return spillImpossible;
566 switch (
Register VirtReg = PhysRegState[PhysReg]) {
573 <<
printReg(PhysReg, TRI) <<
" is reserved already.\n");
574 return spillImpossible;
576 LiveRegMap::const_iterator LRI = findLiveVirtReg(VirtReg);
577 assert(LRI != LiveVirtRegs.end() && LRI->PhysReg &&
578 "Missing VirtReg entry");
579 return LRI->Dirty ? spillDirty : spillClean;
588 switch (
Register VirtReg = PhysRegState[Alias]) {
595 return spillImpossible;
597 LiveRegMap::const_iterator LRI = findLiveVirtReg(VirtReg);
598 assert(LRI != LiveVirtRegs.end() && LRI->PhysReg &&
599 "Missing VirtReg entry");
600 Cost += LRI->Dirty ? spillDirty : spillClean;
611 void RegAllocFast::assignVirtToPhysReg(LiveReg &LR,
MCPhysReg PhysReg) {
615 assert(LR.PhysReg == 0 &&
"Already assigned a physreg");
616 assert(PhysReg != 0 &&
"Trying to assign no register");
617 LR.PhysReg = PhysReg;
618 setPhysRegState(PhysReg, VirtReg);
626 static const unsigned ChainLengthLimit = 3;
636 Reg = VRegDef->getOperand(1).getReg();
637 }
while (++C <= ChainLengthLimit);
645 static const unsigned DefLimit = 3;
649 Register Reg = MI.getOperand(1).getReg();
650 Reg = traceCopyChain(Reg);
663 const Register VirtReg = LR.VirtReg;
666 "Can only allocate virtual registers");
671 <<
" with hint " <<
printReg(Hint0, TRI) <<
'\n');
677 unsigned Cost = calcSpillCost(Hint0);
678 if (Cost < spillDirty) {
682 definePhysReg(MI, Hint0, regFree);
683 assignVirtToPhysReg(LR, Hint0);
694 Register Hint1 = traceCopies(VirtReg);
696 RC.
contains(Hint1) && !isRegUsedInInstr(Hint1)) {
698 unsigned Cost = calcSpillCost(Hint1);
699 if (Cost < spillDirty) {
703 definePhysReg(MI, Hint1, regFree);
704 assignVirtToPhysReg(LR, Hint1);
715 unsigned BestCost = spillImpossible;
717 for (
MCPhysReg PhysReg : AllocationOrder) {
719 unsigned Cost = calcSpillCost(PhysReg);
720 LLVM_DEBUG(
dbgs() <<
"Cost: " << Cost <<
" BestCost: " << BestCost <<
'\n');
723 assignVirtToPhysReg(LR, PhysReg);
727 if (PhysReg == Hint1 || PhysReg == Hint0)
728 Cost -= spillPrefBonus;
730 if (Cost < BestCost) {
740 MI.
emitError(
"inline assembly requires more registers than available");
742 MI.
emitError(
"ran out of registers during register allocation");
743 definePhysReg(MI, *AllocationOrder.begin(), regFree);
744 assignVirtToPhysReg(LR, *AllocationOrder.begin());
748 definePhysReg(MI, BestReg, regFree);
749 assignVirtToPhysReg(LR, BestReg);
757 LiveRegMap::const_iterator LRI = findLiveVirtReg(VirtReg);
759 if (LRI != LiveVirtRegs.end() && LRI->PhysReg) {
760 PhysReg = LRI->PhysReg;
764 assert(!AllocationOrder.
empty() &&
"Allocation order must not be empty");
765 PhysReg = AllocationOrder[0];
769 if (SubRegIdx != 0) {
770 PhysReg = TRI->
getSubReg(PhysReg, SubRegIdx);
781 LiveRegMap::iterator LRI;
783 std::tie(LRI, New) = LiveVirtRegs.insert(LiveReg(VirtReg));
793 allocVirtReg(MI, *LRI, Hint);
794 }
else if (LRI->LastUse) {
797 if (LRI->LastUse != &MI || LRI->LastUse->
getOperand(LRI->LastOpNum).
isUse())
800 assert(LRI->PhysReg &&
"Register not assigned");
802 LRI->LastOpNum = OpNum;
804 markRegUsedInInstr(LRI->PhysReg);
809 RegAllocFast::LiveReg &RegAllocFast::reloadVirtReg(
MachineInstr &MI,
814 LiveRegMap::iterator LRI;
816 std::tie(LRI, New) = LiveVirtRegs.insert(LiveReg(VirtReg));
819 allocVirtReg(MI, *LRI, Hint);
820 reload(MI, VirtReg, LRI->PhysReg);
821 }
else if (LRI->Dirty) {
822 if (isLastUseOfLocalReg(MO)) {
846 assert(LRI->PhysReg &&
"Register not assigned");
848 LRI->LastOpNum = OpNum;
849 markRegUsedInInstr(LRI->PhysReg);
887 void RegAllocFast::handleThroughOperands(
MachineInstr &MI,
892 if (!MO.
isReg())
continue;
898 if (ThroughRegs.
insert(Reg).second)
911 markRegUsedInInstr(Reg);
913 if (ThroughRegs.
count(PhysRegState[*AI]))
914 definePhysReg(MI, *AI, regFree);
922 if (!MO.
isReg())
continue;
927 if (!MO.
isTied())
continue;
931 LiveReg &LR = reloadVirtReg(MI,
I, Reg, 0);
933 setPhysReg(MI, MO, PhysReg);
940 LiveReg &LR = reloadVirtReg(MI,
I, Reg, 0);
948 if (!MO.
isReg())
continue;
955 MCPhysReg PhysReg = defineVirtReg(MI,
I, Reg, 0);
968 <<
" as used in instr\n");
969 markRegUsedInInstr(Reg);
973 for (
Register PartialDef : PartialDefs)
974 markRegUsedInInstr(PartialDef);
978 void RegAllocFast::dumpState() {
980 if (PhysRegState[Reg] == regDisabled)
continue;
982 switch(PhysRegState[Reg]) {
990 LiveRegMap::iterator LRI = findLiveVirtReg(PhysRegState[Reg]);
991 assert(LRI != LiveVirtRegs.end() && LRI->PhysReg &&
992 "Missing VirtReg entry");
995 assert(LRI->PhysReg == Reg &&
"Bad inverse map");
1002 for (LiveRegMap::iterator i = LiveVirtRegs.begin(),
1003 e = LiveVirtRegs.end(); i !=
e; ++i) {
1006 assert(i->VirtReg.isVirtual() &&
"Bad map key");
1008 assert(PhysRegState[i->PhysReg] == i->VirtReg &&
"Bad inverse map");
1013 void RegAllocFast::allocateInstruction(
MachineInstr &MI) {
1019 unsigned CopySrcSub = 0;
1020 unsigned CopyDstSub = 0;
1029 UsedInInstr.clear();
1034 unsigned VirtOpEnd = 0;
1035 bool hasTiedOps =
false;
1036 bool hasEarlyClobbers =
false;
1037 bool hasPartialRedefs =
false;
1038 bool hasPhysDefs =
false;
1046 if (!MO.
isReg())
continue;
1052 hasTiedOps = hasTiedOps ||
1056 hasEarlyClobbers =
true;
1058 hasPartialRedefs =
true;
1066 definePhysReg(MI, Reg,
1068 hasEarlyClobbers =
true;
1082 if (MI.
isInlineAsm() || hasEarlyClobbers || hasPartialRedefs ||
1083 (hasTiedOps && (hasPhysDefs || MCID.
getNumDefs() > 1))) {
1084 handleThroughOperands(MI, VirtDead);
1089 hasEarlyClobbers =
true;
1094 bool HasUndefUse =
false;
1095 for (
unsigned I = 0;
I != VirtOpEnd; ++
I) {
1097 if (!MO.
isReg())
continue;
1112 LiveReg &LR = reloadVirtReg(MI,
I, Reg, CopyDstReg);
1114 CopySrcReg = (CopySrcReg == Reg || CopySrcReg == PhysReg) ? PhysReg : 0;
1115 if (setPhysReg(MI, MO, PhysReg))
1131 assert(MO.
isUndef() &&
"Should only have undef virtreg uses left");
1132 allocVirtRegUndef(MO);
1138 UsedInInstr.clear();
1139 if (hasEarlyClobbers) {
1141 if (!MO.
isReg())
continue;
1147 markRegUsedInInstr(Reg);
1160 LLVM_DEBUG(
dbgs() <<
" Spilling remaining registers before call.\n");
1161 spillAll(MI,
false);
1166 for (
unsigned I = 0;
I != DefOpEnd; ++
I) {
1174 definePhysReg(MI, Reg, MO.
isDead() ? regFree : regReserved);
1179 for (
unsigned I = 0;
I != DefOpEnd; ++
I) {
1188 MCPhysReg PhysReg = defineVirtReg(MI,
I, Reg, CopySrcReg);
1193 CopyDstReg = (CopyDstReg == Reg || CopyDstReg == PhysReg) ? PhysReg : 0;
1201 killVirtReg(VirtReg);
1205 if (CopyDstReg && CopyDstReg == CopySrcReg && CopyDstSub == CopySrcSub) {
1211 void RegAllocFast::handleDebugValue(
MachineInstr &MI) {
1224 LiveRegMap::iterator LRI = findLiveVirtReg(Reg);
1225 if (LRI != LiveVirtRegs.end() && LRI->PhysReg) {
1226 setPhysReg(MI, MO, LRI->PhysReg);
1228 int SS = StackSlotForVirtReg[
Reg];
1232 LLVM_DEBUG(
dbgs() <<
"Modifying debug info due to spill:" <<
"\t" << MI);
1237 LLVM_DEBUG(
dbgs() <<
"Unable to allocate vreg used by DBG_VALUE");
1243 LiveDbgValueMap[
Reg].push_back(&MI);
1250 PhysRegState.assign(TRI->
getNumRegs(), regDisabled);
1251 assert(LiveVirtRegs.empty() &&
"Mapping not cleared from last block?");
1258 definePhysReg(MII, LI.PhysReg, regReserved);
1266 dbgs() <<
"\n>> " << MI <<
"Regs:";
1273 handleDebugValue(MI);
1277 allocateInstruction(MI);
1281 LLVM_DEBUG(
dbgs() <<
"Spilling live registers at end of block.\n");
1282 spillAll(MBB.getFirstTerminator(),
true);
1288 NumCoalesced += Coalesced.size();
1294 LLVM_DEBUG(
dbgs() <<
"********** FAST REGISTER ALLOCATION **********\n" 1295 <<
"********** Function: " << MF.
getName() <<
'\n');
1301 MRI->freezeReservedRegs(MF);
1303 UsedInInstr.clear();
1308 unsigned NumVirtRegs = MRI->getNumVirtRegs();
1309 StackSlotForVirtReg.
resize(NumVirtRegs);
1310 LiveVirtRegs.setUniverse(NumVirtRegs);
1311 MayLiveAcrossBlocks.
clear();
1312 MayLiveAcrossBlocks.
resize(NumVirtRegs);
1316 allocateBasicBlock(MBB);
1320 MRI->clearVirtRegs();
1322 StackSlotForVirtReg.
clear();
1323 LiveDbgValueMap.
clear();
1328 return new RegAllocFast();
void resize(unsigned N, bool t=false)
resize - Grow or shrink the bitvector.
bool isRegMask() const
isRegMask - Tests if this is a MO_RegisterMask operand.
static bool isCoalescable(const MachineInstr &MI)
ArrayRef< MCPhysReg > getOrder(const TargetRegisterClass *RC) const
getOrder - Returns the preferred allocation order for RC.
iterator_range< reg_instr_nodbg_iterator > reg_nodbg_instructions(unsigned Reg) const
MachineInstr * getParent()
getParent - Return the instruction that this operand belongs to.
bool contains(unsigned Reg) const
Return true if the specified register is included in this register class.
bool isCall(QueryType Type=AnyInBundle) const
static unsigned virtReg2Index(unsigned Reg)
Convert a virtual register number to a 0-based index.
void emitError(StringRef Msg) const
Emit an error referring to the source location of this instruction.
bool isAllocatable(unsigned PhysReg) const
isAllocatable - Returns true when PhysReg belongs to an allocatable register class and it hasn't been...
This class represents lattice values for constants.
iterator_range< mop_iterator > uses()
Returns a range that includes all operands that are register uses.
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
void push_back(const T &Elt)
static bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
Describe properties that are true of each instruction in the target description file.
unsigned getSubReg() const
bool test(unsigned Idx) const
bool readsVirtualRegister(Register Reg) const
Return true if the MachineInstr reads the specified virtual register.
STATISTIC(NumFunctions, "Total number of functions")
unsigned const TargetRegisterInfo * TRI
void setIsDead(bool Val=true)
Printable printReg(Register Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubIdx=0, const MachineRegisterInfo *MRI=nullptr)
Prints virtual and physical registers with or without a TRI instance.
iterator_range< mop_iterator > operands()
bool isCopyLike() const
Return true if the instruction behaves like a copy.
void setIsRenamable(bool Val=true)
unsigned getNumRegUnits() const
Return the number of (native) register units in the target.
unsigned getSpillSize(const TargetRegisterClass &RC) const
Return the size in bytes of the stack slot allocated to hold a spilled copy of a register from class ...
const TargetRegisterClass * getRegClass(Register Reg) const
Return the register class of the specified virtual register.
bool isEarlyClobber() const
const char * getRegClassName(const TargetRegisterClass *Class) const
Returns the name of the register class.
unsigned getSpillAlignment(const TargetRegisterClass &RC) const
Return the minimum required alignment in bytes for a spill slot for a register of this class...
void clear()
clear - Removes all bits from the bitvector. Does not change capacity.
MachineInstr * buildDbgValueForSpill(MachineBasicBlock &BB, MachineBasicBlock::iterator I, const MachineInstr &Orig, int FrameIndex)
Clone a DBG_VALUE whose value has been spilled to FrameIndex.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const HexagonInstrInfo * TII
unsigned getNumOperands() const
Retuns the total number of operands.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
bool addRegisterKilled(Register IncomingReg, const TargetRegisterInfo *RegInfo, bool AddIfNotFound=false)
We have determined MI kills a register.
Register getSubReg(MCRegister Reg, unsigned Idx) const
Returns the physical register number of sub-register "Index" for physical register RegNo...
bool isPhysical() const
Return true if the specified register number is in the physical register namespace.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
bool isVirtual() const
Return true if the specified register number is in the virtual register namespace.
void setReg(Register Reg)
Change the register this operand corresponds to.
virtual const TargetInstrInfo * getInstrInfo() const
int CreateSpillStackObject(uint64_t Size, Align Alignment)
Create a new statically sized stack object that represents a spill slot, returning a nonnegative iden...
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
TargetInstrInfo - Interface to description of machine instruction set.
unsigned getNumRegs() const
Return the number of registers this target has (useful for sizing arrays holding per register informa...
MachineInstrBundleIterator< MachineInstr > iterator
unsigned const MachineRegisterInfo * MRI
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
MachineInstrBuilder & UseMI
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
MCRegAliasIterator enumerates all registers aliasing Reg.
Represent the analysis usage information of a pass.
void resize(typename StorageT::size_type s)
FunctionPass class - This class is used to implement most global optimizations.
bool isSuperRegister(MCRegister RegA, MCRegister RegB) const
Returns true if RegB is a super-register of RegA.
std::pair< NoneType, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
void runOnMachineFunction(const MachineFunction &MF)
runOnFunction - Prepare to answer questions about MF.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This struct is a compact representation of a valid (non-zero power of two) alignment.
void setIsKill(bool Val=true)
int getOperandConstraint(unsigned OpNum, MCOI::OperandConstraint Constraint) const
Returns the value of the specific constraint if it is set.
unsigned findTiedOperandIdx(unsigned OpIdx) const
Given the index of a tied register operand, find the operand it is tied to.
bool isDebugValue() const
MachineOperand class - Representation of each machine instruction operand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
static RegisterRegAlloc fastRegAlloc("fast", "fast register allocator", createFastRegisterAllocator)
Promote Memory to Register
void updateDbgValueForSpill(MachineInstr &Orig, int FrameIndex)
Update a DBG_VALUE whose value has been spilled to FrameIndex.
unsigned getNumDefs() const
Return the number of MachineOperands that are register definitions.
void setPreservesCFG()
This function should be called by the pass, iff they do not:
MachineInstr * getUniqueVRegDef(unsigned Reg) const
getUniqueVRegDef - Return the unique machine instr that defines the specified virtual register or nul...
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
const uint32_t * getRegMask() const
getRegMask - Returns a bit mask of registers preserved by this RegMask operand.
bool isValid() const
isValid - returns true if this iterator is not yet at the end.
virtual void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const
Store the specified register of the given register class to the specified stack frame index...
const MachineBasicBlock * getParent() const
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
MachineFunctionProperties & set(Property P)
TargetSubtargetInfo - Generic base class for all target subtargets.
Representation of each machine instruction.
reg_nodbg_iterator reg_nodbg_begin(Register RegNo) const
SparseSet - Fast set implmentation for objects that can be identified by small unsigned keys...
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
INITIALIZE_PASS(RegAllocFast, "regallocfast", "Fast Register Allocator", false, false) void RegAllocFast
Pair of physical register and lane mask.
void setSubReg(unsigned subReg)
void addPhysRegsUsedFromRegMask(const uint32_t *RegMask)
addPhysRegsUsedFromRegMask - Mark any registers not in RegMask as used.
bool isSuccessor(const MachineBasicBlock *MBB) const
Return true if the specified MBB is a successor of this block.
bool hasOneNonDBGUse(unsigned RegNo) const
hasOneNonDBGUse - Return true if there is exactly one non-Debug use of the specified register...
iterator_range< livein_iterator > liveins() const
bool isReg() const
isReg - Tests if this is a MO_Register operand.
static reg_nodbg_iterator reg_nodbg_end()
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
FunctionPass * createFastRegisterAllocator()
FastRegisterAllocation Pass - This pass register allocates as fast as possible.
use_instr_nodbg_iterator use_instr_nodbg_begin(unsigned RegNo) const
void addRegisterDefined(Register Reg, const TargetRegisterInfo *RegInfo=nullptr)
We have determined MI defines a register.
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
iterator_range< def_instr_iterator > def_instructions(unsigned Reg) const
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
StringRef - Represent a constant reference to a string, i.e.
Register getReg() const
getReg - Returns the register number.
const MachineOperand & getOperand(unsigned i) const
reg_begin/reg_end - Provide iteration support to walk over all definitions and uses of a register wit...
virtual void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const
Load the specified register of the given register class from the specified stack frame index...
Properties which a MachineFunction may have at a given point in time.
Wrapper class representing virtual and physical registers.
bool empty() const
empty - Check if the array is empty.
size_type count(const T &V) const
count - Return 1 if the element is in the set, 0 otherwise.