1 //===-- PPCInstrInfo.h - PowerPC Instruction Information --------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains the PowerPC implementation of the TargetInstrInfo class.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_POWERPC_PPCINSTRINFO_H
14 #define LLVM_LIB_TARGET_POWERPC_PPCINSTRINFO_H
15 
16 #include "PPCRegisterInfo.h"
17 #include "llvm/CodeGen/TargetInstrInfo.h"
18 
19 #define GET_INSTRINFO_HEADER
20 #include "PPCGenInstrInfo.inc"
21 
22 namespace llvm {
23 
24 /// PPCII - This namespace holds all of the PowerPC target-specific
25 /// per-instruction flags.  These must match the corresponding definitions in
26 /// PPC.td and PPCInstrFormats.td.
27 namespace PPCII {
28 enum {
29   // PPC970 Instruction Flags.  These flags describe the characteristics of the
30   // PowerPC 970 (aka G5) dispatch groups and how they are formed out of
31   // raw machine instructions.
32 
33   /// PPC970_First - This instruction starts a new dispatch group, so it will
34   /// always be the first one in the group.
35   PPC970_First = 0x1,
36 
37   /// PPC970_Single - This instruction starts a new dispatch group and
38   /// terminates it, so it will be the sole instruction in the group.
39   PPC970_Single = 0x2,
40 
41   /// PPC970_Cracked - This instruction is cracked into two pieces, requiring
42   /// two dispatch pipes to be available to issue.
43   PPC970_Cracked = 0x4,
44 
45   /// PPC970_Mask/Shift - This is a bitmask that selects the pipeline type that
46   /// an instruction is issued to.
47   PPC970_Shift = 3,
48   PPC970_Mask = 0x07 << PPC970_Shift
49 };
50 enum PPC970_Unit {
51   /// These are the various PPC970 execution unit pipelines.  Each instruction
52   /// is one of these.
53   PPC970_Pseudo = 0 << PPC970_Shift,   // Pseudo instruction
54   PPC970_FXU    = 1 << PPC970_Shift,   // Fixed Point (aka Integer/ALU) Unit
55   PPC970_LSU    = 2 << PPC970_Shift,   // Load Store Unit
56   PPC970_FPU    = 3 << PPC970_Shift,   // Floating Point Unit
57   PPC970_CRU    = 4 << PPC970_Shift,   // Control Register Unit
58   PPC970_VALU   = 5 << PPC970_Shift,   // Vector ALU
59   PPC970_VPERM  = 6 << PPC970_Shift,   // Vector Permute Unit
60   PPC970_BRU    = 7 << PPC970_Shift    // Branch Unit
61 };
62 
63 enum {
64   /// Shift count to bypass PPC970 flags
65   NewDef_Shift = 6,
66 
67   /// This instruction is an X-Form memory operation.
68   XFormMemOp = 0x1 << NewDef_Shift,
69   /// This instruction is prefixed.
70   Prefixed = 0x1 << (NewDef_Shift+1)
71 };
72 } // end namespace PPCII
73 
74 // Instructions that have an immediate form might be convertible to that
75 // form if the correct input is a result of a load immediate. In order to
76 // know whether the transformation is special, we might need to know some
77 // of the details of the two forms.
78 struct ImmInstrInfo {
79   // Is the immediate field in the immediate form signed or unsigned?
80   uint64_t SignedImm : 1;
81   // Does the immediate need to be a multiple of some value?
82   uint64_t ImmMustBeMultipleOf : 5;
83   // Is R0/X0 treated specially by the original r+r instruction?
84   // If so, in which operand?
85   uint64_t ZeroIsSpecialOrig : 3;
86   // Is R0/X0 treated specially by the new r+i instruction?
87   // If so, in which operand?
88   uint64_t ZeroIsSpecialNew : 3;
89   // Is the operation commutative?
90   uint64_t IsCommutative : 1;
91   // The operand number to check for add-immediate def.
92   uint64_t OpNoForForwarding : 3;
93   // The operand number for the immediate.
94   uint64_t ImmOpNo : 3;
95   // The opcode of the new instruction.
96   uint64_t ImmOpcode : 16;
97   // The size of the immediate.
98   uint64_t ImmWidth : 5;
99   // The immediate should be truncated to N bits.
100   uint64_t TruncateImmTo : 5;
101   // Is the instruction summing the operand
102   uint64_t IsSummingOperands : 1;
103 };
104 
105 // Information required to convert an instruction to just a materialized
106 // immediate.
107 struct LoadImmediateInfo {
108   unsigned Imm : 16;
109   unsigned Is64Bit : 1;
110   unsigned SetCR : 1;
111 };
112 
113 class PPCSubtarget;
114 class PPCInstrInfo : public PPCGenInstrInfo {
115   PPCSubtarget &Subtarget;
116   const PPCRegisterInfo RI;
117 
118   void StoreRegToStackSlot(MachineFunction &MF, unsigned SrcReg, bool isKill,
119                            int FrameIdx, const TargetRegisterClass *RC,
120                            SmallVectorImpl<MachineInstr *> &NewMIs) const;
121   void LoadRegFromStackSlot(MachineFunction &MF, const DebugLoc &DL,
122                             unsigned DestReg, int FrameIdx,
123                             const TargetRegisterClass *RC,
124                             SmallVectorImpl<MachineInstr *> &NewMIs) const;
125 
126   // If the inst has imm-form and one of its operand is produced by a LI,
127   // put the imm into the inst directly and remove the LI if possible.
128   bool transformToImmFormFedByLI(MachineInstr &MI, const ImmInstrInfo &III,
129                                  unsigned ConstantOpNo, MachineInstr &DefMI,
130                                  int64_t Imm) const;
131   // If the inst has imm-form and one of its operand is produced by an
132   // add-immediate, try to transform it when possible.
133   bool transformToImmFormFedByAdd(MachineInstr &MI, const ImmInstrInfo &III,
134                                   unsigned ConstantOpNo, MachineInstr &DefMI,
135                                   bool KillDefMI) const;
136   // Try to find that, if the instruction 'MI' contains any operand that
137   // could be forwarded from some inst that feeds it. If yes, return the
138   // Def of that operand. And OpNoForForwarding is the operand index in
139   // the 'MI' for that 'Def'. If we see another use of this Def between
140   // the Def and the MI, SeenIntermediateUse becomes 'true'.
141   MachineInstr *getForwardingDefMI(MachineInstr &MI,
142                                    unsigned &OpNoForForwarding,
143                                    bool &SeenIntermediateUse) const;
144 
145   // Can the user MI have it's source at index \p OpNoForForwarding
146   // forwarded from an add-immediate that feeds it?
147   bool isUseMIElgibleForForwarding(MachineInstr &MI, const ImmInstrInfo &III,
148                                    unsigned OpNoForForwarding) const;
149   bool isDefMIElgibleForForwarding(MachineInstr &DefMI,
150                                    const ImmInstrInfo &III,
151                                    MachineOperand *&ImmMO,
152                                    MachineOperand *&RegMO) const;
153   bool isImmElgibleForForwarding(const MachineOperand &ImmMO,
154                                  const MachineInstr &DefMI,
155                                  const ImmInstrInfo &III,
156                                  int64_t &Imm) const;
157   bool isRegElgibleForForwarding(const MachineOperand &RegMO,
158                                  const MachineInstr &DefMI,
159                                  const MachineInstr &MI, bool KillDefMI,
160                                  bool &IsFwdFeederRegKilled) const;
161   const unsigned *getStoreOpcodesForSpillArray() const;
162   const unsigned *getLoadOpcodesForSpillArray() const;
163   virtual void anchor();
164 
165 protected:
166   /// Commutes the operands in the given instruction.
167   /// The commutable operands are specified by their indices OpIdx1 and OpIdx2.
168   ///
169   /// Do not call this method for a non-commutable instruction or for
170   /// non-commutable pair of operand indices OpIdx1 and OpIdx2.
171   /// Even though the instruction is commutable, the method may still
172   /// fail to commute the operands, null pointer is returned in such cases.
173   ///
174   /// For example, we can commute rlwimi instructions, but only if the
175   /// rotate amt is zero.  We also have to munge the immediates a bit.
176   MachineInstr *commuteInstructionImpl(MachineInstr &MI, bool NewMI,
177                                        unsigned OpIdx1,
178                                        unsigned OpIdx2) const override;
179 
180 public:
181   explicit PPCInstrInfo(PPCSubtarget &STI);
182 
183   /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info.  As
184   /// such, whenever a client has an instance of instruction info, it should
185   /// always be able to get register info as well (through this method).
186   ///
187   const PPCRegisterInfo &getRegisterInfo() const { return RI; }
188 
189   bool isXFormMemOp(unsigned Opcode) const {
190     return get(Opcode).TSFlags & PPCII::XFormMemOp;
191   }
192   bool isPrefixed(unsigned Opcode) const {
193     return get(Opcode).TSFlags & PPCII::Prefixed;
194   }
195 
196   static bool isSameClassPhysRegCopy(unsigned Opcode) {
197     unsigned CopyOpcodes[] =
198       { PPC::OR, PPC::OR8, PPC::FMR, PPC::VOR, PPC::XXLOR, PPC::XXLORf,
199         PPC::XSCPSGNDP, PPC::MCRF, PPC::QVFMR, PPC::QVFMRs, PPC::QVFMRb,
200         PPC::CROR, PPC::EVOR, -1U };
201     for (int i = 0; CopyOpcodes[i] != -1U; i++)
202       if (Opcode == CopyOpcodes[i])
203         return true;
204     return false;
205   }
206 
207   ScheduleHazardRecognizer *
208   CreateTargetHazardRecognizer(const TargetSubtargetInfo *STI,
209                                const ScheduleDAG *DAG) const override;
210   ScheduleHazardRecognizer *
211   CreateTargetPostRAHazardRecognizer(const InstrItineraryData *II,
212                                      const ScheduleDAG *DAG) const override;
213 
214   unsigned getInstrLatency(const InstrItineraryData *ItinData,
215                            const MachineInstr &MI,
216                            unsigned *PredCost = nullptr) const override;
217 
218   int getOperandLatency(const InstrItineraryData *ItinData,
219                         const MachineInstr &DefMI, unsigned DefIdx,
220                         const MachineInstr &UseMI,
221                         unsigned UseIdx) const override;
222   int getOperandLatency(const InstrItineraryData *ItinData,
223                         SDNode *DefNode, unsigned DefIdx,
224                         SDNode *UseNode, unsigned UseIdx) const override {
225     return PPCGenInstrInfo::getOperandLatency(ItinData, DefNode, DefIdx,
226                                               UseNode, UseIdx);
227   }
228 
229   bool hasLowDefLatency(const TargetSchedModel &SchedModel,
230                         const MachineInstr &DefMI,
231                         unsigned DefIdx) const override {
232     // Machine LICM should hoist all instructions in low-register-pressure
233     // situations; none are sufficiently free to justify leaving in a loop
234     // body.
235     return false;
236   }
237 
238   bool useMachineCombiner() const override {
239     return true;
240   }
241 
242   /// Return true when there is potentially a faster code sequence
243   /// for an instruction chain ending in <Root>. All potential patterns are
244   /// output in the <Pattern> array.
245   bool getMachineCombinerPatterns(
246       MachineInstr &Root,
247       SmallVectorImpl<MachineCombinerPattern> &P) const override;
248 
249   bool isAssociativeAndCommutative(const MachineInstr &Inst) const override;
250 
251   void setSpecialOperandAttr(MachineInstr &OldMI1, MachineInstr &OldMI2,
252                              MachineInstr &NewMI1,
253                              MachineInstr &NewMI2) const override;
254 
255   bool isCoalescableExtInstr(const MachineInstr &MI,
256                              Register &SrcReg, Register &DstReg,
257                              unsigned &SubIdx) const override;
258   unsigned isLoadFromStackSlot(const MachineInstr &MI,
259                                int &FrameIndex) const override;
260   bool isReallyTriviallyReMaterializable(const MachineInstr &MI,
261                                          AAResults *AA) const override;
262   unsigned isStoreToStackSlot(const MachineInstr &MI,
263                               int &FrameIndex) const override;
264 
265   bool findCommutedOpIndices(const MachineInstr &MI, unsigned &SrcOpIdx1,
266                              unsigned &SrcOpIdx2) const override;
267 
268   void insertNoop(MachineBasicBlock &MBB,
269                   MachineBasicBlock::iterator MI) const override;
270 
271 
272   // Branch analysis.
273   bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
274                      MachineBasicBlock *&FBB,
275                      SmallVectorImpl<MachineOperand> &Cond,
276                      bool AllowModify) const override;
277   unsigned removeBranch(MachineBasicBlock &MBB,
278                         int *BytesRemoved = nullptr) const override;
279   unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
280                         MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond,
281                         const DebugLoc &DL,
282                         int *BytesAdded = nullptr) const override;
283 
284   // Select analysis.
285   bool canInsertSelect(const MachineBasicBlock &, ArrayRef<MachineOperand> Cond,
286                        Register, Register, Register, int &, int &,
287                        int &) const override;
288   void insertSelect(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
289                     const DebugLoc &DL, Register DstReg,
290                     ArrayRef<MachineOperand> Cond, Register TrueReg,
291                     Register FalseReg) const override;
292 
293   void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
294                    const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg,
295                    bool KillSrc) const override;
296 
297   void storeRegToStackSlot(MachineBasicBlock &MBB,
298                            MachineBasicBlock::iterator MBBI,
299                            Register SrcReg, bool isKill, int FrameIndex,
300                            const TargetRegisterClass *RC,
301                            const TargetRegisterInfo *TRI) const override;
302 
303   // Emits a register spill without updating the register class for vector
304   // registers. This ensures that when we spill a vector register the
305   // element order in the register is the same as it was in memory.
306   void storeRegToStackSlotNoUpd(MachineBasicBlock &MBB,
307                                 MachineBasicBlock::iterator MBBI,
308                                 unsigned SrcReg, bool isKill, int FrameIndex,
309                                 const TargetRegisterClass *RC,
310                                 const TargetRegisterInfo *TRI) const;
311 
312   void loadRegFromStackSlot(MachineBasicBlock &MBB,
313                             MachineBasicBlock::iterator MBBI,
314                             Register DestReg, int FrameIndex,
315                             const TargetRegisterClass *RC,
316                             const TargetRegisterInfo *TRI) const override;
317 
318   // Emits a register reload without updating the register class for vector
319   // registers. This ensures that when we reload a vector register the
320   // element order in the register is the same as it was in memory.
321   void loadRegFromStackSlotNoUpd(MachineBasicBlock &MBB,
322                                  MachineBasicBlock::iterator MBBI,
323                                  unsigned DestReg, int FrameIndex,
324                                  const TargetRegisterClass *RC,
325                                  const TargetRegisterInfo *TRI) const;
326 
327   unsigned getStoreOpcodeForSpill(unsigned Reg,
328                                   const TargetRegisterClass *RC = nullptr) const;
329 
330   unsigned getLoadOpcodeForSpill(unsigned Reg,
331                                  const TargetRegisterClass *RC = nullptr) const;
332 
333   bool
334   reverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const override;
335 
336   bool FoldImmediate(MachineInstr &UseMI, MachineInstr &DefMI, Register Reg,
337                      MachineRegisterInfo *MRI) const override;
338 
339   // If conversion by predication (only supported by some branch instructions).
340   // All of the profitability checks always return true; it is always
341   // profitable to use the predicated branches.
342   bool isProfitableToIfCvt(MachineBasicBlock &MBB,
343                           unsigned NumCycles, unsigned ExtraPredCycles,
344                           BranchProbability Probability) const override {
345     return true;
346   }
347 
348   bool isProfitableToIfCvt(MachineBasicBlock &TMBB,
349                            unsigned NumT, unsigned ExtraT,
350                            MachineBasicBlock &FMBB,
351                            unsigned NumF, unsigned ExtraF,
352                            BranchProbability Probability) const override;
353 
354   bool isProfitableToDupForIfCvt(MachineBasicBlock &MBB, unsigned NumCycles,
355                                  BranchProbability Probability) const override {
356     return true;
357   }
358 
359   bool isProfitableToUnpredicate(MachineBasicBlock &TMBB,
360                                  MachineBasicBlock &FMBB) const override {
361     return false;
362   }
363 
364   // Predication support.
365   bool isPredicated(const MachineInstr &MI) const override;
366 
367   bool PredicateInstruction(MachineInstr &MI,
368                             ArrayRef<MachineOperand> Pred) const override;
369 
370   bool SubsumesPredicate(ArrayRef<MachineOperand> Pred1,
371                          ArrayRef<MachineOperand> Pred2) const override;
372 
373   bool DefinesPredicate(MachineInstr &MI,
374                         std::vector<MachineOperand> &Pred) const override;
375 
376   // Comparison optimization.
377 
378   bool analyzeCompare(const MachineInstr &MI, Register &SrcReg,
379                       Register &SrcReg2, int &Mask, int &Value) const override;
380 
381   bool optimizeCompareInstr(MachineInstr &CmpInstr, Register SrcReg,
382                             Register SrcReg2, int Mask, int Value,
383                             const MachineRegisterInfo *MRI) const override;
384 
385 
386   /// Return true if get the base operand, byte offset of an instruction and
387   /// the memory width. Width is the size of memory that is being
388   /// loaded/stored (e.g. 1, 2, 4, 8).
389   bool getMemOperandWithOffsetWidth(const MachineInstr &LdSt,
390                                     const MachineOperand *&BaseOp,
391                                     int64_t &Offset, unsigned &Width,
392                                     const TargetRegisterInfo *TRI) const;
393 
394   /// Return true if two MIs access different memory addresses and false
395   /// otherwise
396   bool
397   areMemAccessesTriviallyDisjoint(const MachineInstr &MIa,
398                                   const MachineInstr &MIb) const override;
399 
400   /// GetInstSize - Return the number of bytes of code the specified
401   /// instruction may be.  This returns the maximum number of bytes.
402   ///
403   unsigned getInstSizeInBytes(const MachineInstr &MI) const override;
404 
405   void getNoop(MCInst &NopInst) const override;
406 
407   std::pair<unsigned, unsigned>
408   decomposeMachineOperandsTargetFlags(unsigned TF) const override;
409 
410   ArrayRef<std::pair<unsigned, const char *>>
411   getSerializableDirectMachineOperandTargetFlags() const override;
412 
413   ArrayRef<std::pair<unsigned, const char *>>
414   getSerializableBitmaskMachineOperandTargetFlags() const override;
415 
416   // Expand VSX Memory Pseudo instruction to either a VSX or a FP instruction.
417   bool expandVSXMemPseudo(MachineInstr &MI) const;
418 
419   // Lower pseudo instructions after register allocation.
420   bool expandPostRAPseudo(MachineInstr &MI) const override;
421 
422   static bool isVFRegister(unsigned Reg) {
423     return Reg >= PPC::VF0 && Reg <= PPC::VF31;
424   }
425   static bool isVRRegister(unsigned Reg) {
426     return Reg >= PPC::V0 && Reg <= PPC::V31;
427   }
428   const TargetRegisterClass *updatedRC(const TargetRegisterClass *RC) const;
429   static int getRecordFormOpcode(unsigned Opcode);
430 
431   bool isTOCSaveMI(const MachineInstr &MI) const;
432 
433   bool isSignOrZeroExtended(const MachineInstr &MI, bool SignExt,
434                             const unsigned PhiDepth) const;
435 
436   /// Return true if the output of the instruction is always a sign-extended,
437   /// i.e. 0 to 31-th bits are same as 32-th bit.
438   bool isSignExtended(const MachineInstr &MI, const unsigned depth = 0) const {
439     return isSignOrZeroExtended(MI, true, depth);
440   }
441 
442   /// Return true if the output of the instruction is always zero-extended,
443   /// i.e. 0 to 31-th bits are all zeros
444   bool isZeroExtended(const MachineInstr &MI, const unsigned depth = 0) const {
445    return isSignOrZeroExtended(MI, false, depth);
446   }
447 
448   bool convertToImmediateForm(MachineInstr &MI,
449                               MachineInstr **KilledDef = nullptr) const;
450   bool foldFrameOffset(MachineInstr &MI) const;
451   bool isADDIInstrEligibleForFolding(MachineInstr &ADDIMI, int64_t &Imm) const;
452   bool isADDInstrEligibleForFolding(MachineInstr &ADDMI) const;
453   bool isImmInstrEligibleForFolding(MachineInstr &MI, unsigned &BaseReg,
454                                     unsigned &XFormOpcode,
455                                     int64_t &OffsetOfImmInstr,
456                                     ImmInstrInfo &III) const;
457   bool isValidToBeChangedReg(MachineInstr *ADDMI, unsigned Index,
458                              MachineInstr *&ADDIMI, int64_t &OffsetAddi,
459                              int64_t OffsetImm) const;
460 
461   /// Fixup killed/dead flag for register \p RegNo between instructions [\p
462   /// StartMI, \p EndMI]. Some PostRA transformations may violate register
463   /// killed/dead flags semantics, this function can be called to fix up. Before
464   /// calling this function,
465   /// 1. Ensure that \p RegNo liveness is killed after instruction \p EndMI.
466   /// 2. Ensure that there is no new definition between (\p StartMI, \p EndMI)
467   ///    and possible definition for \p RegNo is \p StartMI or \p EndMI.
468   /// 3. Ensure that all instructions between [\p StartMI, \p EndMI] are in same
469   ///    basic block.
470   void fixupIsDeadOrKill(MachineInstr &StartMI, MachineInstr &EndMI,
471                          unsigned RegNo) const;
472   void replaceInstrWithLI(MachineInstr &MI, const LoadImmediateInfo &LII) const;
473   void replaceInstrOperandWithImm(MachineInstr &MI, unsigned OpNo,
474                                   int64_t Imm) const;
475 
476   bool instrHasImmForm(unsigned Opc, bool IsVFReg, ImmInstrInfo &III,
477                        bool PostRA) const;
478 
479   // In PostRA phase, try to find instruction defines \p Reg before \p MI.
480   // \p SeenIntermediate is set to true if uses between DefMI and \p MI exist.
481   MachineInstr *getDefMIPostRA(unsigned Reg, MachineInstr &MI,
482                                bool &SeenIntermediateUse) const;
483 
484   /// getRegNumForOperand - some operands use different numbering schemes
485   /// for the same registers. For example, a VSX instruction may have any of
486   /// vs0-vs63 allocated whereas an Altivec instruction could only have
487   /// vs32-vs63 allocated (numbered as v0-v31). This function returns the actual
488   /// register number needed for the opcode/operand number combination.
489   /// The operand number argument will be useful when we need to extend this
490   /// to instructions that use both Altivec and VSX numbering (for different
491   /// operands).
492   static unsigned getRegNumForOperand(const MCInstrDesc &Desc, unsigned Reg,
493                                       unsigned OpNo) {
494     int16_t regClass = Desc.OpInfo[OpNo].RegClass;
495     switch (regClass) {
496       // We store F0-F31, VF0-VF31 in MCOperand and it should be F0-F31,
497       // VSX32-VSX63 during encoding/disassembling
498       case PPC::VSSRCRegClassID:
499       case PPC::VSFRCRegClassID:
500         if (isVFRegister(Reg))
501           return PPC::VSX32 + (Reg - PPC::VF0);
502         break;
503       // We store VSL0-VSL31, V0-V31 in MCOperand and it should be VSL0-VSL31,
504       // VSX32-VSX63 during encoding/disassembling
505       case PPC::VSRCRegClassID:
506         if (isVRRegister(Reg))
507           return PPC::VSX32 + (Reg - PPC::V0);
508         break;
509       // Other RegClass doesn't need mapping
510       default:
511         break;
512     }
513     return Reg;
514   }
515 
516   /// Check \p Opcode is BDNZ (Decrement CTR and branch if it is still nonzero).
517   bool isBDNZ(unsigned Opcode) const;
518 
519   /// Find the hardware loop instruction used to set-up the specified loop.
520   /// On PPC, we have two instructions used to set-up the hardware loop
521   /// (MTCTRloop, MTCTR8loop) with corresponding endloop (BDNZ, BDNZ8)
522   /// instructions to indicate the end of a loop.
523   MachineInstr *
524   findLoopInstr(MachineBasicBlock &PreHeader,
525                 SmallPtrSet<MachineBasicBlock *, 8> &Visited) const;
526 
527   /// Analyze loop L, which must be a single-basic-block loop, and if the
528   /// conditions can be understood enough produce a PipelinerLoopInfo object.
529   std::unique_ptr<TargetInstrInfo::PipelinerLoopInfo>
530   analyzeLoopForPipelining(MachineBasicBlock *LoopBB) const override;
531 };
532 
533 }
534 
535 #endif
536