38 #define DEBUG_TYPE "regalloc"
40 STATISTIC(NumStores,
"Number of stores added");
41 STATISTIC(NumLoads ,
"Number of loads added");
42 STATISTIC(NumCopies,
"Number of copies coalesced");
52 isBulkSpilling(
false) {}
73 unsigned short LastOpNum;
77 : LastUse(nullptr), VirtReg(v), PhysReg(0), LastOpNum(0), Dirty(
false){}
79 unsigned getSparseSetIndex()
const {
88 LiveRegMap LiveVirtRegs;
113 std::vector<unsigned> PhysRegState;
120 UsedInInstrSet UsedInInstr;
123 void markRegUsedInInstr(
unsigned PhysReg) {
125 UsedInInstr.
insert(*Units);
129 bool isRegUsedInInstr(
unsigned PhysReg)
const {
131 if (UsedInInstr.count(*Units))
149 spillImpossible = ~0u
152 StringRef getPassName()
const override {
return "Fast Register Allocator"; }
171 void AllocateBasicBlock();
177 void addKillFlag(
const LiveReg&);
178 void killVirtReg(LiveRegMap::iterator);
179 void killVirtReg(
unsigned VirtReg);
184 void definePhysReg(
MachineInstr &
MI,
unsigned PhysReg, RegState NewState);
185 unsigned calcSpillCost(
unsigned PhysReg)
const;
186 void assignVirtToPhysReg(
LiveReg&,
unsigned PhysReg);
187 LiveRegMap::iterator findLiveVirtReg(
unsigned VirtReg) {
190 LiveRegMap::const_iterator findLiveVirtReg(
unsigned VirtReg)
const {
193 LiveRegMap::iterator assignVirtToPhysReg(
unsigned VReg,
unsigned PhysReg);
194 LiveRegMap::iterator allocVirtReg(
MachineInstr &
MI, LiveRegMap::iterator,
196 LiveRegMap::iterator defineVirtReg(
MachineInstr &
MI,
unsigned OpNum,
197 unsigned VirtReg,
unsigned Hint);
198 LiveRegMap::iterator reloadVirtReg(
MachineInstr &
MI,
unsigned OpNum,
199 unsigned VirtReg,
unsigned Hint);
201 bool setPhysReg(
MachineInstr *
MI,
unsigned OpNum,
unsigned PhysReg);
206 INITIALIZE_PASS(RAFast,
"regallocfast",
"Fast Register Allocator",
false,
false)
212 int SS = StackSlotForVirtReg[VirtReg];
217 unsigned Size = TRI->getSpillSize(*RC);
218 unsigned Align = TRI->getSpillAlignment(*RC);
219 int FrameIdx = MF->getFrameInfo().CreateSpillStackObject(Size, Align);
222 StackSlotForVirtReg[VirtReg] = FrameIdx;
232 if (StackSlotForVirtReg[MO.
getReg()] != -1)
239 return ++I ==
MRI->reg_nodbg_end();
243 void RAFast::addKillFlag(
const LiveReg &LR) {
244 if (!LR.LastUse)
return;
246 if (MO.
isUse() && !LR.LastUse->isRegTiedToDefOperand(LR.LastOpNum)) {
247 if (MO.
getReg() == LR.PhysReg)
262 void RAFast::killVirtReg(LiveRegMap::iterator LRI) {
264 assert(PhysRegState[LRI->PhysReg] == LRI->VirtReg &&
265 "Broken RegState mapping");
266 PhysRegState[LRI->PhysReg] = regFree;
269 LiveVirtRegs.erase(LRI);
273 void RAFast::killVirtReg(
unsigned VirtReg) {
275 "killVirtReg needs a virtual register");
276 LiveRegMap::iterator LRI = findLiveVirtReg(VirtReg);
277 if (LRI != LiveVirtRegs.end())
285 "Spilling a physical register is illegal!");
286 LiveRegMap::iterator LRI = findLiveVirtReg(VirtReg);
287 assert(LRI != LiveVirtRegs.end() &&
"Spilling unmapped virtual register");
288 spillVirtReg(MI, LRI);
293 LiveRegMap::iterator LRI) {
295 assert(PhysRegState[LR.PhysReg] == LRI->VirtReg &&
"Broken RegState mapping");
303 <<
" in " <<
PrintReg(LR.PhysReg, TRI));
305 int FI = getStackSpaceFor(LRI->VirtReg, RC);
306 DEBUG(
dbgs() <<
" to stack slot #" << FI <<
"\n");
314 LiveDbgValueMap[LRI->VirtReg];
315 for (
unsigned li = 0, le = LRIDbgValues.
size(); li != le; ++li) {
320 DEBUG(
dbgs() <<
"Inserting debug info due to spill:" <<
"\n" << *NewDV);
325 LRIDbgValues.
clear();
327 LR.LastUse =
nullptr;
334 if (LiveVirtRegs.empty())
return;
335 isBulkSpilling =
true;
338 for (LiveRegMap::iterator i = LiveVirtRegs.begin(), e = LiveVirtRegs.end();
341 LiveVirtRegs.clear();
342 isBulkSpilling =
false;
350 unsigned PhysReg = MO.
getReg();
352 "Bad usePhysReg operand");
358 markRegUsedInInstr(PhysReg);
359 switch (PhysRegState[PhysReg]) {
363 PhysRegState[PhysReg] = regFree;
376 unsigned Alias = *AI;
377 switch (PhysRegState[Alias]) {
390 assert((TRI->isSuperRegister(PhysReg, Alias) ||
391 TRI->isSuperRegister(Alias, PhysReg)) &&
392 "Instruction is not using a subregister of a reserved register");
395 if (TRI->isSuperRegister(PhysReg, Alias)) {
397 PhysRegState[Alias] = regFree;
402 PhysRegState[Alias] = regDisabled;
410 PhysRegState[PhysReg] = regFree;
417 void RAFast::definePhysReg(
MachineInstr &MI,
unsigned PhysReg,
419 markRegUsedInInstr(PhysReg);
420 switch (
unsigned VirtReg = PhysRegState[PhysReg]) {
424 spillVirtReg(MI, VirtReg);
428 PhysRegState[PhysReg] = NewState;
433 PhysRegState[PhysReg] = NewState;
435 unsigned Alias = *AI;
436 switch (
unsigned VirtReg = PhysRegState[Alias]) {
440 spillVirtReg(MI, VirtReg);
444 PhysRegState[Alias] = regDisabled;
445 if (TRI->isSuperRegister(PhysReg, Alias))
458 unsigned RAFast::calcSpillCost(
unsigned PhysReg)
const {
459 if (isRegUsedInInstr(PhysReg)) {
461 return spillImpossible;
463 switch (
unsigned VirtReg = PhysRegState[PhysReg]) {
470 <<
PrintReg(PhysReg, TRI) <<
" is reserved already.\n");
471 return spillImpossible;
473 LiveRegMap::const_iterator I = findLiveVirtReg(VirtReg);
474 assert(I != LiveVirtRegs.end() &&
"Missing VirtReg entry");
475 return I->Dirty ? spillDirty : spillClean;
483 unsigned Alias = *AI;
484 switch (
unsigned VirtReg = PhysRegState[Alias]) {
491 return spillImpossible;
493 LiveRegMap::const_iterator I = findLiveVirtReg(VirtReg);
494 assert(I != LiveVirtRegs.end() &&
"Missing VirtReg entry");
495 Cost += I->Dirty ? spillDirty : spillClean;
508 void RAFast::assignVirtToPhysReg(
LiveReg &LR,
unsigned PhysReg) {
511 PhysRegState[PhysReg] = LR.VirtReg;
512 assert(!LR.PhysReg &&
"Already assigned a physreg");
513 LR.PhysReg = PhysReg;
517 RAFast::assignVirtToPhysReg(
unsigned VirtReg,
unsigned PhysReg) {
518 LiveRegMap::iterator LRI = findLiveVirtReg(VirtReg);
519 assert(LRI != LiveVirtRegs.end() &&
"VirtReg disappeared");
520 assignVirtToPhysReg(*LRI, PhysReg);
526 LiveRegMap::iterator LRI,
528 const unsigned VirtReg = LRI->VirtReg;
531 "Can only allocate virtual registers");
543 unsigned Cost = calcSpillCost(Hint);
544 if (Cost < spillDirty) {
546 definePhysReg(MI, Hint, regFree);
549 return assignVirtToPhysReg(VirtReg, Hint);
557 unsigned PhysReg = *
I;
558 if (PhysRegState[PhysReg] == regFree && !isRegUsedInInstr(PhysReg)) {
559 assignVirtToPhysReg(*LRI, PhysReg);
565 << TRI->getRegClassName(RC) <<
"\n");
567 unsigned BestReg = 0, BestCost = spillImpossible;
569 unsigned Cost = calcSpillCost(*I);
571 DEBUG(
dbgs() <<
"\tCost: " << Cost <<
"\n");
572 DEBUG(
dbgs() <<
"\tBestCost: " << BestCost <<
"\n");
575 assignVirtToPhysReg(*LRI, *I);
579 BestReg = *
I, BestCost = Cost;
583 definePhysReg(MI, BestReg, regFree);
586 return assignVirtToPhysReg(VirtReg, BestReg);
591 MI.
emitError(
"inline assembly requires more registers than available");
593 MI.
emitError(
"ran out of registers during register allocation");
594 definePhysReg(MI, *AO.
begin(), regFree);
595 return assignVirtToPhysReg(VirtReg, *AO.
begin());
604 "Not a virtual register");
605 LiveRegMap::iterator LRI;
607 std::tie(LRI, New) = LiveVirtRegs.insert(
LiveReg(VirtReg));
611 MRI->hasOneNonDBGUse(VirtReg)) {
617 LRI = allocVirtReg(MI, LRI, Hint);
618 }
else if (LRI->LastUse) {
621 if (LRI->LastUse != &MI || LRI->LastUse->
getOperand(LRI->LastOpNum).
isUse())
624 assert(LRI->PhysReg &&
"Register not assigned");
626 LRI->LastOpNum = OpNum;
628 markRegUsedInInstr(LRI->PhysReg);
638 "Not a virtual register");
639 LiveRegMap::iterator LRI;
641 std::tie(LRI, New) = LiveVirtRegs.insert(
LiveReg(VirtReg));
644 LRI = allocVirtReg(MI, LRI, Hint);
646 int FrameIndex = getStackSpaceFor(VirtReg, RC);
648 <<
PrintReg(LRI->PhysReg, TRI) <<
"\n");
651 }
else if (LRI->Dirty) {
652 if (isLastUseOfLocalReg(MO)) {
653 DEBUG(
dbgs() <<
"Killing last use: " << MO <<
"\n");
659 DEBUG(
dbgs() <<
"Clearing dubious kill: " << MO <<
"\n");
662 DEBUG(
dbgs() <<
"Clearing dubious dead: " << MO <<
"\n");
670 DEBUG(
dbgs() <<
"Clearing clean kill: " << MO <<
"\n");
673 DEBUG(
dbgs() <<
"Clearing clean dead: " << MO <<
"\n");
676 assert(LRI->PhysReg &&
"Register not assigned");
678 LRI->LastOpNum = OpNum;
679 markRegUsedInInstr(LRI->PhysReg);
686 bool RAFast::setPhysReg(
MachineInstr *MI,
unsigned OpNum,
unsigned PhysReg) {
717 DEBUG(
dbgs() <<
"Scanning for through registers:");
721 if (!MO.
isReg())
continue;
727 if (ThroughRegs.
insert(Reg).second)
734 DEBUG(
dbgs() <<
"\nChecking for physdef collisions.\n");
738 unsigned Reg = MO.
getReg();
740 markRegUsedInInstr(Reg);
742 if (ThroughRegs.
count(PhysRegState[*AI]))
743 definePhysReg(*MI, *AI, regFree);
748 DEBUG(
dbgs() <<
"Allocating tied uses.\n");
751 if (!MO.
isReg())
continue;
752 unsigned Reg = MO.
getReg();
757 DEBUG(
dbgs() <<
"Operand " << i <<
"("<< MO <<
") is tied to operand "
759 LiveRegMap::iterator LRI = reloadVirtReg(*MI, i, Reg, 0);
760 unsigned PhysReg = LRI->PhysReg;
761 setPhysReg(MI, i, PhysReg);
765 DEBUG(
dbgs() <<
"Partial redefine: " << MO <<
"\n");
768 LiveRegMap::iterator LRI = reloadVirtReg(*MI, i, Reg, 0);
773 DEBUG(
dbgs() <<
"Allocating early clobbers.\n");
776 if (!MO.
isReg())
continue;
777 unsigned Reg = MO.
getReg();
782 LiveRegMap::iterator LRI = defineVirtReg(*MI, i, Reg, 0);
783 unsigned PhysReg = LRI->PhysReg;
784 if (setPhysReg(MI, i, PhysReg))
793 unsigned Reg = MO.
getReg();
796 <<
" as used in instr\n");
797 markRegUsedInInstr(Reg);
801 for (
unsigned i = 0, e = PartialDefs.
size(); i != e; ++i)
802 markRegUsedInInstr(PartialDefs[i]);
805 void RAFast::AllocateBasicBlock() {
806 DEBUG(
dbgs() <<
"\nAllocating " << *MBB);
808 PhysRegState.assign(TRI->getNumRegs(), regDisabled);
809 assert(LiveVirtRegs.empty() &&
"Mapping not cleared from last block?");
814 for (
const auto &LI : MBB->liveins())
815 if (
MRI->isAllocatable(LI.PhysReg))
816 definePhysReg(*MII, LI.PhysReg, regReserved);
822 while (MII != MBB->end()) {
826 dbgs() <<
"\n>> " << *MI <<
"Regs:";
827 for (
unsigned Reg = 1,
E = TRI->getNumRegs(); Reg !=
E; ++
Reg) {
828 if (PhysRegState[Reg] == regDisabled)
continue;
829 dbgs() <<
" " << TRI->getName(Reg);
830 switch(PhysRegState[Reg]) {
838 LiveRegMap::iterator I = findLiveVirtReg(PhysRegState[Reg]);
839 assert(I != LiveVirtRegs.end() &&
"Missing VirtReg entry");
842 assert(I->PhysReg == Reg &&
"Bad inverse map");
849 for (LiveRegMap::iterator i = LiveVirtRegs.begin(),
850 e = LiveVirtRegs.end(); i != e; ++i) {
855 assert(PhysRegState[i->PhysReg] == i->VirtReg &&
"Bad inverse map");
861 bool ScanDbgValue =
true;
862 while (ScanDbgValue) {
863 ScanDbgValue =
false;
866 if (!MO.
isReg())
continue;
867 unsigned Reg = MO.
getReg();
869 LiveRegMap::iterator LRI = findLiveVirtReg(Reg);
870 if (LRI != LiveVirtRegs.end())
871 setPhysReg(MI, i, LRI->PhysReg);
873 int SS = StackSlotForVirtReg[
Reg];
876 DEBUG(
dbgs() <<
"Unable to allocate vreg used by DBG_VALUE");
888 cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
889 "Expected inlined-at fields to agree");
891 TII->get(TargetOpcode::DBG_VALUE))
896 DEBUG(
dbgs() <<
"Modifying debug info due to spill:"
904 LiveDbgValueMap[
Reg].push_back(MI);
912 unsigned CopySrc = 0, CopyDst = 0, CopySrcSub = 0, CopyDstSub = 0;
926 unsigned VirtOpEnd = 0;
927 bool hasTiedOps =
false;
928 bool hasEarlyClobbers =
false;
929 bool hasPartialRedefs =
false;
930 bool hasPhysDefs =
false;
938 if (!MO.
isReg())
continue;
939 unsigned Reg = MO.
getReg();
944 hasTiedOps = hasTiedOps ||
948 hasEarlyClobbers =
true;
950 hasPartialRedefs =
true;
954 if (!
MRI->isAllocatable(Reg))
continue;
958 definePhysReg(*MI, Reg,
960 hasEarlyClobbers =
true;
974 if (MI->
isInlineAsm() || hasEarlyClobbers || hasPartialRedefs ||
975 (hasTiedOps && (hasPhysDefs || MCID.
getNumDefs() > 1))) {
976 handleThroughOperands(MI, VirtDead);
981 hasEarlyClobbers =
true;
986 for (
unsigned i = 0; i != VirtOpEnd; ++i) {
988 if (!MO.
isReg())
continue;
989 unsigned Reg = MO.
getReg();
992 LiveRegMap::iterator LRI = reloadVirtReg(*MI, i, Reg, CopyDst);
993 unsigned PhysReg = LRI->PhysReg;
994 CopySrc = (CopySrc == Reg || CopySrc == PhysReg) ? PhysReg : 0;
995 if (setPhysReg(MI, i, PhysReg))
1002 UsedInInstr.clear();
1003 if (hasEarlyClobbers) {
1006 if (!MO.
isReg())
continue;
1007 unsigned Reg = MO.
getReg();
1011 markRegUsedInInstr(Reg);
1024 DEBUG(
dbgs() <<
" Spilling remaining registers before call.\n");
1029 SkippedInstrs.insert(&MCID);
1034 for (
unsigned i = 0; i != DefOpEnd; ++i) {
1038 unsigned Reg = MO.
getReg();
1041 if (!
MRI->isAllocatable(Reg))
continue;
1042 definePhysReg(*MI, Reg, MO.
isDead() ? regFree : regReserved);
1045 LiveRegMap::iterator LRI = defineVirtReg(*MI, i, Reg, CopySrc);
1046 unsigned PhysReg = LRI->PhysReg;
1047 if (setPhysReg(MI, i, PhysReg)) {
1051 CopyDst = (CopyDst == Reg || CopyDst == PhysReg) ? PhysReg : 0;
1058 for (
unsigned i = 0, e = VirtDead.
size(); i != e; ++i)
1059 killVirtReg(VirtDead[i]);
1062 if (CopyDst && CopyDst == CopySrc && CopyDstSub == CopySrcSub) {
1063 DEBUG(
dbgs() <<
"-- coalescing: " << *MI);
1071 DEBUG(
dbgs() <<
"Spilling live registers at end of block.\n");
1076 for (
unsigned i = 0, e = Coalesced.
size(); i != e; ++i)
1077 MBB->
erase(Coalesced[i]);
1078 NumCopies += Coalesced.
size();
1086 DEBUG(
dbgs() <<
"********** FAST REGISTER ALLOCATION **********\n"
1087 <<
"********** Function: " << Fn.
getName() <<
'\n');
1089 MRI = &MF->getRegInfo();
1090 TRI = MF->getSubtarget().getRegisterInfo();
1091 TII = MF->getSubtarget().getInstrInfo();
1092 MRI->freezeReservedRegs(Fn);
1093 RegClassInfo.runOnMachineFunction(Fn);
1094 UsedInInstr.clear();
1095 UsedInInstr.setUniverse(TRI->getNumRegUnits());
1099 StackSlotForVirtReg.resize(
MRI->getNumVirtRegs());
1100 LiveVirtRegs.setUniverse(
MRI->getNumVirtRegs());
1104 MBBi != MBBe; ++MBBi) {
1106 AllocateBasicBlock();
1111 MRI->clearVirtRegs();
1113 SkippedInstrs.clear();
1114 StackSlotForVirtReg.clear();
1115 LiveDbgValueMap.clear();
1120 return new RAFast();
const MachineInstrBuilder & addMetadata(const MDNode *MD) const
void push_back(const T &Elt)
MachineInstr * getParent()
getParent - Return the instruction that this operand belongs to.
STATISTIC(NumFunctions,"Total number of functions")
static unsigned virtReg2Index(unsigned Reg)
Convert a virtual register number to a 0-based index.
bool isValid() const
isValid - returns true if this iterator is not yet at the end.
std::pair< iterator, bool > insert(const ValueT &Val)
insert - Attempts to insert a new element.
unsigned getNumDefs() const
Return the number of MachineOperands that are register definitions.
void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, unsigned SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const override
Store the specified register of the given register class to the specified stack frame index...
iterator getFirstTerminator()
Returns an iterator to the first terminator instruction of this basic block.
Describe properties that are true of each instruction in the target description file.
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
bool readsVirtualRegister(unsigned Reg) const
Return true if the MachineInstr reads the specified virtual register.
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
void setIsDead(bool Val=true)
void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, unsigned DestReg, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const override
Load the specified register of the given register class from the specified stack frame index...
MachineInstr * buildDbgValueForSpill(MachineBasicBlock &BB, MachineBasicBlock::iterator I, const MachineInstr &Orig, int FrameIndex)
Clone a DBG_VALUE whose value has been spilled to FrameIndex.
instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const HexagonInstrInfo * TII
bool isReg() const
isReg - Tests if this is a MO_Register operand.
Reg
All possible values of the reg field in the ModR/M byte.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
unsigned getNumOperands() const
Access to explicit operands of the instruction.
bool isCopyLike() const
Return true if the instruction behaves like a copy.
RegisterRegAlloc class - Track the registration of register allocators.
Printable PrintReg(unsigned Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubRegIdx=0)
Prints virtual and physical registers with or without a TRI instance.
const MachineBasicBlock * getParent() const
TargetInstrInfo - Interface to description of machine instruction set.
bool isDebugValue() const
bool isEarlyClobber() const
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
Function Alias Analysis false
MachineInstrBundleIterator< MachineInstr > iterator
unsigned const MachineRegisterInfo * MRI
typename DenseT::iterator iterator
MachineInstrBuilder & UseMI
bool isIndirectDebugValue() const
A DBG_VALUE is indirect iff the first operand is a register and the second operand is an immediate...
const MachineOperand & getOperand(unsigned i) const
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
MCRegAliasIterator enumerates all registers aliasing Reg.
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
std::pair< NoneType, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
const DIExpression * getDebugExpression() const
Return the complex address expression referenced by this DBG_VALUE instruction.
unsigned getSubReg() const
Information about a live register.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
void emitError(StringRef Msg) const
Emit an error referring to the source location of this instruction.
int getOperandConstraint(unsigned OpNum, MCOI::OperandConstraint Constraint) const
Returns the value of the specific constraint if it is set.
void setIsKill(bool Val=true)
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
bool isRegMask() const
isRegMask - Tests if this is a MO_RegisterMask operand.
size_type count(const T &V) const
count - Return 1 if the element is in the set, 0 otherwise.
Iterator for intrusive lists based on ilist_node.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
const uint32_t * getRegMask() const
getRegMask - Returns a bit mask of registers preserved by this RegMask operand.
MachineOperand class - Representation of each machine instruction operand.
void setPreservesCFG()
This function should be called by the pass, iff they do not:
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void addRegisterDefined(unsigned Reg, const TargetRegisterInfo *RegInfo=nullptr)
We have determined MI defines a register.
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
llvm_unreachable("Unknown RegBank!")
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
MachineFunctionProperties & set(Property P)
Representation of each machine instruction.
static bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
SparseSet - Fast set implmentation for objects that can be identified by small unsigned keys...
static RegisterRegAlloc fastRegAlloc("fast","fast register allocator", createFastRegisterAllocator)
void setReg(unsigned Reg)
Change the register this operand corresponds to.
bool isCall(QueryType Type=AnyInBundle) const
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
void setSubReg(unsigned subReg)
const DILocalVariable * getDebugVariable() const
Return the debug variable referenced by this DBG_VALUE instruction.
unsigned getReg() const
getReg - Returns the register number.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
FunctionPass * createFastRegisterAllocator()
FastRegisterAllocation Pass - This pass register allocates as fast as possible.
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
bool isRegTiedToDefOperand(unsigned UseOpIdx, unsigned *DefOpIdx=nullptr) const
Return true if the use operand of the specified index is tied to a def operand.
bool addRegisterKilled(unsigned IncomingReg, const TargetRegisterInfo *RegInfo, bool AddIfNotFound=false)
We have determined MI kills a register.
StringRef - Represent a constant reference to a string, i.e.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
reg_begin/reg_end - Provide iteration support to walk over all definitions and uses of a register wit...
Properties which a MachineFunction may have at a given point in time.
bool contains(unsigned Reg) const
Return true if the specified register is included in this register class.