| Jia Liu | b22310f | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 1 | //===- HexagonInstrInfo.h - Hexagon Instruction Information -----*- C++ -*-===// |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains the Hexagon implementation of the TargetInstrInfo class. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 14 | #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONINSTRINFO_H |
| 15 | #define LLVM_LIB_TARGET_HEXAGON_HEXAGONINSTRINFO_H |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 16 | |
| Brendon Cahoon | 6f35837 | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 17 | #include "MCTargetDesc/HexagonBaseInfo.h" |
| Eugene Zelenko | b2ca1b3 | 2017-01-04 02:02:05 +0000 | [diff] [blame] | 18 | #include "llvm/ADT/ArrayRef.h" |
| 19 | #include "llvm/ADT/SmallVector.h" |
| 20 | #include "llvm/CodeGen/MachineBasicBlock.h" |
| David Blaikie | 3f833ed | 2017-11-08 01:01:31 +0000 | [diff] [blame] | 21 | #include "llvm/CodeGen/TargetInstrInfo.h" |
| David Blaikie | 36a0f22 | 2018-03-23 23:58:31 +0000 | [diff] [blame] | 22 | #include "llvm/IR/ValueTypes.h" |
| David Blaikie | 13e77db | 2018-03-23 23:58:25 +0000 | [diff] [blame] | 23 | #include "llvm/Support/MachineValueType.h" |
| Eugene Zelenko | b2ca1b3 | 2017-01-04 02:02:05 +0000 | [diff] [blame] | 24 | #include <cstdint> |
| 25 | #include <vector> |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 26 | |
| 27 | #define GET_INSTRINFO_HEADER |
| 28 | #include "HexagonGenInstrInfo.inc" |
| 29 | |
| 30 | namespace llvm { |
| 31 | |
| Eric Christopher | 234a1ec | 2015-03-12 06:07:16 +0000 | [diff] [blame] | 32 | class HexagonSubtarget; |
| Eugene Zelenko | 3b87336 | 2017-09-28 22:27:31 +0000 | [diff] [blame] | 33 | class MachineBranchProbabilityInfo; |
| 34 | class MachineFunction; |
| 35 | class MachineInstr; |
| 36 | class MachineOperand; |
| 37 | class TargetRegisterInfo; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 38 | |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 39 | class HexagonInstrInfo : public HexagonGenInstrInfo { |
| Krzysztof Parzyszek | 4697dde | 2017-10-04 18:00:15 +0000 | [diff] [blame] | 40 | const HexagonSubtarget &Subtarget; |
| Krzysztof Parzyszek | a8ab1b7 | 2017-12-11 18:57:54 +0000 | [diff] [blame] | 41 | |
| 42 | enum BundleAttribute { |
| 43 | memShufDisabledMask = 0x4 |
| 44 | }; |
| 45 | |
| Eugene Zelenko | b2ca1b3 | 2017-01-04 02:02:05 +0000 | [diff] [blame] | 46 | virtual void anchor(); |
| 47 | |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 48 | public: |
| 49 | explicit HexagonInstrInfo(HexagonSubtarget &ST); |
| 50 | |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 51 | /// TargetInstrInfo overrides. |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 52 | |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 53 | /// If the specified machine instruction is a direct |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 54 | /// load from a stack slot, return the virtual or physical register number of |
| 55 | /// the destination along with the FrameIndex of the loaded stack slot. If |
| 56 | /// not, return 0. This predicate must return 0 if the instruction has |
| 57 | /// any side effects other than loading from the stack slot. |
| Duncan P. N. Exon Smith | 9cfc75c | 2016-06-30 00:01:54 +0000 | [diff] [blame] | 58 | unsigned isLoadFromStackSlot(const MachineInstr &MI, |
| Craig Topper | 906c2cd | 2014-04-29 07:58:16 +0000 | [diff] [blame] | 59 | int &FrameIndex) const override; |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 60 | |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 61 | /// If the specified machine instruction is a direct |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 62 | /// store to a stack slot, return the virtual or physical register number of |
| 63 | /// the source reg along with the FrameIndex of the loaded stack slot. If |
| 64 | /// not, return 0. This predicate must return 0 if the instruction has |
| 65 | /// any side effects other than storing to the stack slot. |
| Duncan P. N. Exon Smith | 9cfc75c | 2016-06-30 00:01:54 +0000 | [diff] [blame] | 66 | unsigned isStoreToStackSlot(const MachineInstr &MI, |
| Craig Topper | 906c2cd | 2014-04-29 07:58:16 +0000 | [diff] [blame] | 67 | int &FrameIndex) const override; |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 68 | |
| Krzysztof Parzyszek | 275ffa4 | 2018-01-23 19:08:40 +0000 | [diff] [blame] | 69 | /// Check if the instruction or the bundle of instructions has |
| 70 | /// load from stack slots. Return the frameindex and machine memory operand |
| 71 | /// if true. |
| 72 | bool hasLoadFromStackSlot(const MachineInstr &MI, |
| 73 | const MachineMemOperand *&MMO, |
| 74 | int &FrameIndex) const override; |
| 75 | |
| 76 | /// Check if the instruction or the bundle of instructions has |
| 77 | /// store to stack slots. Return the frameindex and machine memory operand |
| 78 | /// if true. |
| 79 | bool hasStoreToStackSlot(const MachineInstr &MI, |
| 80 | const MachineMemOperand *&MMO, |
| 81 | int &FrameIndex) const override; |
| 82 | |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 83 | /// Analyze the branching code at the end of MBB, returning |
| 84 | /// true if it cannot be understood (e.g. it's a switch dispatch or isn't |
| 85 | /// implemented for a target). Upon success, this returns false and returns |
| 86 | /// with the following information in various cases: |
| 87 | /// |
| 88 | /// 1. If this block ends with no branches (it just falls through to its succ) |
| 89 | /// just return false, leaving TBB/FBB null. |
| 90 | /// 2. If this block ends with only an unconditional branch, it sets TBB to be |
| 91 | /// the destination block. |
| 92 | /// 3. If this block ends with a conditional branch and it falls through to a |
| 93 | /// successor block, it sets TBB to be the branch destination block and a |
| 94 | /// list of operands that evaluate the condition. These operands can be |
| 95 | /// passed to other TargetInstrInfo methods to create new branches. |
| 96 | /// 4. If this block ends with a conditional branch followed by an |
| 97 | /// unconditional branch, it returns the 'true' destination in TBB, the |
| 98 | /// 'false' destination in FBB, and a list of operands that evaluate the |
| 99 | /// condition. These operands can be passed to other TargetInstrInfo |
| 100 | /// methods to create new branches. |
| 101 | /// |
| Matt Arsenault | 1b9fc8e | 2016-09-14 20:43:16 +0000 | [diff] [blame] | 102 | /// Note that removeBranch and insertBranch must be implemented to support |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 103 | /// cases where this method returns success. |
| 104 | /// |
| 105 | /// If AllowModify is true, then this routine is allowed to modify the basic |
| 106 | /// block (e.g. delete instructions after the unconditional branch). |
| Jacques Pienaar | 71c30a1 | 2016-07-15 14:41:04 +0000 | [diff] [blame] | 107 | bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, |
| 108 | MachineBasicBlock *&FBB, |
| 109 | SmallVectorImpl<MachineOperand> &Cond, |
| 110 | bool AllowModify) const override; |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 111 | |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 112 | /// Remove the branching code at the end of the specific MBB. |
| 113 | /// This is only invoked in cases where AnalyzeBranch returns success. It |
| 114 | /// returns the number of instructions that were removed. |
| Matt Arsenault | 1b9fc8e | 2016-09-14 20:43:16 +0000 | [diff] [blame] | 115 | unsigned removeBranch(MachineBasicBlock &MBB, |
| Matt Arsenault | a2b036e | 2016-09-14 17:23:48 +0000 | [diff] [blame] | 116 | int *BytesRemoved = nullptr) const override; |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 117 | |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 118 | /// Insert branch code into the end of the specified MachineBasicBlock. |
| 119 | /// The operands to this method are the same as those |
| 120 | /// returned by AnalyzeBranch. This is only invoked in cases where |
| 121 | /// AnalyzeBranch returns success. It returns the number of instructions |
| 122 | /// inserted. |
| 123 | /// |
| 124 | /// It is also invoked by tail merging to add unconditional branches in |
| 125 | /// cases where AnalyzeBranch doesn't apply because there was no original |
| 126 | /// branch to analyze. At least this much must be implemented, else tail |
| 127 | /// merging needs to be disabled. |
| Matt Arsenault | e8e0f5c | 2016-09-14 17:24:15 +0000 | [diff] [blame] | 128 | unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, |
| Ahmed Bougacha | c88bf54 | 2015-06-11 19:30:37 +0000 | [diff] [blame] | 129 | MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond, |
| Matt Arsenault | a2b036e | 2016-09-14 17:23:48 +0000 | [diff] [blame] | 130 | const DebugLoc &DL, |
| 131 | int *BytesAdded = nullptr) const override; |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 132 | |
| Brendon Cahoon | 254f889 | 2016-07-29 16:44:44 +0000 | [diff] [blame] | 133 | /// Analyze the loop code, return true if it cannot be understood. Upon |
| 134 | /// success, this function returns false and returns information about the |
| 135 | /// induction variable and compare instruction used at the end. |
| 136 | bool analyzeLoop(MachineLoop &L, MachineInstr *&IndVarInst, |
| 137 | MachineInstr *&CmpInst) const override; |
| 138 | |
| Hiroshi Inoue | 290adb3 | 2018-01-22 05:54:46 +0000 | [diff] [blame] | 139 | /// Generate code to reduce the loop iteration by one and check if the loop |
| 140 | /// is finished. Return the value/register of the new loop count. We need |
| Brendon Cahoon | 254f889 | 2016-07-29 16:44:44 +0000 | [diff] [blame] | 141 | /// this function when peeling off one or more iterations of a loop. This |
| 142 | /// function assumes the nth iteration is peeled first. |
| 143 | unsigned reduceLoopCount(MachineBasicBlock &MBB, |
| Krzysztof Parzyszek | 8fb181c | 2016-08-01 17:55:48 +0000 | [diff] [blame] | 144 | MachineInstr *IndVar, MachineInstr &Cmp, |
| Brendon Cahoon | 254f889 | 2016-07-29 16:44:44 +0000 | [diff] [blame] | 145 | SmallVectorImpl<MachineOperand> &Cond, |
| 146 | SmallVectorImpl<MachineInstr *> &PrevInsts, |
| 147 | unsigned Iter, unsigned MaxIter) const override; |
| 148 | |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 149 | /// Return true if it's profitable to predicate |
| 150 | /// instructions with accumulated instruction latency of "NumCycles" |
| 151 | /// of the specified basic block, where the probability of the instructions |
| 152 | /// being executed is given by Probability, and Confidence is a measure |
| 153 | /// of our confidence that it will be properly predicted. |
| 154 | bool isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumCycles, |
| 155 | unsigned ExtraPredCycles, |
| 156 | BranchProbability Probability) const override; |
| Krzysztof Parzyszek | cfe285e | 2013-02-11 20:04:29 +0000 | [diff] [blame] | 157 | |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 158 | /// Second variant of isProfitableToIfCvt. This one |
| 159 | /// checks for the case where two basic blocks from true and false path |
| 160 | /// of a if-then-else (diamond) are predicated on mutally exclusive |
| 161 | /// predicates, where the probability of the true path being taken is given |
| 162 | /// by Probability, and Confidence is a measure of our confidence that it |
| 163 | /// will be properly predicted. |
| 164 | bool isProfitableToIfCvt(MachineBasicBlock &TMBB, |
| 165 | unsigned NumTCycles, unsigned ExtraTCycles, |
| 166 | MachineBasicBlock &FMBB, |
| 167 | unsigned NumFCycles, unsigned ExtraFCycles, |
| 168 | BranchProbability Probability) const override; |
| 169 | |
| 170 | /// Return true if it's profitable for if-converter to duplicate instructions |
| 171 | /// of specified accumulated instruction latencies in the specified MBB to |
| 172 | /// enable if-conversion. |
| 173 | /// The probability of the instructions being executed is given by |
| 174 | /// Probability, and Confidence is a measure of our confidence that it |
| 175 | /// will be properly predicted. |
| 176 | bool isProfitableToDupForIfCvt(MachineBasicBlock &MBB, unsigned NumCycles, |
| 177 | BranchProbability Probability) const override; |
| 178 | |
| 179 | /// Emit instructions to copy a pair of physical registers. |
| 180 | /// |
| 181 | /// This function should support copies within any legal register class as |
| 182 | /// well as any cross-class copies created during instruction selection. |
| 183 | /// |
| 184 | /// The source and destination registers may overlap, which may require a |
| 185 | /// careful implementation when multiple copy instructions are required for |
| 186 | /// large registers. See for example the ARM target. |
| Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 187 | void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, |
| 188 | const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, |
| Craig Topper | 906c2cd | 2014-04-29 07:58:16 +0000 | [diff] [blame] | 189 | bool KillSrc) const override; |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 190 | |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 191 | /// Store the specified register of the given register class to the specified |
| 192 | /// stack frame index. The store instruction is to be added to the given |
| 193 | /// machine basic block before the specified machine instruction. If isKill |
| 194 | /// is true, the register operand is the last use and must be marked kill. |
| Craig Topper | 906c2cd | 2014-04-29 07:58:16 +0000 | [diff] [blame] | 195 | void storeRegToStackSlot(MachineBasicBlock &MBB, |
| 196 | MachineBasicBlock::iterator MBBI, |
| 197 | unsigned SrcReg, bool isKill, int FrameIndex, |
| 198 | const TargetRegisterClass *RC, |
| 199 | const TargetRegisterInfo *TRI) const override; |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 200 | |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 201 | /// Load the specified register of the given register class from the specified |
| 202 | /// stack frame index. The load instruction is to be added to the given |
| 203 | /// machine basic block before the specified machine instruction. |
| Craig Topper | 906c2cd | 2014-04-29 07:58:16 +0000 | [diff] [blame] | 204 | void loadRegFromStackSlot(MachineBasicBlock &MBB, |
| 205 | MachineBasicBlock::iterator MBBI, |
| 206 | unsigned DestReg, int FrameIndex, |
| 207 | const TargetRegisterClass *RC, |
| 208 | const TargetRegisterInfo *TRI) const override; |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 209 | |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 210 | /// This function is called for all pseudo instructions |
| Colin LeMahieu | 7b1799c | 2015-03-09 22:05:21 +0000 | [diff] [blame] | 211 | /// that remain after register allocation. Many pseudo instructions are |
| 212 | /// created to help register allocation. This is the place to convert them |
| 213 | /// into real instructions. The target can edit MI in place, or it can insert |
| 214 | /// new instructions and erase MI. The function should return true if |
| 215 | /// anything was changed. |
| Duncan P. N. Exon Smith | 9cfc75c | 2016-06-30 00:01:54 +0000 | [diff] [blame] | 216 | bool expandPostRAPseudo(MachineInstr &MI) const override; |
| Colin LeMahieu | 7b1799c | 2015-03-09 22:05:21 +0000 | [diff] [blame] | 217 | |
| Brendon Cahoon | 254f889 | 2016-07-29 16:44:44 +0000 | [diff] [blame] | 218 | /// \brief Get the base register and byte offset of a load/store instr. |
| 219 | bool getMemOpBaseRegImmOfs(MachineInstr &LdSt, unsigned &BaseReg, |
| 220 | int64_t &Offset, |
| 221 | const TargetRegisterInfo *TRI) const override; |
| 222 | |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 223 | /// Reverses the branch condition of the specified condition list, |
| 224 | /// returning false on success and true if it cannot be reversed. |
| Matt Arsenault | 1b9fc8e | 2016-09-14 20:43:16 +0000 | [diff] [blame] | 225 | bool reverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 226 | const override; |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 227 | |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 228 | /// Insert a noop into the instruction stream at the specified point. |
| 229 | void insertNoop(MachineBasicBlock &MBB, |
| 230 | MachineBasicBlock::iterator MI) const override; |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 231 | |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 232 | /// Returns true if the instruction is already predicated. |
| Duncan P. N. Exon Smith | 6307eb5 | 2016-02-23 02:46:52 +0000 | [diff] [blame] | 233 | bool isPredicated(const MachineInstr &MI) const override; |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 234 | |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 235 | /// Return true for post-incremented instructions. |
| Krzysztof Parzyszek | 8fb181c | 2016-08-01 17:55:48 +0000 | [diff] [blame] | 236 | bool isPostIncrement(const MachineInstr &MI) const override; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 237 | |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 238 | /// Convert the instruction into a predicated instruction. |
| 239 | /// It returns true if the operation was successful. |
| Duncan P. N. Exon Smith | 6307eb5 | 2016-02-23 02:46:52 +0000 | [diff] [blame] | 240 | bool PredicateInstruction(MachineInstr &MI, |
| Ahmed Bougacha | c88bf54 | 2015-06-11 19:30:37 +0000 | [diff] [blame] | 241 | ArrayRef<MachineOperand> Cond) const override; |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 242 | |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 243 | /// Returns true if the first specified predicate |
| 244 | /// subsumes the second, e.g. GE subsumes GT. |
| Ahmed Bougacha | c88bf54 | 2015-06-11 19:30:37 +0000 | [diff] [blame] | 245 | bool SubsumesPredicate(ArrayRef<MachineOperand> Pred1, |
| 246 | ArrayRef<MachineOperand> Pred2) const override; |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 247 | |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 248 | /// If the specified instruction defines any predicate |
| 249 | /// or condition code register(s) used for predication, returns true as well |
| 250 | /// as the definition predicate(s) by reference. |
| Duncan P. N. Exon Smith | 6307eb5 | 2016-02-23 02:46:52 +0000 | [diff] [blame] | 251 | bool DefinesPredicate(MachineInstr &MI, |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 252 | std::vector<MachineOperand> &Pred) const override; |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 253 | |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 254 | /// Return true if the specified instruction can be predicated. |
| 255 | /// By default, this returns true for every instruction with a |
| 256 | /// PredicateOperand. |
| Krzysztof Parzyszek | cc31871 | 2017-03-03 18:30:54 +0000 | [diff] [blame] | 257 | bool isPredicable(const MachineInstr &MI) const override; |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 258 | |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 259 | /// Test if the given instruction should be considered a scheduling boundary. |
| 260 | /// This primarily includes labels and terminators. |
| Duncan P. N. Exon Smith | 9cfc75c | 2016-06-30 00:01:54 +0000 | [diff] [blame] | 261 | bool isSchedulingBoundary(const MachineInstr &MI, |
| Craig Topper | 906c2cd | 2014-04-29 07:58:16 +0000 | [diff] [blame] | 262 | const MachineBasicBlock *MBB, |
| 263 | const MachineFunction &MF) const override; |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 264 | |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 265 | /// Measure the specified inline asm to determine an approximation of its |
| 266 | /// length. |
| 267 | unsigned getInlineAsmLength(const char *Str, |
| 268 | const MCAsmInfo &MAI) const override; |
| 269 | |
| 270 | /// Allocate and return a hazard recognizer to use for this target when |
| 271 | /// scheduling the machine instructions after register allocation. |
| 272 | ScheduleHazardRecognizer* |
| Eugene Zelenko | 3b87336 | 2017-09-28 22:27:31 +0000 | [diff] [blame] | 273 | CreateTargetPostRAHazardRecognizer(const InstrItineraryData *II, |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 274 | const ScheduleDAG *DAG) const override; |
| 275 | |
| 276 | /// For a comparison instruction, return the source registers |
| 277 | /// in SrcReg and SrcReg2 if having two register operands, and the value it |
| 278 | /// compares against in CmpValue. Return true if the comparison instruction |
| 279 | /// can be analyzed. |
| Duncan P. N. Exon Smith | 9cfc75c | 2016-06-30 00:01:54 +0000 | [diff] [blame] | 280 | bool analyzeCompare(const MachineInstr &MI, unsigned &SrcReg, |
| 281 | unsigned &SrcReg2, int &Mask, int &Value) const override; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 282 | |
| 283 | /// Compute the instruction latency of a given instruction. |
| 284 | /// If the instruction has higher cost when predicated, it's returned via |
| 285 | /// PredCost. |
| 286 | unsigned getInstrLatency(const InstrItineraryData *ItinData, |
| Duncan P. N. Exon Smith | 9cfc75c | 2016-06-30 00:01:54 +0000 | [diff] [blame] | 287 | const MachineInstr &MI, |
| Eugene Zelenko | b2ca1b3 | 2017-01-04 02:02:05 +0000 | [diff] [blame] | 288 | unsigned *PredCost = nullptr) const override; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 289 | |
| 290 | /// Create machine specific model for scheduling. |
| 291 | DFAPacketizer * |
| 292 | CreateTargetScheduleState(const TargetSubtargetInfo &STI) const override; |
| 293 | |
| 294 | // Sometimes, it is possible for the target |
| 295 | // to tell, even without aliasing information, that two MIs access different |
| 296 | // memory addresses. This function returns true if two MIs access different |
| 297 | // memory addresses and false otherwise. |
| Duncan P. N. Exon Smith | 9cfc75c | 2016-06-30 00:01:54 +0000 | [diff] [blame] | 298 | bool |
| 299 | areMemAccessesTriviallyDisjoint(MachineInstr &MIa, MachineInstr &MIb, |
| 300 | AliasAnalysis *AA = nullptr) const override; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 301 | |
| Brendon Cahoon | 254f889 | 2016-07-29 16:44:44 +0000 | [diff] [blame] | 302 | /// For instructions with a base and offset, return the position of the |
| 303 | /// base register and offset operands. |
| Krzysztof Parzyszek | 8fb181c | 2016-08-01 17:55:48 +0000 | [diff] [blame] | 304 | bool getBaseAndOffsetPosition(const MachineInstr &MI, unsigned &BasePos, |
| Brendon Cahoon | 254f889 | 2016-07-29 16:44:44 +0000 | [diff] [blame] | 305 | unsigned &OffsetPos) const override; |
| 306 | |
| 307 | /// If the instruction is an increment of a constant value, return the amount. |
| Krzysztof Parzyszek | 8fb181c | 2016-08-01 17:55:48 +0000 | [diff] [blame] | 308 | bool getIncrementValue(const MachineInstr &MI, int &Value) const override; |
| Brendon Cahoon | 254f889 | 2016-07-29 16:44:44 +0000 | [diff] [blame] | 309 | |
| Krzysztof Parzyszek | 2af5037 | 2017-05-03 20:10:36 +0000 | [diff] [blame] | 310 | /// getOperandLatency - Compute and return the use operand latency of a given |
| 311 | /// pair of def and use. |
| 312 | /// In most cases, the static scheduling itinerary was enough to determine the |
| 313 | /// operand latency. But it may not be possible for instructions with variable |
| 314 | /// number of defs / uses. |
| 315 | /// |
| 316 | /// This is a raw interface to the itinerary that may be directly overriden by |
| 317 | /// a target. Use computeOperandLatency to get the best estimate of latency. |
| 318 | int getOperandLatency(const InstrItineraryData *ItinData, |
| 319 | const MachineInstr &DefMI, unsigned DefIdx, |
| 320 | const MachineInstr &UseMI, |
| 321 | unsigned UseIdx) const override; |
| 322 | |
| Krzysztof Parzyszek | 0ac065f | 2017-07-10 18:31:02 +0000 | [diff] [blame] | 323 | /// Decompose the machine operand's target flags into two values - the direct |
| 324 | /// target flag value and any of bit flags that are applied. |
| 325 | std::pair<unsigned, unsigned> |
| 326 | decomposeMachineOperandsTargetFlags(unsigned TF) const override; |
| 327 | |
| 328 | /// Return an array that contains the direct target flag values and their |
| 329 | /// names. |
| 330 | /// |
| 331 | /// MIR Serialization is able to serialize only the target flags that are |
| 332 | /// defined by this method. |
| 333 | ArrayRef<std::pair<unsigned, const char *>> |
| 334 | getSerializableDirectMachineOperandTargetFlags() const override; |
| 335 | |
| 336 | /// Return an array that contains the bitmask target flag values and their |
| 337 | /// names. |
| 338 | /// |
| 339 | /// MIR Serialization is able to serialize only the target flags that are |
| 340 | /// defined by this method. |
| 341 | ArrayRef<std::pair<unsigned, const char *>> |
| 342 | getSerializableBitmaskMachineOperandTargetFlags() const override; |
| 343 | |
| Dean Michael Berris | 6d6addb | 2016-09-01 01:58:24 +0000 | [diff] [blame] | 344 | bool isTailCall(const MachineInstr &MI) const override; |
| 345 | |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 346 | /// HexagonInstrInfo specifics. |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 347 | |
| Krzysztof Parzyszek | a8ab1b7 | 2017-12-11 18:57:54 +0000 | [diff] [blame] | 348 | unsigned createVR(MachineFunction *MF, MVT VT) const; |
| Krzysztof Parzyszek | 998df2c | 2018-03-23 20:43:02 +0000 | [diff] [blame] | 349 | MachineInstr *findLoopInstr(MachineBasicBlock *BB, unsigned EndLoopOp, |
| 350 | MachineBasicBlock *TargetBB, |
| 351 | SmallPtrSet<MachineBasicBlock *, 8> &Visited) const; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 352 | |
| Krzysztof Parzyszek | 998df2c | 2018-03-23 20:43:02 +0000 | [diff] [blame] | 353 | bool isBaseImmOffset(const MachineInstr &MI) const; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 354 | bool isAbsoluteSet(const MachineInstr &MI) const; |
| 355 | bool isAccumulator(const MachineInstr &MI) const; |
| Krzysztof Parzyszek | a8ab1b7 | 2017-12-11 18:57:54 +0000 | [diff] [blame] | 356 | bool isAddrModeWithOffset(const MachineInstr &MI) const; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 357 | bool isComplex(const MachineInstr &MI) const; |
| 358 | bool isCompoundBranchInstr(const MachineInstr &MI) const; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 359 | bool isConstExtended(const MachineInstr &MI) const; |
| 360 | bool isDeallocRet(const MachineInstr &MI) const; |
| 361 | bool isDependent(const MachineInstr &ProdMI, |
| 362 | const MachineInstr &ConsMI) const; |
| 363 | bool isDotCurInst(const MachineInstr &MI) const; |
| 364 | bool isDotNewInst(const MachineInstr &MI) const; |
| 365 | bool isDuplexPair(const MachineInstr &MIa, const MachineInstr &MIb) const; |
| 366 | bool isEarlySourceInstr(const MachineInstr &MI) const; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 367 | bool isEndLoopN(unsigned Opcode) const; |
| 368 | bool isExpr(unsigned OpType) const; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 369 | bool isExtendable(const MachineInstr &MI) const; |
| 370 | bool isExtended(const MachineInstr &MI) const; |
| 371 | bool isFloat(const MachineInstr &MI) const; |
| 372 | bool isHVXMemWithAIndirect(const MachineInstr &I, |
| 373 | const MachineInstr &J) const; |
| 374 | bool isIndirectCall(const MachineInstr &MI) const; |
| 375 | bool isIndirectL4Return(const MachineInstr &MI) const; |
| 376 | bool isJumpR(const MachineInstr &MI) const; |
| 377 | bool isJumpWithinBranchRange(const MachineInstr &MI, unsigned offset) const; |
| 378 | bool isLateInstrFeedsEarlyInstr(const MachineInstr &LRMI, |
| 379 | const MachineInstr &ESMI) const; |
| 380 | bool isLateResultInstr(const MachineInstr &MI) const; |
| 381 | bool isLateSourceInstr(const MachineInstr &MI) const; |
| 382 | bool isLoopN(const MachineInstr &MI) const; |
| 383 | bool isMemOp(const MachineInstr &MI) const; |
| 384 | bool isNewValue(const MachineInstr &MI) const; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 385 | bool isNewValue(unsigned Opcode) const; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 386 | bool isNewValueInst(const MachineInstr &MI) const; |
| 387 | bool isNewValueJump(const MachineInstr &MI) const; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 388 | bool isNewValueJump(unsigned Opcode) const; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 389 | bool isNewValueStore(const MachineInstr &MI) const; |
| Jyotsna Verma | 300f0b9 | 2013-05-10 20:27:34 +0000 | [diff] [blame] | 390 | bool isNewValueStore(unsigned Opcode) const; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 391 | bool isOperandExtended(const MachineInstr &MI, unsigned OperandNum) const; |
| Duncan P. N. Exon Smith | 6307eb5 | 2016-02-23 02:46:52 +0000 | [diff] [blame] | 392 | bool isPredicatedNew(const MachineInstr &MI) const; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 393 | bool isPredicatedNew(unsigned Opcode) const; |
| Duncan P. N. Exon Smith | 6307eb5 | 2016-02-23 02:46:52 +0000 | [diff] [blame] | 394 | bool isPredicatedTrue(const MachineInstr &MI) const; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 395 | bool isPredicatedTrue(unsigned Opcode) const; |
| 396 | bool isPredicated(unsigned Opcode) const; |
| 397 | bool isPredicateLate(unsigned Opcode) const; |
| 398 | bool isPredictedTaken(unsigned Opcode) const; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 399 | bool isSaveCalleeSavedRegsCall(const MachineInstr &MI) const; |
| Duncan P. N. Exon Smith | 9cfc75c | 2016-06-30 00:01:54 +0000 | [diff] [blame] | 400 | bool isSignExtendingLoad(const MachineInstr &MI) const; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 401 | bool isSolo(const MachineInstr &MI) const; |
| 402 | bool isSpillPredRegOp(const MachineInstr &MI) const; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 403 | bool isTC1(const MachineInstr &MI) const; |
| 404 | bool isTC2(const MachineInstr &MI) const; |
| 405 | bool isTC2Early(const MachineInstr &MI) const; |
| 406 | bool isTC4x(const MachineInstr &MI) const; |
| 407 | bool isToBeScheduledASAP(const MachineInstr &MI1, |
| 408 | const MachineInstr &MI2) const; |
| Krzysztof Parzyszek | 2af5037 | 2017-05-03 20:10:36 +0000 | [diff] [blame] | 409 | bool isHVXVec(const MachineInstr &MI) const; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 410 | bool isValidAutoIncImm(const EVT VT, const int Offset) const; |
| Krzysztof Parzyszek | 5577297 | 2017-09-15 15:46:05 +0000 | [diff] [blame] | 411 | bool isValidOffset(unsigned Opcode, int Offset, |
| 412 | const TargetRegisterInfo *TRI, bool Extend = true) const; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 413 | bool isVecAcc(const MachineInstr &MI) const; |
| 414 | bool isVecALU(const MachineInstr &MI) const; |
| 415 | bool isVecUsableNextPacket(const MachineInstr &ProdMI, |
| 416 | const MachineInstr &ConsMI) const; |
| Duncan P. N. Exon Smith | 9cfc75c | 2016-06-30 00:01:54 +0000 | [diff] [blame] | 417 | bool isZeroExtendingLoad(const MachineInstr &MI) const; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 418 | |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 419 | bool addLatencyToSchedule(const MachineInstr &MI1, |
| 420 | const MachineInstr &MI2) const; |
| 421 | bool canExecuteInBundle(const MachineInstr &First, |
| 422 | const MachineInstr &Second) const; |
| Krzysztof Parzyszek | 1b689da | 2016-08-11 21:14:25 +0000 | [diff] [blame] | 423 | bool doesNotReturn(const MachineInstr &CallMI) const; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 424 | bool hasEHLabel(const MachineBasicBlock *B) const; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 425 | bool hasNonExtEquivalent(const MachineInstr &MI) const; |
| 426 | bool hasPseudoInstrPair(const MachineInstr &MI) const; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 427 | bool hasUncondBranch(const MachineBasicBlock *B) const; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 428 | bool mayBeCurLoad(const MachineInstr &MI) const; |
| 429 | bool mayBeNewStore(const MachineInstr &MI) const; |
| 430 | bool producesStall(const MachineInstr &ProdMI, |
| 431 | const MachineInstr &ConsMI) const; |
| 432 | bool producesStall(const MachineInstr &MI, |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 433 | MachineBasicBlock::const_instr_iterator MII) const; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 434 | bool predCanBeUsedAsDotNew(const MachineInstr &MI, unsigned PredReg) const; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 435 | bool PredOpcodeHasJMP_c(unsigned Opcode) const; |
| 436 | bool predOpcodeHasNot(ArrayRef<MachineOperand> Cond) const; |
| 437 | |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 438 | unsigned getAddrMode(const MachineInstr &MI) const; |
| 439 | unsigned getBaseAndOffset(const MachineInstr &MI, int &Offset, |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 440 | unsigned &AccessSize) const; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 441 | SmallVector<MachineInstr*,2> getBranchingInstrs(MachineBasicBlock& MBB) const; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 442 | unsigned getCExtOpNum(const MachineInstr &MI) const; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 443 | HexagonII::CompoundGroup |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 444 | getCompoundCandidateGroup(const MachineInstr &MI) const; |
| 445 | unsigned getCompoundOpcode(const MachineInstr &GA, |
| 446 | const MachineInstr &GB) const; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 447 | int getCondOpcode(int Opc, bool sense) const; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 448 | int getDotCurOp(const MachineInstr &MI) const; |
| Krzysztof Parzyszek | 0a8043e | 2017-05-03 15:28:56 +0000 | [diff] [blame] | 449 | int getNonDotCurOp(const MachineInstr &MI) const; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 450 | int getDotNewOp(const MachineInstr &MI) const; |
| 451 | int getDotNewPredJumpOp(const MachineInstr &MI, |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 452 | const MachineBranchProbabilityInfo *MBPI) const; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 453 | int getDotNewPredOp(const MachineInstr &MI, |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 454 | const MachineBranchProbabilityInfo *MBPI) const; |
| Krzysztof Parzyszek | 143158b | 2017-03-06 17:03:16 +0000 | [diff] [blame] | 455 | int getDotOldOp(const MachineInstr &MI) const; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 456 | HexagonII::SubInstructionGroup getDuplexCandidateGroup(const MachineInstr &MI) |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 457 | const; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 458 | short getEquivalentHWInstr(const MachineInstr &MI) const; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 459 | unsigned getInstrTimingClassLatency(const InstrItineraryData *ItinData, |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 460 | const MachineInstr &MI) const; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 461 | bool getInvertedPredSense(SmallVectorImpl<MachineOperand> &Cond) const; |
| 462 | unsigned getInvertedPredicatedOpcode(const int Opc) const; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 463 | int getMaxValue(const MachineInstr &MI) const; |
| 464 | unsigned getMemAccessSize(const MachineInstr &MI) const; |
| 465 | int getMinValue(const MachineInstr &MI) const; |
| 466 | short getNonExtOpcode(const MachineInstr &MI) const; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 467 | bool getPredReg(ArrayRef<MachineOperand> Cond, unsigned &PredReg, |
| 468 | unsigned &PredRegPos, unsigned &PredRegFlags) const; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 469 | short getPseudoInstrPair(const MachineInstr &MI) const; |
| 470 | short getRegForm(const MachineInstr &MI) const; |
| 471 | unsigned getSize(const MachineInstr &MI) const; |
| 472 | uint64_t getType(const MachineInstr &MI) const; |
| 473 | unsigned getUnits(const MachineInstr &MI) const; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 474 | |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 475 | /// getInstrTimingClassLatency - Compute the instruction latency of a given |
| 476 | /// instruction using Timing Class information, if available. |
| 477 | unsigned nonDbgBBSize(const MachineBasicBlock *BB) const; |
| 478 | unsigned nonDbgBundleSize(MachineBasicBlock::const_iterator BundleHead) const; |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 479 | |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 480 | void immediateExtend(MachineInstr &MI) const; |
| 481 | bool invertAndChangeJumpTarget(MachineInstr &MI, |
| Krzysztof Parzyszek | a8ab1b7 | 2017-12-11 18:57:54 +0000 | [diff] [blame] | 482 | MachineBasicBlock *NewTarget) const; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 483 | void genAllInsnTimingClasses(MachineFunction &MF) const; |
| Krzysztof Parzyszek | f0b34a5 | 2016-07-29 21:49:42 +0000 | [diff] [blame] | 484 | bool reversePredSense(MachineInstr &MI) const; |
| Krzysztof Parzyszek | b9a1c3a | 2015-11-24 14:55:26 +0000 | [diff] [blame] | 485 | unsigned reversePrediction(unsigned Opcode) const; |
| 486 | bool validateBranchCond(const ArrayRef<MachineOperand> &Cond) const; |
| Krzysztof Parzyszek | 7ae3ae9 | 2017-10-05 20:01:38 +0000 | [diff] [blame] | 487 | |
| Krzysztof Parzyszek | a8ab1b7 | 2017-12-11 18:57:54 +0000 | [diff] [blame] | 488 | void setBundleNoShuf(MachineBasicBlock::instr_iterator MIB) const; |
| 489 | bool getBundleNoShuf(const MachineInstr &MIB) const; |
| Krzysztof Parzyszek | 7ae3ae9 | 2017-10-05 20:01:38 +0000 | [diff] [blame] | 490 | // Addressing mode relations. |
| 491 | short changeAddrMode_abs_io(short Opc) const; |
| 492 | short changeAddrMode_io_abs(short Opc) const; |
| Krzysztof Parzyszek | a8ab1b7 | 2017-12-11 18:57:54 +0000 | [diff] [blame] | 493 | short changeAddrMode_io_pi(short Opc) const; |
| Krzysztof Parzyszek | 7ae3ae9 | 2017-10-05 20:01:38 +0000 | [diff] [blame] | 494 | short changeAddrMode_io_rr(short Opc) const; |
| Krzysztof Parzyszek | a8ab1b7 | 2017-12-11 18:57:54 +0000 | [diff] [blame] | 495 | short changeAddrMode_pi_io(short Opc) const; |
| Krzysztof Parzyszek | 7ae3ae9 | 2017-10-05 20:01:38 +0000 | [diff] [blame] | 496 | short changeAddrMode_rr_io(short Opc) const; |
| 497 | short changeAddrMode_rr_ur(short Opc) const; |
| 498 | short changeAddrMode_ur_rr(short Opc) const; |
| 499 | |
| 500 | short changeAddrMode_abs_io(const MachineInstr &MI) const { |
| 501 | return changeAddrMode_abs_io(MI.getOpcode()); |
| 502 | } |
| 503 | short changeAddrMode_io_abs(const MachineInstr &MI) const { |
| 504 | return changeAddrMode_io_abs(MI.getOpcode()); |
| 505 | } |
| 506 | short changeAddrMode_io_rr(const MachineInstr &MI) const { |
| 507 | return changeAddrMode_io_rr(MI.getOpcode()); |
| 508 | } |
| 509 | short changeAddrMode_rr_io(const MachineInstr &MI) const { |
| 510 | return changeAddrMode_rr_io(MI.getOpcode()); |
| 511 | } |
| 512 | short changeAddrMode_rr_ur(const MachineInstr &MI) const { |
| 513 | return changeAddrMode_rr_ur(MI.getOpcode()); |
| 514 | } |
| 515 | short changeAddrMode_ur_rr(const MachineInstr &MI) const { |
| 516 | return changeAddrMode_ur_rr(MI.getOpcode()); |
| 517 | } |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 518 | }; |
| 519 | |
| Eugene Zelenko | b2ca1b3 | 2017-01-04 02:02:05 +0000 | [diff] [blame] | 520 | } // end namespace llvm |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 521 | |
| Eugene Zelenko | b2ca1b3 | 2017-01-04 02:02:05 +0000 | [diff] [blame] | 522 | #endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONINSTRINFO_H |