30 #define DEBUG_TYPE "twoaddrinstr"
54 STATISTIC(NumTwoAddressInstrs,
"Number of two-address instructions");
55 STATISTIC(NumCommuted ,
"Number of instructions commuted to coalesce");
56 STATISTIC(NumAggrCommuted ,
"Number of instructions aggressively commuted");
57 STATISTIC(NumConvertedTo3Addr,
"Number of instructions promoted to 3-address");
58 STATISTIC(Num3AddrSunk,
"Number of 3-address instructions sunk");
59 STATISTIC(NumReSchedUps,
"Number of instructions re-scheduled up");
60 STATISTIC(NumReSchedDowns,
"Number of instructions re-scheduled down");
65 cl::desc(
"Coalesce copies by rescheduling (default=true)"),
103 bool noUseAfterLastDef(
unsigned Reg,
unsigned Dist,
unsigned &LastDef);
105 bool isProfitableToCommute(
unsigned regA,
unsigned regB,
unsigned regC,
109 unsigned RegB,
unsigned RegC,
unsigned Dist);
111 bool isProfitableToConv3Addr(
unsigned RegA,
unsigned RegB);
115 unsigned RegA,
unsigned RegB,
unsigned Dist);
128 unsigned SrcIdx,
unsigned DstIdx,
129 unsigned Dist,
bool shouldOnlyCommute);
131 void scanUses(
unsigned DstReg);
138 void processTiedPairs(
MachineInstr *
MI, TiedPairList&,
unsigned &Dist);
165 "Two-Address instruction pass",
false,
false)
168 "Two-Address instruction
pass",
false, false)
178 bool TwoAddressInstructionPass::
179 sink3AddrInstruction(
MachineInstr *MI,
unsigned SavedReg,
186 bool SeenStore =
true;
187 if (!MI->isSafeToMove(
TII, AA, SeenStore))
193 for (
unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
197 unsigned MOReg = MO.
getReg();
200 if (MO.
isUse() && MOReg != SavedReg)
218 "Reg should not have empty live interval.");
222 if (I != LI.
end() && I->start < MBBEndIdx)
226 KillMI = LIS->getInstructionFromIndex(I->end);
230 UI =
MRI->use_nodbg_begin(SavedReg),
231 UE =
MRI->use_nodbg_end(); UI != UE; ++UI) {
243 if (!KillMI || KillMI->
getParent() != MBB || KillMI == MI ||
257 unsigned NumVisited = 0;
266 for (
unsigned i = 0, e = OtherMI->
getNumOperands(); i != e; ++i) {
270 unsigned MOReg = MO.
getReg();
277 if (OtherMI == KillMI && MOReg == SavedReg)
281 else if (UseRegs.
count(MOReg))
287 assert(KillMO &&
"Didn't find kill");
292 KillMO = MI->findRegisterUseOperand(SavedReg,
false, TRI);
296 LV->replaceKillInstruction(SavedReg, KillMI, MI);
301 MBB->insert(KillPos, MI);
314 bool TwoAddressInstructionPass::noUseAfterLastDef(
unsigned Reg,
unsigned Dist,
317 unsigned LastUse = Dist;
319 E =
MRI->reg_end();
I != E; ++
I) {
325 if (DI == DistanceMap.
end())
327 if (MO.
isUse() && DI->second < LastUse)
328 LastUse = DI->second;
329 if (MO.
isDef() && DI->second > LastDef)
330 LastDef = DI->second;
333 return !(LastUse > LastDef && LastUse < Dist);
340 unsigned &SrcReg,
unsigned &DstReg,
341 bool &IsSrcPhys,
bool &IsDstPhys) {
378 assert(I != LI.
end() &&
"Reg must be live-in to use.");
406 bool allowFalsePositives) {
411 (allowFalsePositives || MRI->
hasOneUse(Reg)))
423 bool IsSrcPhys, IsDstPhys;
424 unsigned SrcReg, DstReg;
427 if (!
isCopyToReg(*DefMI, TII, SrcReg, DstReg, IsSrcPhys, IsDstPhys))
436 for (
unsigned i = 0, NumOps = MI.
getNumOperands(); i != NumOps; ++i) {
456 unsigned &DstReg,
bool &IsDstPhys) {
465 if (
isCopyToReg(UseMI, TII, SrcReg, DstReg, IsSrcPhys, IsDstPhys)) {
483 if (SI == RegMap.
end())
507 TwoAddressInstructionPass::
508 isProfitableToCommute(
unsigned regA,
unsigned regB,
unsigned regC,
551 return !BComp && CComp;
556 unsigned LastDefC = 0;
557 if (!noUseAfterLastDef(regC, Dist, LastDefC))
562 unsigned LastDefB = 0;
563 if (!noUseAfterLastDef(regB, Dist, LastDefB))
568 return LastDefB && LastDefC && LastDefC > LastDefB;
574 bool TwoAddressInstructionPass::
576 unsigned RegB,
unsigned RegC,
unsigned Dist) {
578 DEBUG(
dbgs() <<
"2addr: COMMUTING : " << *MI);
582 DEBUG(
dbgs() <<
"2addr: COMMUTING FAILED!\n");
586 DEBUG(
dbgs() <<
"2addr: COMMUTED TO: " << *NewMI);
587 assert(NewMI == MI &&
588 "TargetInstrInfo::commuteInstruction() should not return a new "
589 "instruction unless it was requested.");
595 SrcRegMap[RegA] = FromRegC;
604 TwoAddressInstructionPass::isProfitableToConv3Addr(
unsigned RegA,
unsigned RegB){
623 unsigned RegA,
unsigned RegB,
628 assert(MBB == MFI &&
"convertToThreeAddress changed iterator reference");
632 DEBUG(
dbgs() <<
"2addr: CONVERTING 2-ADDR: " << *mi);
633 DEBUG(
dbgs() <<
"2addr: TO 3-ADDR: " << *NewMI);
637 LIS->ReplaceMachineInstrInMaps(mi, NewMI);
643 Sunk = sink3AddrInstruction(NewMI, RegB, mi);
648 DistanceMap.insert(std::make_pair(NewMI, Dist));
654 SrcRegMap.erase(RegA);
655 DstRegMap.erase(RegB);
662 TwoAddressInstructionPass::scanUses(
unsigned DstReg) {
667 unsigned Reg = DstReg;
669 NewReg, IsDstPhys)) {
670 if (IsCopy && !Processed.insert(UseMI))
674 if (DI != DistanceMap.
end())
682 bool isNew = SrcRegMap.insert(std::make_pair(NewReg, Reg)).second;
684 assert(SrcRegMap[NewReg] == Reg &&
"Can't map to two src registers!");
689 if (!VirtRegPairs.
empty()) {
690 unsigned ToReg = VirtRegPairs.
back();
692 while (!VirtRegPairs.
empty()) {
693 unsigned FromReg = VirtRegPairs.
back();
695 bool isNew = DstRegMap.insert(std::make_pair(FromReg, ToReg)).second;
697 assert(DstRegMap[FromReg] == ToReg &&
"Can't map to two dst registers!");
700 bool isNew = DstRegMap.insert(std::make_pair(DstReg, ToReg)).second;
702 assert(DstRegMap[DstReg] == ToReg &&
"Can't map to two dst registers!");
718 void TwoAddressInstructionPass::processCopy(
MachineInstr *MI) {
719 if (Processed.count(MI))
722 bool IsSrcPhys, IsDstPhys;
723 unsigned SrcReg, DstReg;
727 if (IsDstPhys && !IsSrcPhys)
728 DstRegMap.insert(std::make_pair(SrcReg, DstReg));
729 else if (!IsDstPhys && IsSrcPhys) {
730 bool isNew = SrcRegMap.insert(std::make_pair(DstReg, SrcReg)).second;
732 assert(SrcRegMap[DstReg] == SrcReg &&
733 "Can't map to two src physical registers!");
738 Processed.insert(MI);
745 bool TwoAddressInstructionPass::
756 if (DI == DistanceMap.
end())
764 "Reg should not have empty live interval.");
768 if (I != LI.
end() && I->start < MBBEndIdx)
772 KillMI = LIS->getInstructionFromIndex(I->end);
774 KillMI = LV->getVarInfo(Reg).findKill(MBB);
789 bool SeenStore =
true;
793 if (
TII->getInstrLatency(InstrItins, MI) > 1)
804 unsigned MOReg = MO.
getReg();
811 if (MOReg != Reg && (MO.
isKill() ||
822 while (End->isCopy() && Defs.
count(End->getOperand(1).getReg())) {
823 Defs.
insert(End->getOperand(0).getReg());
828 unsigned NumVisited = 0;
843 for (
unsigned i = 0, e = OtherMI->
getNumOperands(); i != e; ++i) {
847 unsigned MOReg = MO.
getReg();
851 if (Uses.
count(MOReg))
860 if (Defs.
count(MOReg))
862 bool isKill = MO.
isKill() ||
865 ((isKill && Uses.
count(MOReg)) || Kills.
count(MOReg)))
868 if (MOReg == Reg && !isKill)
872 assert((MOReg != Reg || OtherMI == KillMI) &&
873 "Found multiple kills of a register in a basic block");
879 while (Begin != MBB->begin() &&
llvm::prior(Begin)->isDebugValue())
890 MBB->splice(InsertPos, MBB, CopyMI);
891 LIS->handleMove(CopyMI);
898 MBB->splice(InsertPos, MBB, Begin, End);
899 DistanceMap.erase(DI);
905 LV->removeVirtualRegisterKilled(Reg, KillMI);
906 LV->addVirtualRegisterKilled(Reg, MI);
909 DEBUG(
dbgs() <<
"\trescheduled below kill: " << *KillMI);
915 bool TwoAddressInstructionPass::isDefTooClose(
unsigned Reg,
unsigned Dist,
918 DE =
MRI->def_end(); DI !=
DE; ++DI) {
925 if (DDI == DistanceMap.
end())
927 unsigned DefDist = DDI->second;
928 assert(Dist > DefDist &&
"Visited def already?");
929 if (
TII->getInstrLatency(InstrItins, DefMI) > (Dist - DefDist))
939 bool TwoAddressInstructionPass::
950 if (DI == DistanceMap.
end())
958 "Reg should not have empty live interval.");
962 if (I != LI.
end() && I->start < MBBEndIdx)
966 KillMI = LIS->getInstructionFromIndex(I->end);
968 KillMI = LV->getVarInfo(Reg).findKill(MBB);
978 bool SeenStore =
true;
990 unsigned MOReg = MO.
getReg();
994 if (isDefTooClose(MOReg, DI->second, MI))
997 if (MOReg == Reg && !isKill)
1000 if (isKill && MOReg != Reg)
1010 unsigned NumVisited = 0;
1017 if (NumVisited > 10)
1025 for (
unsigned i = 0, e = OtherMI->
getNumOperands(); i != e; ++i) {
1029 unsigned MOReg = MO.
getReg();
1033 if (Defs.
count(MOReg))
1037 if (Kills.
count(MOReg))
1040 if (OtherMI != MI && MOReg == Reg &&
1049 for (
unsigned i = 0, e = OtherDefs.
size(); i != e; ++i) {
1050 unsigned MOReg = OtherDefs[i];
1051 if (Uses.
count(MOReg))
1054 LiveDefs.
count(MOReg))
1063 while (InsertPos != MBB->begin() &&
llvm::prior(InsertPos)->isDebugValue())
1069 MBB->splice(InsertPos, MBB, From, To);
1072 DistanceMap.erase(DI);
1076 LIS->handleMove(KillMI);
1078 LV->removeVirtualRegisterKilled(Reg, KillMI);
1079 LV->addVirtualRegisterKilled(Reg, MI);
1082 DEBUG(
dbgs() <<
"\trescheduled kill: " << *KillMI);
1093 bool TwoAddressInstructionPass::
1096 unsigned SrcIdx,
unsigned DstIdx,
1097 unsigned Dist,
bool shouldOnlyCommute) {
1106 "cannot make instruction into two-address form");
1113 unsigned SrcOp1, SrcOp2;
1115 unsigned regCIdx = ~0U;
1116 bool TryCommute =
false;
1117 bool AggressiveCommute =
false;
1119 TII->findCommutedOpIndices(&MI, SrcOp1, SrcOp2)) {
1120 if (SrcIdx == SrcOp1)
1122 else if (SrcIdx == SrcOp2)
1125 if (regCIdx != ~0U) {
1131 else if (isProfitableToCommute(regA, regB, regC, &MI, Dist)) {
1133 AggressiveCommute =
true;
1139 if (TryCommute && commuteInstruction(mi, regB, regC, Dist)) {
1141 if (AggressiveCommute)
1146 if (shouldOnlyCommute)
1159 if (!regBKilled || isProfitableToConv3Addr(regA, regB)) {
1161 if (convertInstTo3Addr(mi, nmi, regA, regB, Dist)) {
1162 ++NumConvertedTo3Addr;
1183 if (MI.
mayLoad() && !regBKilled) {
1185 unsigned LoadRegIndex;
1195 DEBUG(
dbgs() <<
"2addr: UNFOLDING: " << MI);
1197 TRI->getAllocatableClass(
1198 TII->getRegClass(UnfoldMCID, LoadRegIndex, TRI, *MF));
1199 unsigned Reg =
MRI->createVirtualRegister(RC);
1201 if (!
TII->unfoldMemoryOperand(*MF, &MI, Reg,
1204 DEBUG(
dbgs() <<
"2addr: ABANDONING UNFOLD\n");
1207 assert(NewMIs.
size() == 2 &&
1208 "Unfolded a load into multiple instructions!");
1210 NewMIs[1]->addRegisterKilled(Reg, TRI);
1214 MBB->
insert(mi, NewMIs[0]);
1215 MBB->insert(mi, NewMIs[1]);
1217 DEBUG(
dbgs() <<
"2addr: NEW LOAD: " << *NewMIs[0]
1218 <<
"2addr: NEW INST: " << *NewMIs[1]);
1221 unsigned NewDstIdx = NewMIs[1]->findRegisterDefOperandIdx(regA);
1222 unsigned NewSrcIdx = NewMIs[1]->findRegisterUseOperandIdx(regB);
1224 bool TransformResult =
1225 tryInstructionTransform(NewMI, mi, NewSrcIdx, NewDstIdx, Dist,
true);
1226 (void)TransformResult;
1227 assert(!TransformResult &&
1228 "tryInstructionTransform() should return false.");
1229 if (NewMIs[1]->getOperand(NewSrcIdx).isKill()) {
1239 if (NewMIs[0]->killsRegister(MO.
getReg()))
1240 LV->replaceKillInstruction(MO.
getReg(), &
MI, NewMIs[0]);
1242 assert(NewMIs[1]->killsRegister(MO.
getReg()) &&
1243 "Kill missing after load unfold!");
1244 LV->replaceKillInstruction(MO.
getReg(), &
MI, NewMIs[1]);
1247 }
else if (LV->removeVirtualRegisterDead(MO.
getReg(), &
MI)) {
1248 if (NewMIs[1]->registerDefIsDead(MO.
getReg()))
1249 LV->addVirtualRegisterDead(MO.
getReg(), NewMIs[1]);
1251 assert(NewMIs[0]->registerDefIsDead(MO.
getReg()) &&
1252 "Dead flag missing after load unfold!");
1253 LV->addVirtualRegisterDead(MO.
getReg(), NewMIs[0]);
1258 LV->addVirtualRegisterKilled(Reg, NewMIs[1]);
1276 LIS->repairIntervalsInRange(MBB, Begin, End, OrigRegs);
1284 DEBUG(
dbgs() <<
"2addr: ABANDONING UNFOLD\n");
1285 NewMIs[0]->eraseFromParent();
1286 NewMIs[1]->eraseFromParent();
1298 bool TwoAddressInstructionPass::
1299 collectTiedOperands(
MachineInstr *MI, TiedOperandMap &TiedOperands) {
1301 bool AnyOps =
false;
1304 for (
unsigned SrcIdx = 0; SrcIdx < NumOps; ++SrcIdx) {
1305 unsigned DstIdx = 0;
1311 unsigned SrcReg = SrcMO.
getReg();
1312 unsigned DstReg = DstMO.
getReg();
1314 if (SrcReg == DstReg)
1317 assert(SrcReg && SrcMO.
isUse() &&
"two address instruction invalid");
1325 MRI->constrainRegClass(DstReg, RC);
1327 DEBUG(
dbgs() <<
"\t\trewrite undef:\t" << *MI);
1330 TiedOperands[SrcReg].push_back(std::make_pair(SrcIdx, DstIdx));
1338 TwoAddressInstructionPass::processTiedPairs(
MachineInstr *MI,
1339 TiedPairList &TiedPairs,
1341 bool IsEarlyClobber =
false;
1342 for (
unsigned tpi = 0, tpe = TiedPairs.size(); tpi != tpe; ++tpi) {
1347 bool RemovedKillFlag =
false;
1348 bool AllUsesCopied =
true;
1349 unsigned LastCopiedReg = 0;
1352 for (
unsigned tpi = 0, tpe = TiedPairs.size(); tpi != tpe; ++tpi) {
1353 unsigned SrcIdx = TiedPairs[tpi].first;
1354 unsigned DstIdx = TiedPairs[tpi].second;
1357 unsigned RegA = DstMO.
getReg();
1367 AllUsesCopied =
false;
1370 LastCopiedReg = RegA;
1373 "cannot make instruction into two-address form");
1380 assert(i == DstIdx ||
1392 DistanceMap.insert(std::make_pair(PrevMI, Dist));
1393 DistanceMap[
MI] = ++Dist;
1396 LastCopyIdx = LIS->InsertMachineInstrInMaps(PrevMI).
getRegSlot();
1402 LIS->getInstructionIndex(MI).
getRegSlot(IsEarlyClobber);
1403 LI.
addSegment(LiveInterval::Segment(LastCopyIdx, endIdx, VNI));
1407 DEBUG(
dbgs() <<
"\t\tprepend:\t" << *PrevMI);
1411 "inconsistent operand info for 2-reg pass");
1414 RemovedKillFlag =
true;
1425 SrcRegMap[RegA] = RegB;
1429 if (AllUsesCopied) {
1430 if (!IsEarlyClobber) {
1437 RemovedKillFlag =
true;
1439 MO.
setReg(LastCopiedReg);
1445 if (RemovedKillFlag && LV && LV->getVarInfo(RegB).removeKill(MI)) {
1448 LV->addVirtualRegisterKilled(RegB, PrevMI);
1454 SlotIndex MIIdx = LIS->getInstructionIndex(MI);
1456 assert(I != LI.
end() &&
"RegB must be live-in to use.");
1459 if (I->end == UseIdx)
1463 }
else if (RemovedKillFlag) {
1483 MRI = &MF->getRegInfo();
1487 LV = getAnalysisIfAvailable<LiveVariables>();
1488 LIS = getAnalysisIfAvailable<LiveIntervals>();
1489 AA = &getAnalysis<AliasAnalysis>();
1492 bool MadeChange =
false;
1494 DEBUG(
dbgs() <<
"********** REWRITING TWO-ADDR INSTRS **********\n");
1496 << MF->getName() <<
'\n');
1501 TiedOperandMap TiedOperands;
1503 MBBI != MBBE; ++MBBI) {
1506 DistanceMap.clear();
1513 if (mi->isDebugValue()) {
1520 if (mi->isRegSequence())
1521 eliminateRegSequence(mi);
1523 DistanceMap.insert(std::make_pair(mi, ++Dist));
1529 if (!collectTiedOperands(mi, TiedOperands)) {
1534 ++NumTwoAddressInstrs;
1541 if (TiedOperands.size() == 1) {
1543 = TiedOperands.
begin()->second;
1544 if (TiedPairs.
size() == 1) {
1545 unsigned SrcIdx = TiedPairs[0].first;
1546 unsigned DstIdx = TiedPairs[0].second;
1547 unsigned SrcReg = mi->getOperand(SrcIdx).getReg();
1548 unsigned DstReg = mi->getOperand(DstIdx).getReg();
1549 if (SrcReg != DstReg &&
1550 tryInstructionTransform(mi, nmi, SrcIdx, DstIdx, Dist,
false)) {
1553 TiedOperands.clear();
1561 for (TiedOperandMap::iterator OI = TiedOperands.begin(),
1562 OE = TiedOperands.end(); OI != OE; ++OI) {
1563 processTiedPairs(mi, OI->second, Dist);
1564 DEBUG(
dbgs() <<
"\t\trewrite to:\t" << *mi);
1568 if (mi->isInsertSubreg()) {
1571 unsigned SubIdx = mi->getOperand(3).getImm();
1572 mi->RemoveOperand(3);
1573 assert(mi->getOperand(0).getSubReg() == 0 &&
"Unexpected subreg idx");
1574 mi->getOperand(0).setSubReg(SubIdx);
1575 mi->getOperand(0).setIsUndef(mi->getOperand(1).isUndef());
1576 mi->RemoveOperand(1);
1578 DEBUG(
dbgs() <<
"\t\tconvert to:\t" << *mi);
1583 TiedOperands.clear();
1589 MF->verify(
this,
"After two-address instruction pass");
1605 void TwoAddressInstructionPass::
1612 DEBUG(
dbgs() <<
"Illegal REG_SEQUENCE instruction:" << *MI);
1623 bool DefEmitted =
false;
1626 unsigned SrcReg = UseMO.
getReg();
1634 bool isKill = UseMO.
isKill();
1636 for (
unsigned j = i + 2; j < e; j += 2)
1661 LV->replaceKillInstruction(SrcReg, MI, CopyMI);
1663 DEBUG(
dbgs() <<
"Inserted: " << *CopyMI);
1670 DEBUG(
dbgs() <<
"Turned: " << *MI <<
" into an IMPLICIT_DEF");
1681 LIS->repairIntervalsInRange(MBB, MBBI, EndMBBI, OrigRegs);
void push_back(const T &Elt)
bool isRegTiedToDefOperand(unsigned UseOpIdx, unsigned *DefOpIdx=0) const
mop_iterator operands_end()
AnalysisUsage & addPreserved()
MachineInstr * getParent()
static PassRegistry * getPassRegistry()
bool isBranch(QueryType Type=AnyInBundle) const
bool isConvertibleTo3Addr(QueryType Type=IgnoreBundle) const
static unsigned getMappedReg(unsigned Reg, DenseMap< unsigned, unsigned > &RegMap)
static bool isKilled(MachineInstr &MI, unsigned Reg, const MachineRegisterInfo *MRI, const TargetInstrInfo *TII, LiveIntervals *LIS, bool allowFalsePositives)
unsigned getNumDefs() const
Return the number of MachineOperands that are register definitions. Register definitions always occur...
STATISTIC(NumTwoAddressInstrs,"Number of two-address instructions")
char & MachineDominatorsID
MachineDominators - This pass is a machine dominators analysis pass.
void setIsUndef(bool Val=true)
SlotIndex getInstructionIndex(const MachineInstr *instr) const
Returns the base index of the given instruction.
static bool isVirtualRegister(unsigned Reg)
INITIALIZE_PASS_BEGIN(TwoAddressInstructionPass,"twoaddressinstruction","Two-Address instruction pass", false, false) INITIALIZE_PASS_END(TwoAddressInstructionPass
static cl::opt< bool > EnableRescheduling("twoaddr-reschedule", cl::desc("Coalesce copies by rescheduling (default=true)"), cl::init(true), cl::Hidden)
iterator insert(iterator I, const T &Elt)
const MCInstrDesc & getDesc() const
bool isTerminator(QueryType Type=AnyInBundle) const
LoopInfoBase< BlockT, LoopT > * LI
bool isNotInMIMap(const MachineInstr *Instr) const
AnalysisUsage & addRequired()
char & MachineLoopInfoID
MachineLoopInfo - This pass is a loop analysis pass.
const HexagonInstrInfo * TII
#define llvm_unreachable(msg)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
bool isReg() const
isReg - Tests if this is a MO_Register operand.
bool mayLoad(QueryType Type=AnyInBundle) const
void initializeTwoAddressInstructionPassPass(PassRegistry &)
ID
LLVM Calling Convention Representation.
virtual const InstrItineraryData * getInstrItineraryData() const
unsigned getNumOperands() const
void RemoveOperand(unsigned i)
static bool regsAreCompatible(unsigned RegA, unsigned RegB, const TargetRegisterInfo *TRI)
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
Two Address instruction false
iterator addSegment(Segment S)
AnalysisUsage & addPreservedID(const void *ID)
CodeGenOpt::Level getOptLevel() const
SlotIndex getPrevSlot() const
const MachineBasicBlock * getParent() const
bool isDebugValue() const
bool isInsertSubreg() const
bool isEarlyClobber() const
bundle_iterator< MachineInstr, instr_iterator > iterator
initializer< Ty > init(const Ty &Val)
bool hasAtLeastOneValue() const
bool regsOverlap(unsigned regA, unsigned regB) const
* if(!EatIfPresent(lltok::kw_thread_local)) return false
const MCRegisterClass & getRegClass(unsigned i) const
Returns the register class associated with the enumeration value. See class MCOperandInfo.
const MachineOperand & getOperand(unsigned i) const
Two Address instruction pass
ItTy next(ItTy it, Dist n)
bool hasUnmodeledSideEffects() const
static MachineInstr * findOnlyInterestingUse(unsigned Reg, MachineBasicBlock *MBB, MachineRegisterInfo *MRI, const TargetInstrInfo *TII, bool &IsCopy, unsigned &DstReg, bool &IsDstPhys)
MachineInstrBuilder BuildMI(MachineFunction &MF, DebugLoc DL, const MCInstrDesc &MCID)
#define INITIALIZE_AG_DEPENDENCY(depName)
unsigned getSubReg() const
void setIsKill(bool Val=true)
iterator find(SlotIndex Pos)
void removeSegment(SlotIndex Start, SlotIndex End, bool RemoveDeadValNo=false)
virtual const TargetInstrInfo * getInstrInfo() const
MachineOperand * findRegisterUseOperand(unsigned Reg, bool isKill=false, const TargetRegisterInfo *TRI=NULL)
Segments::const_iterator const_iterator
void setDesc(const MCInstrDesc &tid)
static bool isSameInstr(SlotIndex A, SlotIndex B)
isSameInstr - Return true if A and B refer to the same instruction.
static bool isCopyToReg(MachineInstr &MI, const TargetInstrInfo *TII, unsigned &SrcReg, unsigned &DstReg, bool &IsSrcPhys, bool &IsDstPhys)
bool hasOneUse(unsigned RegNo) const
bool killsRegister(unsigned Reg, const TargetRegisterInfo *TRI=NULL) const
LiveInterval & getInterval(unsigned Reg)
raw_ostream & dbgs()
dbgs - Return a circular-buffered debug stream.
bool isSubregToReg() const
bool isSafeToMove(const TargetInstrInfo *TII, AliasAnalysis *AA, bool &SawStore) const
def_iterator def_begin(unsigned RegNo) const
bool count(const T &V) const
count - Return true if the element is in the set.
static bool isPhysicalRegister(unsigned Reg)
virtual void getAnalysisUsage(AnalysisUsage &AU) const
IMPLICIT_DEF - This is the MachineInstr-level equivalent of undef.
bool hasOneNonDBGUse(unsigned RegNo) const
void setReg(unsigned Reg)
bool isCall(QueryType Type=AnyInBundle) const
virtual const TargetRegisterInfo * getRegisterInfo() const
static bool isPlainlyKilled(MachineInstr *MI, unsigned Reg, LiveIntervals *LIS)
isPLainlyKilled - Test if the given register value, which is used by the
char & TwoAddressInstructionPassID
SlotIndex getRegSlot(bool EC=false) const
unsigned getReg() const
getReg - Returns the register number.
VNInfo * getNextValue(SlotIndex def, VNInfo::Allocator &VNInfoAllocator)
bool isCommutable(QueryType Type=IgnoreBundle) const
static def_iterator def_end()
mop_iterator operands_begin()
const MachineInstrBuilder & addOperand(const MachineOperand &MO) const
BasicBlockListType::iterator iterator
ItTy prior(ItTy it, Dist n)
const MCRegisterInfo & MRI
iterator find(const KeyT &Val)
SlotIndex - An opaque wrapper around machine indexes.
use_nodbg_iterator use_nodbg_begin(unsigned RegNo) const
DebugLoc getDebugLoc() const
static bool isTwoAddrUse(MachineInstr &MI, unsigned Reg, unsigned &DstReg)