53#define DEBUG_TYPE "ppc-mi-peepholes"
55STATISTIC(RemoveTOCSave,
"Number of TOC saves removed");
57 "Number of functions with multiple TOC saves that must be kept");
58STATISTIC(NumTOCSavesInPrologue,
"Number of TOC saves placed in the prologue");
59STATISTIC(NumEliminatedSExt,
"Number of eliminated sign-extensions");
60STATISTIC(NumEliminatedZExt,
"Number of eliminated zero-extensions");
61STATISTIC(NumOptADDLIs,
"Number of optimized ADD instruction fed by LI");
63 "Number of instructions converted to their immediate form");
65 "Number of functions entered in PPC MI Peepholes");
67 "Number of fixed-point iterations converting reg-reg instructions "
70 "Number of pairs of rotate left, clear left/right collapsed");
72 "Number of pairs of EXTSW and SLDI combined as EXTSWSLI");
74 "Number of LI(8) reg, 0 that are folded to r0 and removed");
78 cl::desc(
"Iterate to a fixed point when attempting to "
79 "convert reg-reg instructions to reg-imm"));
83 cl::desc(
"Convert eligible reg+reg instructions to reg+imm"));
87 cl::desc(
"enable elimination of sign-extensions"),
92 cl::desc(
"enable elimination of zero-extensions"),
97 cl::desc(
"enable optimization of conditional traps"),
101 PeepholeXToICounter,
"ppc-xtoi-peephole",
102 "Controls whether PPC reg+reg to reg+imm peephole is performed on a MI");
105 "Controls whether PPC per opcode peephole is performed on a MI");
120 MachineDominatorTree *MDT;
121 MachinePostDominatorTree *MPDT;
122 MachineBlockFrequencyInfo *MBFI;
123 BlockFrequency EntryFreq;
124 SmallSet<Register, 16> RegsToUpdate;
133 bool eliminateRedundantCompare();
134 bool eliminateRedundantTOCSaves(std::map<MachineInstr *, bool> &TOCSaves);
135 bool combineSEXTAndSHL(MachineInstr &
MI, MachineInstr *&ToErase);
136 bool emitRLDICWhenLoweringJumpTables(MachineInstr &
MI,
137 MachineInstr *&ToErase);
138 void UpdateTOCSaves(std::map<MachineInstr *, bool> &TOCSaves,
146 void addDummyDef(MachineBasicBlock &
MBB, MachineInstr *At,
Register Reg) {
149 void addRegToUpdateWithLine(
Register Reg,
int Line);
150 void convertUnprimedAccPHIs(
const PPCInstrInfo *TII, MachineRegisterInfo *MRI,
151 SmallVectorImpl<MachineInstr *> &PHIs,
156 void getAnalysisUsage(AnalysisUsage &AU)
const override {
159 AU.
addRequired<MachinePostDominatorTreeWrapperPass>();
160 AU.
addRequired<MachineBlockFrequencyInfoWrapperPass>();
164 AU.
addPreserved<MachineBlockFrequencyInfoWrapperPass>();
170 bool runOnMachineFunction(MachineFunction &MF)
override {
174 assert((MF.getRegInfo().use_empty(PPC::X2) ||
175 !MF.getSubtarget<PPCSubtarget>().isUsingPCRelativeCalls()) &&
176 "TOC pointer used in a function using PC-Relative addressing!");
177 if (skipFunction(MF.getFunction()))
179 return simplifyCode();
183#define addRegToUpdate(R) addRegToUpdateWithLine(R, __LINE__)
184void PPCMIPeephole::addRegToUpdateWithLine(
Register Reg,
int Line) {
185 if (!
Reg.isVirtual())
189 << Line <<
" for re-computation of kill flags\n");
193void PPCMIPeephole::initialize(MachineFunction &MFParm) {
196 MDT = &getAnalysis<MachineDominatorTreeWrapperPass>().getDomTree();
197 MPDT = &getAnalysis<MachinePostDominatorTreeWrapperPass>().getPostDomTree();
198 MBFI = &getAnalysis<MachineBlockFrequencyInfoWrapperPass>().getMBFI();
199 LV = &getAnalysis<LiveVariablesWrapperPass>().getLV();
202 RegsToUpdate.
clear();
207static MachineInstr *getVRegDefOrNull(MachineOperand *
Op,
208 MachineRegisterInfo *MRI) {
222static unsigned getKnownLeadingZeroCount(
const unsigned Reg,
223 const PPCInstrInfo *
TII,
224 const MachineRegisterInfo *MRI) {
226 unsigned Opcode =
MI->getOpcode();
227 if (Opcode == PPC::RLDICL || Opcode == PPC::RLDICL_rec ||
228 Opcode == PPC::RLDCL || Opcode == PPC::RLDCL_rec)
229 return MI->getOperand(3).getImm();
231 if ((Opcode == PPC::RLDIC || Opcode == PPC::RLDIC_rec) &&
232 MI->getOperand(3).getImm() <= 63 -
MI->getOperand(2).getImm())
233 return MI->getOperand(3).getImm();
235 if ((Opcode == PPC::RLWINM || Opcode == PPC::RLWINM_rec ||
236 Opcode == PPC::RLWNM || Opcode == PPC::RLWNM_rec ||
237 Opcode == PPC::RLWINM8 || Opcode == PPC::RLWNM8) &&
238 MI->getOperand(3).getImm() <=
MI->getOperand(4).getImm())
239 return 32 +
MI->getOperand(3).getImm();
241 if (Opcode == PPC::ANDI_rec) {
242 uint16_t
Imm =
MI->getOperand(2).getImm();
246 if (Opcode == PPC::CNTLZW || Opcode == PPC::CNTLZW_rec ||
247 Opcode == PPC::CNTTZW || Opcode == PPC::CNTTZW_rec ||
248 Opcode == PPC::CNTLZW8 || Opcode == PPC::CNTTZW8)
252 if (Opcode == PPC::CNTLZD || Opcode == PPC::CNTLZD_rec ||
253 Opcode == PPC::CNTTZD || Opcode == PPC::CNTTZD_rec)
257 if (Opcode == PPC::LHZ || Opcode == PPC::LHZX ||
258 Opcode == PPC::LHZ8 || Opcode == PPC::LHZX8 ||
259 Opcode == PPC::LHZU || Opcode == PPC::LHZUX ||
260 Opcode == PPC::LHZU8 || Opcode == PPC::LHZUX8)
263 if (Opcode == PPC::LBZ || Opcode == PPC::LBZX ||
264 Opcode == PPC::LBZ8 || Opcode == PPC::LBZX8 ||
265 Opcode == PPC::LBZU || Opcode == PPC::LBZUX ||
266 Opcode == PPC::LBZU8 || Opcode == PPC::LBZUX8)
269 if (Opcode == PPC::AND || Opcode == PPC::AND8 || Opcode == PPC::AND_rec ||
270 Opcode == PPC::AND8_rec)
272 getKnownLeadingZeroCount(
MI->getOperand(1).getReg(),
TII, MRI),
273 getKnownLeadingZeroCount(
MI->getOperand(2).getReg(),
TII, MRI));
275 if (Opcode == PPC::OR || Opcode == PPC::OR8 || Opcode == PPC::XOR ||
276 Opcode == PPC::XOR8 || Opcode == PPC::OR_rec ||
277 Opcode == PPC::OR8_rec || Opcode == PPC::XOR_rec ||
278 Opcode == PPC::XOR8_rec)
280 getKnownLeadingZeroCount(
MI->getOperand(1).getReg(),
TII, MRI),
281 getKnownLeadingZeroCount(
MI->getOperand(2).getReg(),
TII, MRI));
283 if (
TII->isZeroExtended(
Reg, MRI))
295void PPCMIPeephole::UpdateTOCSaves(
296 std::map<MachineInstr *, bool> &TOCSaves, MachineInstr *
MI) {
297 assert(
TII->isTOCSaveMI(*
MI) &&
"Expecting a TOC save instruction here");
301 PPCFunctionInfo *FI = MF->
getInfo<PPCFunctionInfo>();
304 BlockFrequency CurrBlockFreq = MBFI->
getBlockFreq(
MI->getParent());
310 if (CurrBlockFreq > EntryFreq || MPDT->
dominates(
MI->getParent(), Entry))
316 for (
auto &TOCSave : TOCSaves)
317 TOCSave.second =
false;
319 TOCSaves[
MI] =
false;
325 for (
auto &
I : TOCSaves) {
326 MachineInstr *CurrInst =
I.first;
347static bool collectUnprimedAccPHIs(MachineRegisterInfo *MRI,
348 MachineInstr *RootPHI,
349 SmallVectorImpl<MachineInstr *> &PHIs) {
351 unsigned VisitedIndex = 0;
352 while (VisitedIndex < PHIs.
size()) {
353 MachineInstr *VisitedPHI = PHIs[VisitedIndex];
355 PHIOp !=
NumOps; PHIOp += 2) {
362 unsigned Opcode =
Instr->getOpcode();
363 if (Opcode == PPC::COPY) {
367 }
else if (Opcode != PPC::IMPLICIT_DEF && Opcode != PPC::PHI)
373 if (Opcode != PPC::PHI)
388void PPCMIPeephole::convertUnprimedAccPHIs(
389 const PPCInstrInfo *
TII, MachineRegisterInfo *MRI,
390 SmallVectorImpl<MachineInstr *> &PHIs,
Register Dst) {
391 DenseMap<MachineInstr *, MachineInstr *> ChangedPHIMap;
398 for (
unsigned PHIOp = 1,
NumOps =
PHI->getNumOperands(); PHIOp !=
NumOps;
401 MachineInstr *PHIInput = MRI->
getVRegDef(RegOp);
403 assert((Opcode == PPC::COPY || Opcode == PPC::IMPLICIT_DEF ||
404 Opcode == PPC::PHI) &&
405 "Unexpected instruction");
406 if (Opcode == PPC::COPY) {
408 &PPC::ACCRCRegClass &&
409 "Unexpected register class");
411 }
else if (Opcode == PPC::IMPLICIT_DEF) {
414 TII->get(PPC::IMPLICIT_DEF), AccReg);
416 PHI->getOperand(PHIOp + 1)});
417 }
else if (Opcode == PPC::PHI) {
422 "This PHI node should have already been changed.");
423 MachineInstr *PrimedAccPHI = ChangedPHIMap.
lookup(PHIInput);
426 PHI->getOperand(PHIOp + 1)});
437 MachineInstrBuilder NewPHI =
BuildMI(
438 *
PHI->getParent(),
PHI,
PHI->getDebugLoc(),
TII->get(PPC::PHI), AccReg);
439 for (
auto RegMBB : PHIOps) {
440 NewPHI.
add(RegMBB.first).
add(RegMBB.second);
456bool PPCMIPeephole::simplifyCode() {
458 bool TrapOpt =
false;
459 MachineInstr* ToErase =
nullptr;
460 std::map<MachineInstr *, bool> TOCSaves;
462 NumFunctionsEnteredInMIPeephole++;
467 bool SomethingChanged =
false;
469 NumFixedPointIterations++;
470 SomethingChanged =
false;
471 for (MachineBasicBlock &
MBB : *MF) {
472 for (MachineInstr &
MI :
MBB) {
473 if (
MI.isDebugInstr())
479 SmallSet<Register, 4> RRToRIRegsToUpdate;
480 if (!
TII->convertToImmediateForm(
MI, RRToRIRegsToUpdate))
482 for (
Register R : RRToRIRegsToUpdate)
486 for (
const MachineOperand &MO :
MI.operands())
493 NumConvertedToImmediateForm++;
494 SomethingChanged =
true;
506 auto recomputeLVForDyingInstr = [&]() {
507 if (RegsToUpdate.
empty())
509 for (MachineOperand &MO : ToErase->
operands()) {
510 if (!MO.isReg() || !MO.isDef() || !RegsToUpdate.
count(MO.getReg()))
513 RegsToUpdate.
erase(RegToUpdate);
518 MO.setReg(PPC::NoRegister);
523 for (MachineBasicBlock &
MBB : *MF) {
524 for (MachineInstr &
MI :
MBB) {
531 recomputeLVForDyingInstr();
544 if (
MI.isDebugInstr())
551 switch (
MI.getOpcode()) {
558 if (!Src.isVirtual() || !Dst.isVirtual())
560 if (MRI->
getRegClass(Src) != &PPC::UACCRCRegClass ||
577 SmallVector<MachineInstr *, 4> PHIs;
578 if (!collectUnprimedAccPHIs(MRI, RootPHI, PHIs))
581 convertUnprimedAccPHIs(
TII, MRI, PHIs, Dst);
591 if (!
MI.getOperand(1).isImm() ||
MI.getOperand(1).getImm() != 0)
593 Register MIDestReg =
MI.getOperand(0).getReg();
596 Folded |=
TII->onlyFoldImmediate(
UseMI,
MI, MIDestReg);
598 ++NumLoadImmZeroFoldedAndRemoved;
608 MachineFrameInfo &MFI = MF->getFrameInfo();
610 (!MF->getSubtarget<PPCSubtarget>().isELFv2ABI() &&
611 !MF->getSubtarget<PPCSubtarget>().isAIXABI()))
616 if (
TII->isTOCSaveMI(
MI))
617 UpdateTOCSaves(TOCSaves, &
MI);
620 case PPC::XXPERMDI: {
624 int Immed =
MI.getOperand(3).getImm();
636 TRI->lookThruCopyLike(
MI.getOperand(1).getReg(), MRI);
638 TRI->lookThruCopyLike(
MI.getOperand(2).getReg(), MRI);
640 if (!(TrueReg1 == TrueReg2 && TrueReg1.
isVirtual()))
654 auto isConversionOfLoadAndSplat = [=]() ->
bool {
655 if (DefOpc != PPC::XVCVDPSXDS && DefOpc != PPC::XVCVDPUXDS)
660 MachineInstr *LoadMI = MRI->
getVRegDef(FeedReg1);
661 if (LoadMI && LoadMI->
getOpcode() == PPC::LXVDSX)
666 if ((Immed == 0 || Immed == 3) &&
667 (DefOpc == PPC::LXVDSX || isConversionOfLoadAndSplat())) {
669 "to load-and-splat/copy: ");
672 MI.getOperand(0).getReg())
673 .
add(
MI.getOperand(1));
681 if (DefOpc == PPC::XXPERMDI) {
689 if (DefReg1 != DefReg2) {
690 Register FeedReg1 =
TRI->lookThruCopyLike(DefReg1, MRI);
691 Register FeedReg2 =
TRI->lookThruCopyLike(DefReg2, MRI);
693 if (!(FeedReg1 == FeedReg2 && FeedReg1.
isVirtual()))
697 if (DefImmed == 0 || DefImmed == 3) {
702 MI.getOperand(0).getReg())
703 .
add(
MI.getOperand(1));
712 else if ((Immed == 0 || Immed == 3) && DefImmed == 2) {
717 MI.getOperand(1).setReg(DefReg1);
718 MI.getOperand(2).setReg(DefReg2);
719 MI.getOperand(3).setImm(3 - Immed);
727 else if (Immed == 2 && DefImmed == 2) {
733 MI.getOperand(0).getReg())
740 }
else if ((Immed == 0 || Immed == 3 || Immed == 2) &&
741 DefOpc == PPC::XXPERMDIs &&
753 MI.getOperand(0).getReg())
754 .
add(
MI.getOperand(1));
765 }
else if (Immed == 2 &&
766 (DefOpc == PPC::VSPLTB || DefOpc == PPC::VSPLTH ||
767 DefOpc == PPC::VSPLTW || DefOpc == PPC::XXSPLTW ||
768 DefOpc == PPC::VSPLTISB || DefOpc == PPC::VSPLTISH ||
769 DefOpc == PPC::VSPLTISW)) {
773 LLVM_DEBUG(
dbgs() <<
"Optimizing swap(vsplt(is)?[b|h|w]|xxspltw) => "
774 "copy(vsplt(is)?[b|h|w]|xxspltw): ");
777 MI.getOperand(0).getReg())
778 .
add(
MI.getOperand(1));
780 }
else if ((Immed == 0 || Immed == 3 || Immed == 2) &&
781 TII->isLoadFromConstantPool(
DefMI)) {
783 if (
C &&
C->getType()->isVectorTy() &&
C->getSplatValue()) {
787 <<
"Optimizing swap(splat pattern from constant-pool) "
788 "=> copy(splat pattern from constant-pool): ");
791 MI.getOperand(0).getReg())
792 .
add(
MI.getOperand(1));
801 unsigned MyOpcode =
MI.getOpcode();
803 unsigned OpNo = MyOpcode == PPC::XXSPLTW ? 1 : 2;
805 TRI->lookThruCopyLike(
MI.getOperand(OpNo).getReg(), MRI);
812 auto isConvertOfSplat = [=]() ->
bool {
813 if (DefOpcode != PPC::XVCVSPSXWS && DefOpcode != PPC::XVCVSPUXWS)
818 MachineInstr *Splt = MRI->
getVRegDef(ConvReg);
819 return Splt && (Splt->
getOpcode() == PPC::LXVWSX ||
822 bool AlreadySplat = (MyOpcode == DefOpcode) ||
823 (MyOpcode == PPC::VSPLTB && DefOpcode == PPC::VSPLTBs) ||
824 (MyOpcode == PPC::VSPLTH && DefOpcode == PPC::VSPLTHs) ||
825 (MyOpcode == PPC::XXSPLTW && DefOpcode == PPC::XXSPLTWs) ||
826 (MyOpcode == PPC::XXSPLTW && DefOpcode == PPC::LXVWSX) ||
827 (MyOpcode == PPC::XXSPLTW && DefOpcode == PPC::MTVSRWS)||
828 (MyOpcode == PPC::XXSPLTW && isConvertOfSplat());
836 MI.getOperand(0).getReg())
837 .
add(
MI.getOperand(OpNo));
845 if (DefOpcode == PPC::XXSLDWI) {
867 unsigned SplatImmNo = MyOpcode == PPC::XXSPLTW ? 2 : 1;
868 unsigned SplatImm =
MI.getOperand(SplatImmNo).getImm();
874 auto CalculateNewElementIdx = [&](
unsigned Opcode) {
875 if (Opcode == PPC::VSPLTB)
876 return (SplatImm + ShiftImm * 4) & 0xF;
877 else if (Opcode == PPC::VSPLTH)
878 return (SplatImm + ShiftImm * 2) & 0x7;
880 return (SplatImm + ShiftImm) & 0x3;
883 unsigned NewElem = CalculateNewElementIdx(MyOpcode);
886 <<
" to " << NewElem <<
" in instruction: ");
892 MI.getOperand(OpNo).setReg(ShiftOp1);
893 MI.getOperand(SplatImmNo).setImm(NewElem);
898 case PPC::XVCVDPSP: {
901 TRI->lookThruCopyLike(
MI.getOperand(1).getReg(), MRI);
924 auto removeFRSPIfPossible = [&](MachineInstr *RoundInstr) {
925 unsigned Opc = RoundInstr->getOpcode();
926 if ((
Opc == PPC::FRSP ||
Opc == PPC::XSRSP) &&
929 Register ConvReg1 = RoundInstr->getOperand(1).getReg();
930 Register FRSPDefines = RoundInstr->getOperand(0).getReg();
932 for (
int i = 0, e =
Use.getNumOperands(); i < e; ++i)
933 if (
Use.getOperand(i).isReg() &&
934 Use.getOperand(i).getReg() == FRSPDefines)
935 Use.getOperand(i).setReg(ConvReg1);
944 ToErase = RoundInstr;
952 removeFRSPIfPossible(P1);
953 removeFRSPIfPossible(P2);
956 removeFRSPIfPossible(P1);
962 case PPC::EXTSH8_32_64: {
964 Register NarrowReg =
MI.getOperand(1).getReg();
968 MachineInstr *SrcMI = MRI->
getVRegDef(NarrowReg);
972 if (SrcOpcode == PPC::LHZ || SrcOpcode == PPC::LHZX) {
979 unsigned Opc = PPC::LHA;
980 bool SourceIsXForm = SrcOpcode == PPC::LHZX;
981 bool MIIs64Bit =
MI.getOpcode() == PPC::EXTSH8 ||
982 MI.getOpcode() == PPC::EXTSH8_32_64;
984 if (SourceIsXForm && MIIs64Bit)
986 else if (SourceIsXForm && !MIIs64Bit)
997 addDummyDef(
MBB, &
MI, NarrowReg);
1007 NumEliminatedSExt++;
1013 case PPC::EXTSW_32_64: {
1015 Register NarrowReg =
MI.getOperand(1).getReg();
1019 MachineInstr *SrcMI = MRI->
getVRegDef(NarrowReg);
1020 unsigned SrcOpcode = SrcMI->
getOpcode();
1023 if (SrcOpcode == PPC::LWZ || SrcOpcode == PPC::LWZX) {
1031 bool IsWordAligned =
false;
1033 const GlobalVariable *GV =
1037 IsWordAligned =
true;
1041 IsWordAligned =
true;
1048 unsigned Opc = PPC::LWA_32;
1049 bool SourceIsXForm = SrcOpcode == PPC::LWZX;
1050 bool MIIs64Bit =
MI.getOpcode() == PPC::EXTSW ||
1051 MI.getOpcode() == PPC::EXTSW_32_64;
1053 if (SourceIsXForm && MIIs64Bit)
1055 else if (SourceIsXForm && !MIIs64Bit)
1060 if (!IsWordAligned && (
Opc == PPC::LWA ||
Opc == PPC::LWA_32))
1069 addDummyDef(
MBB, &
MI, NarrowReg);
1079 NumEliminatedSExt++;
1080 }
else if (
MI.getOpcode() == PPC::EXTSW_32_64 &&
1081 TII->isSignExtended(NarrowReg, MRI)) {
1091 TII->promoteInstr32To64ForElimEXTSW(NarrowReg, MRI, 0, LV);
1095 MF->getRegInfo().createVirtualRegister(&PPC::G8RCRegClass);
1099 MI.getOperand(0).getReg())
1105 NumEliminatedSExt++;
1118 if (
MI.getOperand(2).getImm() != 0)
1125 MachineInstr *SrcMI = MRI->
getVRegDef(SrcReg);
1126 if (!(SrcMI && SrcMI->
getOpcode() == PPC::INSERT_SUBREG &&
1130 MachineInstr *ImpDefMI, *SubRegMI;
1133 if (ImpDefMI->
getOpcode() != PPC::IMPLICIT_DEF)
break;
1136 if (SubRegMI->
getOpcode() == PPC::COPY) {
1144 unsigned KnownZeroCount =
1146 if (
MI.getOperand(3).getImm() <= KnownZeroCount) {
1149 MI.getOperand(0).getReg())
1154 NumEliminatedZExt++;
1165 auto isSingleUsePHI = [&](MachineOperand *PhiOp) {
1166 assert(PhiOp &&
"Invalid Operand!");
1167 MachineInstr *DefPhiMI = getVRegDefOrNull(PhiOp, MRI);
1169 return DefPhiMI && (DefPhiMI->
getOpcode() == PPC::PHI) &&
1173 auto dominatesAllSingleUseLIs = [&](MachineOperand *DominatorOp,
1174 MachineOperand *PhiOp) {
1175 assert(PhiOp &&
"Invalid Operand!");
1176 assert(DominatorOp &&
"Invalid Operand!");
1177 MachineInstr *DefPhiMI = getVRegDefOrNull(PhiOp, MRI);
1178 MachineInstr *DefDomMI = getVRegDefOrNull(DominatorOp, MRI);
1183 MachineInstr *LiMI =
1184 getVRegDefOrNull(&DefPhiMI->
getOperand(i), MRI);
1195 MachineOperand Op1 =
MI.getOperand(1);
1196 MachineOperand Op2 =
MI.getOperand(2);
1197 if (isSingleUsePHI(&Op2) && dominatesAllSingleUseLIs(&Op1, &Op2))
1199 else if (!isSingleUsePHI(&Op1) || !dominatesAllSingleUseLIs(&Op2, &Op1))
1206 ? &PPC::G8RC_and_G8RC_NOX0RegClass
1207 : &PPC::GPRC_and_GPRC_NOR0RegClass;
1211 MachineInstr *DefPhiMI = getVRegDefOrNull(&Op1, MRI);
1213 MachineInstr *LiMI = getVRegDefOrNull(&DefPhiMI->
getOperand(i), MRI);
1231 .addReg(DominatorReg)
1240 MI.getOperand(0).getReg())
1250 Simplified |= emitRLDICWhenLoweringJumpTables(
MI, ToErase) ||
1251 combineSEXTAndSHL(
MI, ToErase);
1255 case PPC::ANDI8_rec:
1256 case PPC::ANDIS_rec:
1257 case PPC::ANDIS8_rec: {
1259 TRI->lookThruCopyLike(
MI.getOperand(1).getReg(), MRI);
1263 MachineInstr *SrcMI = MRI->
getVRegDef(TrueReg);
1267 unsigned SrcOpCode = SrcMI->
getOpcode();
1268 if (SrcOpCode != PPC::RLDICL && SrcOpCode != PPC::RLDICR)
1273 DstReg =
MI.getOperand(1).getReg();
1279 uint64_t AndImm =
MI.getOperand(2).getImm();
1280 if (
MI.getOpcode() == PPC::ANDIS_rec ||
1281 MI.getOpcode() == PPC::ANDIS8_rec)
1289 bool PatternResultZero =
1290 (SrcOpCode == PPC::RLDICL && (RZeroAndImm + ImmSrc > 63)) ||
1291 (SrcOpCode == PPC::RLDICR && LZeroAndImm > ImmSrc);
1295 bool PatternRemoveRotate =
1297 ((SrcOpCode == PPC::RLDICL && LZeroAndImm >= ImmSrc) ||
1298 (SrcOpCode == PPC::RLDICR && (RZeroAndImm + ImmSrc > 63)));
1300 if (!PatternResultZero && !PatternRemoveRotate)
1306 if (PatternResultZero)
1307 MI.getOperand(2).setImm(0);
1317 case PPC::RLWINM_rec:
1319 case PPC::RLWINM8_rec: {
1322 Register OrigOp1Reg =
MI.getOperand(1).isReg()
1323 ?
MI.getOperand(1).getReg()
1328 if (
MI.getOperand(1).isReg())
1334 ++NumRotatesCollapsed;
1345 MachineInstr *LiMI1 = getVRegDefOrNull(&
MI.getOperand(1), MRI);
1346 MachineInstr *LiMI2 = getVRegDefOrNull(&
MI.getOperand(2), MRI);
1347 bool IsOperand2Immediate =
MI.getOperand(2).isImm();
1350 if (!(LiMI1 && (LiMI1->
getOpcode() == PPC::LI ||
1353 if (!IsOperand2Immediate &&
1354 !(LiMI2 && (LiMI2->
getOpcode() == PPC::LI ||
1358 auto ImmOperand0 =
MI.getOperand(0).getImm();
1360 auto ImmOperand2 = IsOperand2Immediate ?
MI.getOperand(2).getImm()
1365 if ((ImmOperand0 == 31) ||
1366 ((ImmOperand0 & 0x10) &&
1367 ((int64_t)ImmOperand1 < (int64_t)ImmOperand2)) ||
1368 ((ImmOperand0 & 0x8) &&
1369 ((int64_t)ImmOperand1 > (int64_t)ImmOperand2)) ||
1370 ((ImmOperand0 & 0x2) &&
1371 ((uint64_t)ImmOperand1 < (uint64_t)ImmOperand2)) ||
1372 ((ImmOperand0 & 0x1) &&
1373 ((uint64_t)ImmOperand1 > (uint64_t)ImmOperand2)) ||
1374 ((ImmOperand0 & 0x4) && (ImmOperand1 == ImmOperand2))) {
1389 recomputeLVForDyingInstr();
1399 Simplified |= eliminateRedundantTOCSaves(TOCSaves);
1400 PPCFunctionInfo *FI = MF->getInfo<PPCFunctionInfo>();
1402 NumTOCSavesInPrologue++;
1418static bool isEqOrNe(MachineInstr *BI) {
1424static bool isSupportedCmpOp(
unsigned opCode) {
1425 return (opCode == PPC::CMPLD || opCode == PPC::CMPD ||
1426 opCode == PPC::CMPLW || opCode == PPC::CMPW ||
1427 opCode == PPC::CMPLDI || opCode == PPC::CMPDI ||
1428 opCode == PPC::CMPLWI || opCode == PPC::CMPWI);
1431static bool is64bitCmpOp(
unsigned opCode) {
1432 return (opCode == PPC::CMPLD || opCode == PPC::CMPD ||
1433 opCode == PPC::CMPLDI || opCode == PPC::CMPDI);
1436static bool isSignedCmpOp(
unsigned opCode) {
1437 return (opCode == PPC::CMPD || opCode == PPC::CMPW ||
1438 opCode == PPC::CMPDI || opCode == PPC::CMPWI);
1441static unsigned getSignedCmpOpCode(
unsigned opCode) {
1442 if (opCode == PPC::CMPLD)
return PPC::CMPD;
1443 if (opCode == PPC::CMPLW)
return PPC::CMPW;
1444 if (opCode == PPC::CMPLDI)
return PPC::CMPDI;
1445 if (opCode == PPC::CMPLWI)
return PPC::CMPWI;
1451static unsigned getPredicateToDecImm(MachineInstr *BI, MachineInstr *CMPI) {
1453 bool SignedCmp = isSignedCmpOp(CMPI->
getOpcode());
1454 if ((!SignedCmp && Imm == 0) || (SignedCmp && Imm == 0x8000))
1470static unsigned getPredicateToIncImm(MachineInstr *BI, MachineInstr *CMPI) {
1472 bool SignedCmp = isSignedCmpOp(CMPI->
getOpcode());
1473 if ((!SignedCmp && Imm == 0xFFFF) || (SignedCmp && Imm == 0x7FFF))
1488static unsigned getIncomingRegForBlock(MachineInstr *Phi,
1489 MachineBasicBlock *
MBB) {
1490 for (
unsigned I = 2,
E =
Phi->getNumOperands() + 1;
I !=
E;
I += 2) {
1491 MachineOperand &MO =
Phi->getOperand(
I);
1493 return Phi->getOperand(
I-1).getReg();
1502static unsigned getSrcVReg(
unsigned Reg, MachineBasicBlock *BB1,
1503 MachineBasicBlock *BB2, MachineRegisterInfo *MRI) {
1504 unsigned SrcReg =
Reg;
1506 unsigned NextReg = SrcReg;
1507 MachineInstr *Inst = MRI->
getVRegDef(SrcReg);
1509 NextReg = getIncomingRegForBlock(Inst, BB1);
1515 if (NextReg == SrcReg || !Register::isVirtualRegister(NextReg))
1522static bool eligibleForCompareElimination(MachineBasicBlock &
MBB,
1523 MachineBasicBlock *&PredMBB,
1524 MachineBasicBlock *&MBBtoMoveCmp,
1525 MachineRegisterInfo *MRI) {
1527 auto isEligibleBB = [&](MachineBasicBlock &BB) {
1528 auto BII = BB.getFirstInstrTerminator();
1532 if (BB.succ_size() == 2 &&
1533 BII != BB.instr_end() &&
1534 (*BII).getOpcode() == PPC::BCC &&
1535 (*BII).getOperand(1).isReg()) {
1537 Register CndReg = (*BII).getOperand(1).getReg();
1541 MachineInstr *CMPI = MRI->
getVRegDef(CndReg);
1547 for (MachineOperand &MO : CMPI->
operands())
1560 auto isEligibleForMoveCmp = [](MachineBasicBlock &BB) {
1561 return BB.succ_size() == 1;
1564 if (!isEligibleBB(
MBB))
1568 if (NumPredBBs == 1) {
1570 if (isEligibleBB(*TmpMBB)) {
1572 MBBtoMoveCmp =
nullptr;
1576 else if (NumPredBBs == 2) {
1581 MachineBasicBlock *Pred1MBB = *PI;
1582 MachineBasicBlock *Pred2MBB = *(PI+1);
1584 if (isEligibleBB(*Pred1MBB) && isEligibleForMoveCmp(*Pred2MBB)) {
1589 else if (isEligibleBB(*Pred2MBB) && isEligibleForMoveCmp(*Pred1MBB)) {
1595 if (Pred1MBB == &
MBB)
1603 for (
int I = 1;
I <= 2;
I++)
1611 MBBtoMoveCmp = Pred2MBB;
1622bool PPCMIPeephole::eliminateRedundantTOCSaves(
1623 std::map<MachineInstr *, bool> &TOCSaves) {
1626 for (
auto TOCSave : TOCSaves) {
1627 if (!TOCSave.second) {
1628 TOCSave.first->eraseFromParent();
1664bool PPCMIPeephole::eliminateRedundantCompare() {
1667 for (MachineBasicBlock &MBB2 : *MF) {
1668 MachineBasicBlock *MBB1 =
nullptr, *MBBtoMoveCmp =
nullptr;
1697 if (!eligibleForCompareElimination(MBB2, MBB1, MBBtoMoveCmp, MRI))
1703 MachineInstr *BI2 = &*MBB2.getFirstInstrTerminator();
1705 bool IsPartiallyRedundant = (MBBtoMoveCmp !=
nullptr);
1709 if (!isSupportedCmpOp(CMPI1->
getOpcode()) ||
1710 !isSupportedCmpOp(CMPI2->
getOpcode()) ||
1714 unsigned NewOpCode = 0;
1715 unsigned NewPredicate1 = 0, NewPredicate2 = 0;
1717 bool SwapOperands =
false;
1728 auto CmpAgainstImmWithSignBit = [](MachineInstr *
I) {
1729 if (!
I->getOperand(2).isImm())
1731 int16_t
Imm = (int16_t)
I->getOperand(2).getImm();
1735 if (isEqOrNe(BI2) && !CmpAgainstImmWithSignBit(CMPI2) &&
1738 else if (isEqOrNe(BI1) && !CmpAgainstImmWithSignBit(CMPI1) &&
1748 nullptr,
nullptr, MRI);
1750 nullptr,
nullptr, MRI);
1756 if (Cmp1Operand1 == Cmp2Operand1 && Cmp1Operand2 == Cmp2Operand2) {
1759 else if (Cmp1Operand1 == Cmp2Operand2 && Cmp1Operand2 == Cmp2Operand1) {
1766 SwapOperands =
true;
1774 nullptr,
nullptr, MRI);
1777 if (Cmp1Operand1 != Cmp2Operand1)
1785 if (Imm1 != Imm2 && (!isEqOrNe(BI2) || !isEqOrNe(BI1))) {
1786 int Diff = Imm1 - Imm2;
1787 if (Diff < -2 || Diff > 2)
1790 unsigned PredToInc1 = getPredicateToIncImm(BI1, CMPI1);
1791 unsigned PredToDec1 = getPredicateToDecImm(BI1, CMPI1);
1792 unsigned PredToInc2 = getPredicateToIncImm(BI2, CMPI2);
1793 unsigned PredToDec2 = getPredicateToDecImm(BI2, CMPI2);
1795 if (PredToInc2 && PredToDec1) {
1796 NewPredicate2 = PredToInc2;
1797 NewPredicate1 = PredToDec1;
1802 else if (Diff == 1) {
1805 NewPredicate2 = PredToInc2;
1807 else if (PredToDec1) {
1809 NewPredicate1 = PredToDec1;
1812 else if (Diff == -1) {
1815 NewPredicate2 = PredToDec2;
1817 else if (PredToInc1) {
1819 NewPredicate1 = PredToInc1;
1822 else if (Diff == -2) {
1823 if (PredToDec2 && PredToInc1) {
1824 NewPredicate2 = PredToDec2;
1825 NewPredicate1 = PredToInc1;
1837 LLVM_DEBUG(
dbgs() <<
"Optimize two pairs of compare and branch:\n");
1842 for (
const MachineOperand &MO : CMPI1->
operands())
1845 for (
const MachineOperand &MO : CMPI2->
operands())
1850 if (NewOpCode != 0 && NewOpCode != CMPI1->
getOpcode()) {
1853 if (NewPredicate1) {
1856 if (NewPredicate2) {
1863 if (IsPartiallyRedundant) {
1875 for (
int I = 1;
I <= 2;
I++) {
1882 "We cannot support if an operand comes from this BB.");
1883 unsigned SrcReg = getIncomingRegForBlock(Inst, MBBtoMoveCmp);
1894 TII->get(PPC::PHI), NewVReg)
1917 if (IsPartiallyRedundant) {
1920 <<
" to handle partial redundancy.\n");
1932bool PPCMIPeephole::emitRLDICWhenLoweringJumpTables(MachineInstr &
MI,
1933 MachineInstr *&ToErase) {
1934 if (
MI.getOpcode() != PPC::RLDICR)
1941 MachineInstr *SrcMI = MRI->
getVRegDef(SrcReg);
1945 MachineOperand MOpSHSrc = SrcMI->
getOperand(2);
1946 MachineOperand MOpMBSrc = SrcMI->
getOperand(3);
1947 MachineOperand MOpSHMI =
MI.getOperand(2);
1948 MachineOperand MOpMEMI =
MI.getOperand(3);
1953 uint64_t SHSrc = MOpSHSrc.
getImm();
1954 uint64_t MBSrc = MOpMBSrc.
getImm();
1955 uint64_t SHMI = MOpSHMI.
getImm();
1956 uint64_t MEMI = MOpMEMI.
getImm();
1957 uint64_t NewSH = SHSrc + SHMI;
1958 uint64_t NewMB = MBSrc - SHMI;
1959 if (NewMB > 63 || NewSH > 63)
1968 if ((63 - NewSH) != MEMI)
1975 MI.setDesc(
TII->get(PPC::RLDIC));
1977 MI.getOperand(2).setImm(NewSH);
1978 MI.getOperand(3).setImm(NewMB);
1984 NumRotatesCollapsed++;
1988 "Not expecting an implicit def with this instr.");
2005bool PPCMIPeephole::combineSEXTAndSHL(MachineInstr &
MI,
2006 MachineInstr *&ToErase) {
2007 if (
MI.getOpcode() != PPC::RLDICR)
2010 if (!MF->getSubtarget<PPCSubtarget>().isISA3_0())
2013 assert(
MI.getNumOperands() == 4 &&
"RLDICR should have 4 operands");
2015 MachineOperand MOpSHMI =
MI.getOperand(2);
2016 MachineOperand MOpMEMI =
MI.getOperand(3);
2020 uint64_t SHMI = MOpSHMI.
getImm();
2021 uint64_t MEMI = MOpMEMI.
getImm();
2022 if (SHMI + MEMI != 63)
2029 MachineInstr *SrcMI = MRI->
getVRegDef(SrcReg);
2041 "EXTSW's second operand should be a register");
2049 MachineInstr *NewInstr =
2051 SrcMI->
getOpcode() == PPC::EXTSW ?
TII->get(PPC::EXTSWSLI)
2052 :
TII->get(PPC::EXTSWSLI_32_64),
2053 MI.getOperand(0).getReg())
2060 ++NumEXTSWAndSLDICombined;
2073 "PowerPC MI Peephole Optimization",
false,
false)
2081char PPCMIPeephole::ID = 0;
MachineInstrBuilder & UseMI
MachineInstrBuilder MachineInstrBuilder & DefMI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file provides an implementation of debug counters.
#define DEBUG_COUNTER(VARNAME, COUNTERNAME, DESC)
static Register UseReg(const MachineOperand &MO)
const HexagonInstrInfo * TII
const size_t AbstractManglingParser< Derived, Alloc >::NumOps
Register const TargetRegisterInfo * TRI
Promote Memory to Register
#define addRegToUpdate(R)
static cl::opt< bool > EnableZExtElimination("ppc-eliminate-zeroext", cl::desc("enable elimination of zero-extensions"), cl::init(true), cl::Hidden)
static cl::opt< bool > FixedPointRegToImm("ppc-reg-to-imm-fixed-point", cl::Hidden, cl::init(true), cl::desc("Iterate to a fixed point when attempting to " "convert reg-reg instructions to reg-imm"))
static cl::opt< bool > EnableTrapOptimization("ppc-opt-conditional-trap", cl::desc("enable optimization of conditional traps"), cl::init(false), cl::Hidden)
static cl::opt< bool > ConvertRegReg("ppc-convert-rr-to-ri", cl::Hidden, cl::init(true), cl::desc("Convert eligible reg+reg instructions to reg+imm"))
static cl::opt< bool > EnableSExtElimination("ppc-eliminate-signext", cl::desc("enable elimination of sign-extensions"), cl::init(true), cl::Hidden)
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T, const llvm::StringTable &StandardNames, VectorLibrary VecLib)
Initialize the set of available library functions based on the specified target triple.
AnalysisUsage & addRequired()
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
static bool shouldExecute(CounterInfo &Counter)
ValueT lookup(const_arg_type_t< KeyT > Val) const
Return the entry for the specified key, or a default constructed value if no such entry exists.
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
bool dominates(const DomTreeNodeBase< NodeT > *A, const DomTreeNodeBase< NodeT > *B) const
dominates - Returns true iff A dominates B.
FunctionPass class - This class is used to implement most global optimizations.
MaybeAlign getAlign() const
Returns the alignment of the given variable.
const HexagonRegisterInfo & getRegisterInfo() const
LLVM_ABI void recomputeForSingleDefVirtReg(Register Reg)
Recompute liveness from scratch for a virtual register Reg that is known to have a single def that do...
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
unsigned pred_size() const
LLVM_ABI iterator getFirstTerminator()
Returns an iterator to the first terminator instruction of this basic block.
SmallVectorImpl< MachineBasicBlock * >::iterator pred_iterator
pred_iterator pred_begin()
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
LLVM_ABI instr_iterator getFirstInstrTerminator()
Same getFirstTerminator but it ignores bundles and return an instr_iterator instead.
void splice(iterator Where, MachineBasicBlock *Other, iterator From)
Take an instruction from MBB 'Other' at the position From, and insert it into this MBB right before '...
MachineInstrBundleIterator< MachineInstr > iterator
LLVM_ABI BlockFrequency getBlockFreq(const MachineBasicBlock *MBB) const
getblockFreq - Return block frequency.
LLVM_ABI BlockFrequency getEntryFreq() const
Divide a block's BlockFrequency::getFrequency() value by this value to obtain the entry block - relat...
Analysis pass which computes a MachineDominatorTree.
bool dominates(const MachineInstr *A, const MachineInstr *B) const
bool hasVarSizedObjects() const
This method may be called any time after instruction selection is complete to determine if the stack ...
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
void dump() const
dump - Print the current MachineFunction to cerr, useful for debugger use.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
const MachineBasicBlock & front() const
const MachineInstrBuilder & addReg(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MachineInstrBuilder & add(const MachineOperand &MO) const
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
MachineInstr * getInstr() const
If conversion operators fail, use this method to get the MachineInstr explicitly.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
const MachineBasicBlock * getParent() const
unsigned getNumOperands() const
Retuns the total number of operands.
bool hasImplicitDef() const
Returns true if the instruction has implicit definition.
mop_range explicit_uses()
LLVM_ABI void setDesc(const MCInstrDesc &TID)
Replace the instruction descriptor (thus opcode) of the current instruction with a new one.
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
LLVM_ABI void removeOperand(unsigned OpNo)
Erase an operand from an instruction, leaving it with one fewer operand than it started with.
LLVM_ABI void dump() const
const MachineOperand & getOperand(unsigned i) const
LLVM_ABI MachineInstrBundleIterator< MachineInstr > eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
const GlobalValue * getGlobal() const
void setImm(int64_t immVal)
bool isReg() const
isReg - Tests if this is a MO_Register operand.
MachineBasicBlock * getMBB() const
LLVM_ABI void setReg(Register Reg)
Change the register this operand corresponds to.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
Register getReg() const
getReg - Returns the register number.
static MachineOperand CreateReg(Register Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isEarlyClobber=false, unsigned SubReg=0, bool isDebug=false, bool isInternalRead=false, bool isRenamable=false)
int64_t getOffset() const
Return the offset from the symbol in this operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
LLVM_ABI bool hasOneNonDBGUse(Register RegNo) const
hasOneNonDBGUse - Return true if there is exactly one non-Debug use of the specified register.
const TargetRegisterClass * getRegClass(Register Reg) const
Return the register class of the specified virtual register.
LLVM_ABI MachineInstr * getVRegDef(Register Reg) const
getVRegDef - Return the machine instr that defines the specified virtual register or null if none is ...
bool use_nodbg_empty(Register RegNo) const
use_nodbg_empty - Return true if there are no non-Debug instructions using the specified register.
LLVM_ABI Register createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
use_instr_nodbg_iterator use_instr_nodbg_begin(Register RegNo) const
LLVM_ABI bool hasOneNonDBGUser(Register RegNo) const
hasOneNonDBGUse - Return true if there is exactly one non-Debug instruction using the specified regis...
LLVM_ABI void setRegClass(Register Reg, const TargetRegisterClass *RC)
setRegClass - Set the register class of the specified virtual register.
const TargetRegisterClass * getRegClassOrNull(Register Reg) const
Return the register class of Reg, or null if Reg has not been assigned a register class yet.
iterator_range< use_instr_iterator > use_instructions(Register Reg) const
LLVM_ABI const TargetRegisterClass * constrainRegClass(Register Reg, const TargetRegisterClass *RC, unsigned MinNumRegs=0)
constrainRegClass - Constrain the register class of the specified virtual register to be a common sub...
bool reg_empty(Register RegNo) const
reg_empty - Return true if there are no instructions using or defining the specified register (it may...
LLVM_ABI MachineInstr * getUniqueVRegDef(Register Reg) const
getUniqueVRegDef - Return the unique machine instr that defines the specified virtual register or nul...
void setMustSaveTOC(bool U)
Wrapper class representing virtual and physical registers.
constexpr bool isVirtual() const
Return true if the specified register number is in the virtual register namespace.
size_type count(const T &V) const
count - Return 1 if the element is in the set, 0 otherwise.
std::pair< const_iterator, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
void push_back(const T &Elt)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Predicate getSwappedPredicate(Predicate Opcode)
Assume the condition register is set by MI(a,b), return the predicate if we modify the instructions s...
Predicate
Predicate - These are "(BI << 5) | BO" for various predicates.
unsigned getPredicateCondition(Predicate Opcode)
Return the condition without hint bits.
Predicate getPredicate(unsigned Condition, unsigned Hint)
Return predicate consisting of specified condition and hint bits.
unsigned getPredicateHint(Predicate Opcode)
Return the hint bits of the predicate.
initializer< Ty > init(const Ty &Val)
NodeAddr< InstrNode * > Instr
NodeAddr< PhiNode * > Phi
NodeAddr< UseNode * > Use
This is an optimization pass for GlobalISel generic memory operations.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
int countr_zero(T Val)
Count number of 0's from the least significant bit to the most stopping at the first 1.
int countl_zero(T Val)
Count number of 0's from the most significant bit to the least stopping at the first 1.
auto reverse(ContainerTy &&C)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
DWARFExpression::Operation Op
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
LLVM_ABI 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.
@ Keep
No function return thunk.
LLVM_ABI Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.
FunctionPass * createPPCMIPeepholePass()
MCRegisterClass TargetRegisterClass
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.