1*9880d681SAndroid Build Coastguard Worker //===- HexagonInstrInfo.h - Hexagon Instruction Information -----*- C++ -*-===// 2*9880d681SAndroid Build Coastguard Worker // 3*9880d681SAndroid Build Coastguard Worker // The LLVM Compiler Infrastructure 4*9880d681SAndroid Build Coastguard Worker // 5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source 6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details. 7*9880d681SAndroid Build Coastguard Worker // 8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===// 9*9880d681SAndroid Build Coastguard Worker // 10*9880d681SAndroid Build Coastguard Worker // This file contains the Hexagon implementation of the TargetInstrInfo class. 11*9880d681SAndroid Build Coastguard Worker // 12*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===// 13*9880d681SAndroid Build Coastguard Worker 14*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONINSTRINFO_H 15*9880d681SAndroid Build Coastguard Worker #define LLVM_LIB_TARGET_HEXAGON_HEXAGONINSTRINFO_H 16*9880d681SAndroid Build Coastguard Worker 17*9880d681SAndroid Build Coastguard Worker #include "HexagonRegisterInfo.h" 18*9880d681SAndroid Build Coastguard Worker #include "MCTargetDesc/HexagonBaseInfo.h" 19*9880d681SAndroid Build Coastguard Worker #include "llvm/CodeGen/MachineBranchProbabilityInfo.h" 20*9880d681SAndroid Build Coastguard Worker #include "llvm/Target/TargetFrameLowering.h" 21*9880d681SAndroid Build Coastguard Worker #include "llvm/Target/TargetInstrInfo.h" 22*9880d681SAndroid Build Coastguard Worker 23*9880d681SAndroid Build Coastguard Worker #define GET_INSTRINFO_HEADER 24*9880d681SAndroid Build Coastguard Worker #include "HexagonGenInstrInfo.inc" 25*9880d681SAndroid Build Coastguard Worker 26*9880d681SAndroid Build Coastguard Worker namespace llvm { 27*9880d681SAndroid Build Coastguard Worker 28*9880d681SAndroid Build Coastguard Worker struct EVT; 29*9880d681SAndroid Build Coastguard Worker class HexagonSubtarget; 30*9880d681SAndroid Build Coastguard Worker 31*9880d681SAndroid Build Coastguard Worker class HexagonInstrInfo : public HexagonGenInstrInfo { 32*9880d681SAndroid Build Coastguard Worker virtual void anchor(); 33*9880d681SAndroid Build Coastguard Worker const HexagonRegisterInfo RI; 34*9880d681SAndroid Build Coastguard Worker 35*9880d681SAndroid Build Coastguard Worker public: 36*9880d681SAndroid Build Coastguard Worker explicit HexagonInstrInfo(HexagonSubtarget &ST); 37*9880d681SAndroid Build Coastguard Worker 38*9880d681SAndroid Build Coastguard Worker /// TargetInstrInfo overrides. 39*9880d681SAndroid Build Coastguard Worker /// 40*9880d681SAndroid Build Coastguard Worker 41*9880d681SAndroid Build Coastguard Worker /// If the specified machine instruction is a direct 42*9880d681SAndroid Build Coastguard Worker /// load from a stack slot, return the virtual or physical register number of 43*9880d681SAndroid Build Coastguard Worker /// the destination along with the FrameIndex of the loaded stack slot. If 44*9880d681SAndroid Build Coastguard Worker /// not, return 0. This predicate must return 0 if the instruction has 45*9880d681SAndroid Build Coastguard Worker /// any side effects other than loading from the stack slot. 46*9880d681SAndroid Build Coastguard Worker unsigned isLoadFromStackSlot(const MachineInstr &MI, 47*9880d681SAndroid Build Coastguard Worker int &FrameIndex) const override; 48*9880d681SAndroid Build Coastguard Worker 49*9880d681SAndroid Build Coastguard Worker /// If the specified machine instruction is a direct 50*9880d681SAndroid Build Coastguard Worker /// store to a stack slot, return the virtual or physical register number of 51*9880d681SAndroid Build Coastguard Worker /// the source reg along with the FrameIndex of the loaded stack slot. If 52*9880d681SAndroid Build Coastguard Worker /// not, return 0. This predicate must return 0 if the instruction has 53*9880d681SAndroid Build Coastguard Worker /// any side effects other than storing to the stack slot. 54*9880d681SAndroid Build Coastguard Worker unsigned isStoreToStackSlot(const MachineInstr &MI, 55*9880d681SAndroid Build Coastguard Worker int &FrameIndex) const override; 56*9880d681SAndroid Build Coastguard Worker 57*9880d681SAndroid Build Coastguard Worker /// Analyze the branching code at the end of MBB, returning 58*9880d681SAndroid Build Coastguard Worker /// true if it cannot be understood (e.g. it's a switch dispatch or isn't 59*9880d681SAndroid Build Coastguard Worker /// implemented for a target). Upon success, this returns false and returns 60*9880d681SAndroid Build Coastguard Worker /// with the following information in various cases: 61*9880d681SAndroid Build Coastguard Worker /// 62*9880d681SAndroid Build Coastguard Worker /// 1. If this block ends with no branches (it just falls through to its succ) 63*9880d681SAndroid Build Coastguard Worker /// just return false, leaving TBB/FBB null. 64*9880d681SAndroid Build Coastguard Worker /// 2. If this block ends with only an unconditional branch, it sets TBB to be 65*9880d681SAndroid Build Coastguard Worker /// the destination block. 66*9880d681SAndroid Build Coastguard Worker /// 3. If this block ends with a conditional branch and it falls through to a 67*9880d681SAndroid Build Coastguard Worker /// successor block, it sets TBB to be the branch destination block and a 68*9880d681SAndroid Build Coastguard Worker /// list of operands that evaluate the condition. These operands can be 69*9880d681SAndroid Build Coastguard Worker /// passed to other TargetInstrInfo methods to create new branches. 70*9880d681SAndroid Build Coastguard Worker /// 4. If this block ends with a conditional branch followed by an 71*9880d681SAndroid Build Coastguard Worker /// unconditional branch, it returns the 'true' destination in TBB, the 72*9880d681SAndroid Build Coastguard Worker /// 'false' destination in FBB, and a list of operands that evaluate the 73*9880d681SAndroid Build Coastguard Worker /// condition. These operands can be passed to other TargetInstrInfo 74*9880d681SAndroid Build Coastguard Worker /// methods to create new branches. 75*9880d681SAndroid Build Coastguard Worker /// 76*9880d681SAndroid Build Coastguard Worker /// Note that RemoveBranch and InsertBranch must be implemented to support 77*9880d681SAndroid Build Coastguard Worker /// cases where this method returns success. 78*9880d681SAndroid Build Coastguard Worker /// 79*9880d681SAndroid Build Coastguard Worker /// If AllowModify is true, then this routine is allowed to modify the basic 80*9880d681SAndroid Build Coastguard Worker /// block (e.g. delete instructions after the unconditional branch). 81*9880d681SAndroid Build Coastguard Worker /// 82*9880d681SAndroid Build Coastguard Worker bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, 83*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *&FBB, 84*9880d681SAndroid Build Coastguard Worker SmallVectorImpl<MachineOperand> &Cond, 85*9880d681SAndroid Build Coastguard Worker bool AllowModify) const override; 86*9880d681SAndroid Build Coastguard Worker 87*9880d681SAndroid Build Coastguard Worker /// Remove the branching code at the end of the specific MBB. 88*9880d681SAndroid Build Coastguard Worker /// This is only invoked in cases where AnalyzeBranch returns success. It 89*9880d681SAndroid Build Coastguard Worker /// returns the number of instructions that were removed. 90*9880d681SAndroid Build Coastguard Worker unsigned RemoveBranch(MachineBasicBlock &MBB) const override; 91*9880d681SAndroid Build Coastguard Worker 92*9880d681SAndroid Build Coastguard Worker /// Insert branch code into the end of the specified MachineBasicBlock. 93*9880d681SAndroid Build Coastguard Worker /// The operands to this method are the same as those 94*9880d681SAndroid Build Coastguard Worker /// returned by AnalyzeBranch. This is only invoked in cases where 95*9880d681SAndroid Build Coastguard Worker /// AnalyzeBranch returns success. It returns the number of instructions 96*9880d681SAndroid Build Coastguard Worker /// inserted. 97*9880d681SAndroid Build Coastguard Worker /// 98*9880d681SAndroid Build Coastguard Worker /// It is also invoked by tail merging to add unconditional branches in 99*9880d681SAndroid Build Coastguard Worker /// cases where AnalyzeBranch doesn't apply because there was no original 100*9880d681SAndroid Build Coastguard Worker /// branch to analyze. At least this much must be implemented, else tail 101*9880d681SAndroid Build Coastguard Worker /// merging needs to be disabled. 102*9880d681SAndroid Build Coastguard Worker unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, 103*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond, 104*9880d681SAndroid Build Coastguard Worker const DebugLoc &DL) const override; 105*9880d681SAndroid Build Coastguard Worker 106*9880d681SAndroid Build Coastguard Worker /// Analyze the loop code, return true if it cannot be understood. Upon 107*9880d681SAndroid Build Coastguard Worker /// success, this function returns false and returns information about the 108*9880d681SAndroid Build Coastguard Worker /// induction variable and compare instruction used at the end. 109*9880d681SAndroid Build Coastguard Worker bool analyzeLoop(MachineLoop &L, MachineInstr *&IndVarInst, 110*9880d681SAndroid Build Coastguard Worker MachineInstr *&CmpInst) const override; 111*9880d681SAndroid Build Coastguard Worker 112*9880d681SAndroid Build Coastguard Worker /// Generate code to reduce the loop iteration by one and check if the loop is 113*9880d681SAndroid Build Coastguard Worker /// finished. Return the value/register of the the new loop count. We need 114*9880d681SAndroid Build Coastguard Worker /// this function when peeling off one or more iterations of a loop. This 115*9880d681SAndroid Build Coastguard Worker /// function assumes the nth iteration is peeled first. 116*9880d681SAndroid Build Coastguard Worker unsigned reduceLoopCount(MachineBasicBlock &MBB, 117*9880d681SAndroid Build Coastguard Worker MachineInstr *IndVar, MachineInstr *Cmp, 118*9880d681SAndroid Build Coastguard Worker SmallVectorImpl<MachineOperand> &Cond, 119*9880d681SAndroid Build Coastguard Worker SmallVectorImpl<MachineInstr *> &PrevInsts, 120*9880d681SAndroid Build Coastguard Worker unsigned Iter, unsigned MaxIter) const override; 121*9880d681SAndroid Build Coastguard Worker 122*9880d681SAndroid Build Coastguard Worker /// Return true if it's profitable to predicate 123*9880d681SAndroid Build Coastguard Worker /// instructions with accumulated instruction latency of "NumCycles" 124*9880d681SAndroid Build Coastguard Worker /// of the specified basic block, where the probability of the instructions 125*9880d681SAndroid Build Coastguard Worker /// being executed is given by Probability, and Confidence is a measure 126*9880d681SAndroid Build Coastguard Worker /// of our confidence that it will be properly predicted. 127*9880d681SAndroid Build Coastguard Worker bool isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumCycles, 128*9880d681SAndroid Build Coastguard Worker unsigned ExtraPredCycles, 129*9880d681SAndroid Build Coastguard Worker BranchProbability Probability) const override; 130*9880d681SAndroid Build Coastguard Worker 131*9880d681SAndroid Build Coastguard Worker /// Second variant of isProfitableToIfCvt. This one 132*9880d681SAndroid Build Coastguard Worker /// checks for the case where two basic blocks from true and false path 133*9880d681SAndroid Build Coastguard Worker /// of a if-then-else (diamond) are predicated on mutally exclusive 134*9880d681SAndroid Build Coastguard Worker /// predicates, where the probability of the true path being taken is given 135*9880d681SAndroid Build Coastguard Worker /// by Probability, and Confidence is a measure of our confidence that it 136*9880d681SAndroid Build Coastguard Worker /// will be properly predicted. 137*9880d681SAndroid Build Coastguard Worker bool isProfitableToIfCvt(MachineBasicBlock &TMBB, 138*9880d681SAndroid Build Coastguard Worker unsigned NumTCycles, unsigned ExtraTCycles, 139*9880d681SAndroid Build Coastguard Worker MachineBasicBlock &FMBB, 140*9880d681SAndroid Build Coastguard Worker unsigned NumFCycles, unsigned ExtraFCycles, 141*9880d681SAndroid Build Coastguard Worker BranchProbability Probability) const override; 142*9880d681SAndroid Build Coastguard Worker 143*9880d681SAndroid Build Coastguard Worker /// Return true if it's profitable for if-converter to duplicate instructions 144*9880d681SAndroid Build Coastguard Worker /// of specified accumulated instruction latencies in the specified MBB to 145*9880d681SAndroid Build Coastguard Worker /// enable if-conversion. 146*9880d681SAndroid Build Coastguard Worker /// The probability of the instructions being executed is given by 147*9880d681SAndroid Build Coastguard Worker /// Probability, and Confidence is a measure of our confidence that it 148*9880d681SAndroid Build Coastguard Worker /// will be properly predicted. 149*9880d681SAndroid Build Coastguard Worker bool isProfitableToDupForIfCvt(MachineBasicBlock &MBB, unsigned NumCycles, 150*9880d681SAndroid Build Coastguard Worker BranchProbability Probability) const override; 151*9880d681SAndroid Build Coastguard Worker 152*9880d681SAndroid Build Coastguard Worker /// Emit instructions to copy a pair of physical registers. 153*9880d681SAndroid Build Coastguard Worker /// 154*9880d681SAndroid Build Coastguard Worker /// This function should support copies within any legal register class as 155*9880d681SAndroid Build Coastguard Worker /// well as any cross-class copies created during instruction selection. 156*9880d681SAndroid Build Coastguard Worker /// 157*9880d681SAndroid Build Coastguard Worker /// The source and destination registers may overlap, which may require a 158*9880d681SAndroid Build Coastguard Worker /// careful implementation when multiple copy instructions are required for 159*9880d681SAndroid Build Coastguard Worker /// large registers. See for example the ARM target. 160*9880d681SAndroid Build Coastguard Worker void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, 161*9880d681SAndroid Build Coastguard Worker const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, 162*9880d681SAndroid Build Coastguard Worker bool KillSrc) const override; 163*9880d681SAndroid Build Coastguard Worker 164*9880d681SAndroid Build Coastguard Worker /// Store the specified register of the given register class to the specified 165*9880d681SAndroid Build Coastguard Worker /// stack frame index. The store instruction is to be added to the given 166*9880d681SAndroid Build Coastguard Worker /// machine basic block before the specified machine instruction. If isKill 167*9880d681SAndroid Build Coastguard Worker /// is true, the register operand is the last use and must be marked kill. 168*9880d681SAndroid Build Coastguard Worker void storeRegToStackSlot(MachineBasicBlock &MBB, 169*9880d681SAndroid Build Coastguard Worker MachineBasicBlock::iterator MBBI, 170*9880d681SAndroid Build Coastguard Worker unsigned SrcReg, bool isKill, int FrameIndex, 171*9880d681SAndroid Build Coastguard Worker const TargetRegisterClass *RC, 172*9880d681SAndroid Build Coastguard Worker const TargetRegisterInfo *TRI) const override; 173*9880d681SAndroid Build Coastguard Worker 174*9880d681SAndroid Build Coastguard Worker /// Load the specified register of the given register class from the specified 175*9880d681SAndroid Build Coastguard Worker /// stack frame index. The load instruction is to be added to the given 176*9880d681SAndroid Build Coastguard Worker /// machine basic block before the specified machine instruction. 177*9880d681SAndroid Build Coastguard Worker void loadRegFromStackSlot(MachineBasicBlock &MBB, 178*9880d681SAndroid Build Coastguard Worker MachineBasicBlock::iterator MBBI, 179*9880d681SAndroid Build Coastguard Worker unsigned DestReg, int FrameIndex, 180*9880d681SAndroid Build Coastguard Worker const TargetRegisterClass *RC, 181*9880d681SAndroid Build Coastguard Worker const TargetRegisterInfo *TRI) const override; 182*9880d681SAndroid Build Coastguard Worker 183*9880d681SAndroid Build Coastguard Worker /// This function is called for all pseudo instructions 184*9880d681SAndroid Build Coastguard Worker /// that remain after register allocation. Many pseudo instructions are 185*9880d681SAndroid Build Coastguard Worker /// created to help register allocation. This is the place to convert them 186*9880d681SAndroid Build Coastguard Worker /// into real instructions. The target can edit MI in place, or it can insert 187*9880d681SAndroid Build Coastguard Worker /// new instructions and erase MI. The function should return true if 188*9880d681SAndroid Build Coastguard Worker /// anything was changed. 189*9880d681SAndroid Build Coastguard Worker bool expandPostRAPseudo(MachineInstr &MI) const override; 190*9880d681SAndroid Build Coastguard Worker 191*9880d681SAndroid Build Coastguard Worker /// \brief Get the base register and byte offset of a load/store instr. 192*9880d681SAndroid Build Coastguard Worker bool getMemOpBaseRegImmOfs(MachineInstr &LdSt, unsigned &BaseReg, 193*9880d681SAndroid Build Coastguard Worker int64_t &Offset, 194*9880d681SAndroid Build Coastguard Worker const TargetRegisterInfo *TRI) const override; 195*9880d681SAndroid Build Coastguard Worker 196*9880d681SAndroid Build Coastguard Worker /// Reverses the branch condition of the specified condition list, 197*9880d681SAndroid Build Coastguard Worker /// returning false on success and true if it cannot be reversed. 198*9880d681SAndroid Build Coastguard Worker bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) 199*9880d681SAndroid Build Coastguard Worker const override; 200*9880d681SAndroid Build Coastguard Worker 201*9880d681SAndroid Build Coastguard Worker /// Insert a noop into the instruction stream at the specified point. 202*9880d681SAndroid Build Coastguard Worker void insertNoop(MachineBasicBlock &MBB, 203*9880d681SAndroid Build Coastguard Worker MachineBasicBlock::iterator MI) const override; 204*9880d681SAndroid Build Coastguard Worker 205*9880d681SAndroid Build Coastguard Worker /// Returns true if the instruction is already predicated. 206*9880d681SAndroid Build Coastguard Worker bool isPredicated(const MachineInstr &MI) const override; 207*9880d681SAndroid Build Coastguard Worker 208*9880d681SAndroid Build Coastguard Worker /// Convert the instruction into a predicated instruction. 209*9880d681SAndroid Build Coastguard Worker /// It returns true if the operation was successful. 210*9880d681SAndroid Build Coastguard Worker bool PredicateInstruction(MachineInstr &MI, 211*9880d681SAndroid Build Coastguard Worker ArrayRef<MachineOperand> Cond) const override; 212*9880d681SAndroid Build Coastguard Worker 213*9880d681SAndroid Build Coastguard Worker /// Returns true if the first specified predicate 214*9880d681SAndroid Build Coastguard Worker /// subsumes the second, e.g. GE subsumes GT. 215*9880d681SAndroid Build Coastguard Worker bool SubsumesPredicate(ArrayRef<MachineOperand> Pred1, 216*9880d681SAndroid Build Coastguard Worker ArrayRef<MachineOperand> Pred2) const override; 217*9880d681SAndroid Build Coastguard Worker 218*9880d681SAndroid Build Coastguard Worker /// If the specified instruction defines any predicate 219*9880d681SAndroid Build Coastguard Worker /// or condition code register(s) used for predication, returns true as well 220*9880d681SAndroid Build Coastguard Worker /// as the definition predicate(s) by reference. 221*9880d681SAndroid Build Coastguard Worker bool DefinesPredicate(MachineInstr &MI, 222*9880d681SAndroid Build Coastguard Worker std::vector<MachineOperand> &Pred) const override; 223*9880d681SAndroid Build Coastguard Worker 224*9880d681SAndroid Build Coastguard Worker /// Return true if the specified instruction can be predicated. 225*9880d681SAndroid Build Coastguard Worker /// By default, this returns true for every instruction with a 226*9880d681SAndroid Build Coastguard Worker /// PredicateOperand. 227*9880d681SAndroid Build Coastguard Worker bool isPredicable(MachineInstr &MI) const override; 228*9880d681SAndroid Build Coastguard Worker 229*9880d681SAndroid Build Coastguard Worker /// Test if the given instruction should be considered a scheduling boundary. 230*9880d681SAndroid Build Coastguard Worker /// This primarily includes labels and terminators. 231*9880d681SAndroid Build Coastguard Worker bool isSchedulingBoundary(const MachineInstr &MI, 232*9880d681SAndroid Build Coastguard Worker const MachineBasicBlock *MBB, 233*9880d681SAndroid Build Coastguard Worker const MachineFunction &MF) const override; 234*9880d681SAndroid Build Coastguard Worker 235*9880d681SAndroid Build Coastguard Worker /// Measure the specified inline asm to determine an approximation of its 236*9880d681SAndroid Build Coastguard Worker /// length. 237*9880d681SAndroid Build Coastguard Worker unsigned getInlineAsmLength(const char *Str, 238*9880d681SAndroid Build Coastguard Worker const MCAsmInfo &MAI) const override; 239*9880d681SAndroid Build Coastguard Worker 240*9880d681SAndroid Build Coastguard Worker /// Allocate and return a hazard recognizer to use for this target when 241*9880d681SAndroid Build Coastguard Worker /// scheduling the machine instructions after register allocation. 242*9880d681SAndroid Build Coastguard Worker ScheduleHazardRecognizer* 243*9880d681SAndroid Build Coastguard Worker CreateTargetPostRAHazardRecognizer(const InstrItineraryData*, 244*9880d681SAndroid Build Coastguard Worker const ScheduleDAG *DAG) const override; 245*9880d681SAndroid Build Coastguard Worker 246*9880d681SAndroid Build Coastguard Worker /// For a comparison instruction, return the source registers 247*9880d681SAndroid Build Coastguard Worker /// in SrcReg and SrcReg2 if having two register operands, and the value it 248*9880d681SAndroid Build Coastguard Worker /// compares against in CmpValue. Return true if the comparison instruction 249*9880d681SAndroid Build Coastguard Worker /// can be analyzed. 250*9880d681SAndroid Build Coastguard Worker bool analyzeCompare(const MachineInstr &MI, unsigned &SrcReg, 251*9880d681SAndroid Build Coastguard Worker unsigned &SrcReg2, int &Mask, int &Value) const override; 252*9880d681SAndroid Build Coastguard Worker 253*9880d681SAndroid Build Coastguard Worker /// Compute the instruction latency of a given instruction. 254*9880d681SAndroid Build Coastguard Worker /// If the instruction has higher cost when predicated, it's returned via 255*9880d681SAndroid Build Coastguard Worker /// PredCost. 256*9880d681SAndroid Build Coastguard Worker unsigned getInstrLatency(const InstrItineraryData *ItinData, 257*9880d681SAndroid Build Coastguard Worker const MachineInstr &MI, 258*9880d681SAndroid Build Coastguard Worker unsigned *PredCost = 0) const override; 259*9880d681SAndroid Build Coastguard Worker 260*9880d681SAndroid Build Coastguard Worker /// Create machine specific model for scheduling. 261*9880d681SAndroid Build Coastguard Worker DFAPacketizer * 262*9880d681SAndroid Build Coastguard Worker CreateTargetScheduleState(const TargetSubtargetInfo &STI) const override; 263*9880d681SAndroid Build Coastguard Worker 264*9880d681SAndroid Build Coastguard Worker // Sometimes, it is possible for the target 265*9880d681SAndroid Build Coastguard Worker // to tell, even without aliasing information, that two MIs access different 266*9880d681SAndroid Build Coastguard Worker // memory addresses. This function returns true if two MIs access different 267*9880d681SAndroid Build Coastguard Worker // memory addresses and false otherwise. 268*9880d681SAndroid Build Coastguard Worker bool 269*9880d681SAndroid Build Coastguard Worker areMemAccessesTriviallyDisjoint(MachineInstr &MIa, MachineInstr &MIb, 270*9880d681SAndroid Build Coastguard Worker AliasAnalysis *AA = nullptr) const override; 271*9880d681SAndroid Build Coastguard Worker 272*9880d681SAndroid Build Coastguard Worker /// For instructions with a base and offset, return the position of the 273*9880d681SAndroid Build Coastguard Worker /// base register and offset operands. 274*9880d681SAndroid Build Coastguard Worker bool getBaseAndOffsetPosition(const MachineInstr *MI, unsigned &BasePos, 275*9880d681SAndroid Build Coastguard Worker unsigned &OffsetPos) const override; 276*9880d681SAndroid Build Coastguard Worker 277*9880d681SAndroid Build Coastguard Worker /// If the instruction is an increment of a constant value, return the amount. 278*9880d681SAndroid Build Coastguard Worker bool getIncrementValue(const MachineInstr *MI, int &Value) const override; 279*9880d681SAndroid Build Coastguard Worker 280*9880d681SAndroid Build Coastguard Worker /// HexagonInstrInfo specifics. 281*9880d681SAndroid Build Coastguard Worker /// 282*9880d681SAndroid Build Coastguard Worker getRegisterInfo()283*9880d681SAndroid Build Coastguard Worker const HexagonRegisterInfo &getRegisterInfo() const { return RI; } 284*9880d681SAndroid Build Coastguard Worker 285*9880d681SAndroid Build Coastguard Worker unsigned createVR(MachineFunction* MF, MVT VT) const; 286*9880d681SAndroid Build Coastguard Worker 287*9880d681SAndroid Build Coastguard Worker bool isAbsoluteSet(const MachineInstr* MI) const; 288*9880d681SAndroid Build Coastguard Worker bool isAccumulator(const MachineInstr *MI) const; 289*9880d681SAndroid Build Coastguard Worker bool isComplex(const MachineInstr *MI) const; 290*9880d681SAndroid Build Coastguard Worker bool isCompoundBranchInstr(const MachineInstr *MI) const; 291*9880d681SAndroid Build Coastguard Worker bool isCondInst(const MachineInstr *MI) const; 292*9880d681SAndroid Build Coastguard Worker bool isConditionalALU32 (const MachineInstr* MI) const; 293*9880d681SAndroid Build Coastguard Worker bool isConditionalLoad(const MachineInstr* MI) const; 294*9880d681SAndroid Build Coastguard Worker bool isConditionalStore(const MachineInstr* MI) const; 295*9880d681SAndroid Build Coastguard Worker bool isConditionalTransfer(const MachineInstr* MI) const; 296*9880d681SAndroid Build Coastguard Worker bool isConstExtended(const MachineInstr *MI) const; 297*9880d681SAndroid Build Coastguard Worker bool isDeallocRet(const MachineInstr *MI) const; 298*9880d681SAndroid Build Coastguard Worker bool isDependent(const MachineInstr *ProdMI, 299*9880d681SAndroid Build Coastguard Worker const MachineInstr *ConsMI) const; 300*9880d681SAndroid Build Coastguard Worker bool isDotCurInst(const MachineInstr* MI) const; 301*9880d681SAndroid Build Coastguard Worker bool isDotNewInst(const MachineInstr* MI) const; 302*9880d681SAndroid Build Coastguard Worker bool isDuplexPair(const MachineInstr *MIa, const MachineInstr *MIb) const; 303*9880d681SAndroid Build Coastguard Worker bool isEarlySourceInstr(const MachineInstr *MI) const; 304*9880d681SAndroid Build Coastguard Worker bool isEndLoopN(unsigned Opcode) const; 305*9880d681SAndroid Build Coastguard Worker bool isExpr(unsigned OpType) const; 306*9880d681SAndroid Build Coastguard Worker bool isExtendable(const MachineInstr* MI) const; 307*9880d681SAndroid Build Coastguard Worker bool isExtended(const MachineInstr* MI) const; 308*9880d681SAndroid Build Coastguard Worker bool isFloat(const MachineInstr *MI) const; 309*9880d681SAndroid Build Coastguard Worker bool isHVXMemWithAIndirect(const MachineInstr *I, 310*9880d681SAndroid Build Coastguard Worker const MachineInstr *J) const; 311*9880d681SAndroid Build Coastguard Worker bool isIndirectCall(const MachineInstr *MI) const; 312*9880d681SAndroid Build Coastguard Worker bool isIndirectL4Return(const MachineInstr *MI) const; 313*9880d681SAndroid Build Coastguard Worker bool isJumpR(const MachineInstr *MI) const; 314*9880d681SAndroid Build Coastguard Worker bool isJumpWithinBranchRange(const MachineInstr *MI, unsigned offset) const; 315*9880d681SAndroid Build Coastguard Worker bool isLateInstrFeedsEarlyInstr(const MachineInstr *LRMI, 316*9880d681SAndroid Build Coastguard Worker const MachineInstr *ESMI) const; 317*9880d681SAndroid Build Coastguard Worker bool isLateResultInstr(const MachineInstr *MI) const; 318*9880d681SAndroid Build Coastguard Worker bool isLateSourceInstr(const MachineInstr *MI) const; 319*9880d681SAndroid Build Coastguard Worker bool isLoopN(const MachineInstr *MI) const; 320*9880d681SAndroid Build Coastguard Worker bool isMemOp(const MachineInstr *MI) const; 321*9880d681SAndroid Build Coastguard Worker bool isNewValue(const MachineInstr* MI) const; 322*9880d681SAndroid Build Coastguard Worker bool isNewValue(unsigned Opcode) const; 323*9880d681SAndroid Build Coastguard Worker bool isNewValueInst(const MachineInstr* MI) const; 324*9880d681SAndroid Build Coastguard Worker bool isNewValueJump(const MachineInstr* MI) const; 325*9880d681SAndroid Build Coastguard Worker bool isNewValueJump(unsigned Opcode) const; 326*9880d681SAndroid Build Coastguard Worker bool isNewValueStore(const MachineInstr* MI) const; 327*9880d681SAndroid Build Coastguard Worker bool isNewValueStore(unsigned Opcode) const; 328*9880d681SAndroid Build Coastguard Worker bool isOperandExtended(const MachineInstr *MI, unsigned OperandNum) const; 329*9880d681SAndroid Build Coastguard Worker bool isPostIncrement(const MachineInstr* MI) const override; 330*9880d681SAndroid Build Coastguard Worker bool isPredicatedNew(const MachineInstr &MI) const; 331*9880d681SAndroid Build Coastguard Worker bool isPredicatedNew(unsigned Opcode) const; 332*9880d681SAndroid Build Coastguard Worker bool isPredicatedTrue(const MachineInstr &MI) const; 333*9880d681SAndroid Build Coastguard Worker bool isPredicatedTrue(unsigned Opcode) const; 334*9880d681SAndroid Build Coastguard Worker bool isPredicated(unsigned Opcode) const; 335*9880d681SAndroid Build Coastguard Worker bool isPredicateLate(unsigned Opcode) const; 336*9880d681SAndroid Build Coastguard Worker bool isPredictedTaken(unsigned Opcode) const; 337*9880d681SAndroid Build Coastguard Worker bool isSaveCalleeSavedRegsCall(const MachineInstr *MI) const; 338*9880d681SAndroid Build Coastguard Worker bool isSignExtendingLoad(const MachineInstr &MI) const; 339*9880d681SAndroid Build Coastguard Worker bool isSolo(const MachineInstr* MI) const; 340*9880d681SAndroid Build Coastguard Worker bool isSpillPredRegOp(const MachineInstr *MI) const; 341*9880d681SAndroid Build Coastguard Worker bool isTailCall(const MachineInstr *MI) const; 342*9880d681SAndroid Build Coastguard Worker bool isTC1(const MachineInstr *MI) const; 343*9880d681SAndroid Build Coastguard Worker bool isTC2(const MachineInstr *MI) const; 344*9880d681SAndroid Build Coastguard Worker bool isTC2Early(const MachineInstr *MI) const; 345*9880d681SAndroid Build Coastguard Worker bool isTC4x(const MachineInstr *MI) const; 346*9880d681SAndroid Build Coastguard Worker bool isV60VectorInstruction(const MachineInstr *MI) const; 347*9880d681SAndroid Build Coastguard Worker bool isValidAutoIncImm(const EVT VT, const int Offset) const; 348*9880d681SAndroid Build Coastguard Worker bool isValidOffset(unsigned Opcode, int Offset, bool Extend = true) const; 349*9880d681SAndroid Build Coastguard Worker bool isVecAcc(const MachineInstr *MI) const; 350*9880d681SAndroid Build Coastguard Worker bool isVecALU(const MachineInstr *MI) const; 351*9880d681SAndroid Build Coastguard Worker bool isVecUsableNextPacket(const MachineInstr *ProdMI, 352*9880d681SAndroid Build Coastguard Worker const MachineInstr *ConsMI) const; 353*9880d681SAndroid Build Coastguard Worker bool isZeroExtendingLoad(const MachineInstr &MI) const; 354*9880d681SAndroid Build Coastguard Worker 355*9880d681SAndroid Build Coastguard Worker bool canExecuteInBundle(const MachineInstr *First, 356*9880d681SAndroid Build Coastguard Worker const MachineInstr *Second) const; 357*9880d681SAndroid Build Coastguard Worker bool hasEHLabel(const MachineBasicBlock *B) const; 358*9880d681SAndroid Build Coastguard Worker bool hasNonExtEquivalent(const MachineInstr *MI) const; 359*9880d681SAndroid Build Coastguard Worker bool hasPseudoInstrPair(const MachineInstr *MI) const; 360*9880d681SAndroid Build Coastguard Worker bool hasUncondBranch(const MachineBasicBlock *B) const; 361*9880d681SAndroid Build Coastguard Worker bool mayBeCurLoad(const MachineInstr* MI) const; 362*9880d681SAndroid Build Coastguard Worker bool mayBeNewStore(const MachineInstr* MI) const; 363*9880d681SAndroid Build Coastguard Worker bool producesStall(const MachineInstr *ProdMI, 364*9880d681SAndroid Build Coastguard Worker const MachineInstr *ConsMI) const; 365*9880d681SAndroid Build Coastguard Worker bool producesStall(const MachineInstr *MI, 366*9880d681SAndroid Build Coastguard Worker MachineBasicBlock::const_instr_iterator MII) const; 367*9880d681SAndroid Build Coastguard Worker bool predCanBeUsedAsDotNew(const MachineInstr *MI, unsigned PredReg) const; 368*9880d681SAndroid Build Coastguard Worker bool PredOpcodeHasJMP_c(unsigned Opcode) const; 369*9880d681SAndroid Build Coastguard Worker bool predOpcodeHasNot(ArrayRef<MachineOperand> Cond) const; 370*9880d681SAndroid Build Coastguard Worker 371*9880d681SAndroid Build Coastguard Worker 372*9880d681SAndroid Build Coastguard Worker short getAbsoluteForm(const MachineInstr *MI) const; 373*9880d681SAndroid Build Coastguard Worker unsigned getAddrMode(const MachineInstr* MI) const; 374*9880d681SAndroid Build Coastguard Worker unsigned getBaseAndOffset(const MachineInstr *MI, int &Offset, 375*9880d681SAndroid Build Coastguard Worker unsigned &AccessSize) const; 376*9880d681SAndroid Build Coastguard Worker short getBaseWithLongOffset(short Opcode) const; 377*9880d681SAndroid Build Coastguard Worker short getBaseWithLongOffset(const MachineInstr *MI) const; 378*9880d681SAndroid Build Coastguard Worker short getBaseWithRegOffset(const MachineInstr *MI) const; 379*9880d681SAndroid Build Coastguard Worker SmallVector<MachineInstr*,2> getBranchingInstrs(MachineBasicBlock& MBB) const; 380*9880d681SAndroid Build Coastguard Worker unsigned getCExtOpNum(const MachineInstr *MI) const; 381*9880d681SAndroid Build Coastguard Worker HexagonII::CompoundGroup 382*9880d681SAndroid Build Coastguard Worker getCompoundCandidateGroup(const MachineInstr *MI) const; 383*9880d681SAndroid Build Coastguard Worker unsigned getCompoundOpcode(const MachineInstr *GA, 384*9880d681SAndroid Build Coastguard Worker const MachineInstr *GB) const; 385*9880d681SAndroid Build Coastguard Worker int getCondOpcode(int Opc, bool sense) const; 386*9880d681SAndroid Build Coastguard Worker int getDotCurOp(const MachineInstr* MI) const; 387*9880d681SAndroid Build Coastguard Worker int getDotNewOp(const MachineInstr* MI) const; 388*9880d681SAndroid Build Coastguard Worker int getDotNewPredJumpOp(const MachineInstr *MI, 389*9880d681SAndroid Build Coastguard Worker const MachineBranchProbabilityInfo *MBPI) const; 390*9880d681SAndroid Build Coastguard Worker int getDotNewPredOp(const MachineInstr *MI, 391*9880d681SAndroid Build Coastguard Worker const MachineBranchProbabilityInfo *MBPI) const; 392*9880d681SAndroid Build Coastguard Worker int getDotOldOp(const int opc) const; 393*9880d681SAndroid Build Coastguard Worker HexagonII::SubInstructionGroup getDuplexCandidateGroup(const MachineInstr *MI) 394*9880d681SAndroid Build Coastguard Worker const; 395*9880d681SAndroid Build Coastguard Worker short getEquivalentHWInstr(const MachineInstr *MI) const; 396*9880d681SAndroid Build Coastguard Worker MachineInstr *getFirstNonDbgInst(MachineBasicBlock *BB) const; 397*9880d681SAndroid Build Coastguard Worker unsigned getInstrTimingClassLatency(const InstrItineraryData *ItinData, 398*9880d681SAndroid Build Coastguard Worker const MachineInstr *MI) const; 399*9880d681SAndroid Build Coastguard Worker bool getInvertedPredSense(SmallVectorImpl<MachineOperand> &Cond) const; 400*9880d681SAndroid Build Coastguard Worker unsigned getInvertedPredicatedOpcode(const int Opc) const; 401*9880d681SAndroid Build Coastguard Worker int getMaxValue(const MachineInstr *MI) const; 402*9880d681SAndroid Build Coastguard Worker unsigned getMemAccessSize(const MachineInstr* MI) const; 403*9880d681SAndroid Build Coastguard Worker int getMinValue(const MachineInstr *MI) const; 404*9880d681SAndroid Build Coastguard Worker short getNonExtOpcode(const MachineInstr *MI) const; 405*9880d681SAndroid Build Coastguard Worker bool getPredReg(ArrayRef<MachineOperand> Cond, unsigned &PredReg, 406*9880d681SAndroid Build Coastguard Worker unsigned &PredRegPos, unsigned &PredRegFlags) const; 407*9880d681SAndroid Build Coastguard Worker short getPseudoInstrPair(const MachineInstr *MI) const; 408*9880d681SAndroid Build Coastguard Worker short getRegForm(const MachineInstr *MI) const; 409*9880d681SAndroid Build Coastguard Worker unsigned getSize(const MachineInstr *MI) const; 410*9880d681SAndroid Build Coastguard Worker uint64_t getType(const MachineInstr* MI) const; 411*9880d681SAndroid Build Coastguard Worker unsigned getUnits(const MachineInstr* MI) const; 412*9880d681SAndroid Build Coastguard Worker unsigned getValidSubTargets(const unsigned Opcode) const; 413*9880d681SAndroid Build Coastguard Worker 414*9880d681SAndroid Build Coastguard Worker 415*9880d681SAndroid Build Coastguard Worker /// getInstrTimingClassLatency - Compute the instruction latency of a given 416*9880d681SAndroid Build Coastguard Worker /// instruction using Timing Class information, if available. 417*9880d681SAndroid Build Coastguard Worker unsigned nonDbgBBSize(const MachineBasicBlock *BB) const; 418*9880d681SAndroid Build Coastguard Worker unsigned nonDbgBundleSize(MachineBasicBlock::const_iterator BundleHead) const; 419*9880d681SAndroid Build Coastguard Worker 420*9880d681SAndroid Build Coastguard Worker 421*9880d681SAndroid Build Coastguard Worker void immediateExtend(MachineInstr *MI) const; 422*9880d681SAndroid Build Coastguard Worker bool invertAndChangeJumpTarget(MachineInstr* MI, 423*9880d681SAndroid Build Coastguard Worker MachineBasicBlock* NewTarget) const; 424*9880d681SAndroid Build Coastguard Worker void genAllInsnTimingClasses(MachineFunction &MF) const; 425*9880d681SAndroid Build Coastguard Worker bool reversePredSense(MachineInstr* MI) const; 426*9880d681SAndroid Build Coastguard Worker unsigned reversePrediction(unsigned Opcode) const; 427*9880d681SAndroid Build Coastguard Worker bool validateBranchCond(const ArrayRef<MachineOperand> &Cond) const; 428*9880d681SAndroid Build Coastguard Worker short xformRegToImmOffset(const MachineInstr *MI) const; 429*9880d681SAndroid Build Coastguard Worker }; 430*9880d681SAndroid Build Coastguard Worker 431*9880d681SAndroid Build Coastguard Worker } 432*9880d681SAndroid Build Coastguard Worker 433*9880d681SAndroid Build Coastguard Worker #endif 434