blob: 97b9bc9546885ed8d205726e0ab0812cdcfe6d6c [file] [log] [blame]
Jia Liub22310f2012-02-18 12:03:15 +00001//===- HexagonInstrInfo.h - Hexagon Instruction Information -----*- C++ -*-===//
Tony Linthicum1213a7a2011-12-12 21:14:40 +00002//
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 Kramera7c40ef2014-08-13 16:26:38 +000014#ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONINSTRINFO_H
15#define LLVM_LIB_TARGET_HEXAGON_HEXAGONINSTRINFO_H
Tony Linthicum1213a7a2011-12-12 21:14:40 +000016
Craig Topperb25fda92012-03-17 18:46:09 +000017#include "HexagonRegisterInfo.h"
Brendon Cahoon6f358372012-02-08 18:25:47 +000018#include "MCTargetDesc/HexagonBaseInfo.h"
Eugene Zelenkob2ca1b32017-01-04 02:02:05 +000019#include "llvm/ADT/ArrayRef.h"
20#include "llvm/ADT/SmallVector.h"
21#include "llvm/CodeGen/MachineBasicBlock.h"
Jyotsna Verma1d297502013-05-02 15:39:30 +000022#include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
Eugene Zelenkob2ca1b32017-01-04 02:02:05 +000023#include "llvm/CodeGen/MachineValueType.h"
Chandler Carruth8a8cd2b2014-01-07 11:48:04 +000024#include "llvm/Target/TargetInstrInfo.h"
Eugene Zelenkob2ca1b32017-01-04 02:02:05 +000025#include <cstdint>
26#include <vector>
Tony Linthicum1213a7a2011-12-12 21:14:40 +000027
28#define GET_INSTRINFO_HEADER
29#include "HexagonGenInstrInfo.inc"
30
31namespace llvm {
32
Patrik Hagglund8d09a6c2014-03-15 09:11:41 +000033struct EVT;
Eric Christopher234a1ec2015-03-12 06:07:16 +000034class HexagonSubtarget;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +000035
Tony Linthicum1213a7a2011-12-12 21:14:40 +000036class HexagonInstrInfo : public HexagonGenInstrInfo {
37 const HexagonRegisterInfo RI;
Jyotsna Verma5ed51812013-05-01 21:37:34 +000038
Eugene Zelenkob2ca1b32017-01-04 02:02:05 +000039 virtual void anchor();
40
Tony Linthicum1213a7a2011-12-12 21:14:40 +000041public:
42 explicit HexagonInstrInfo(HexagonSubtarget &ST);
43
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +000044 /// TargetInstrInfo overrides.
Tony Linthicum1213a7a2011-12-12 21:14:40 +000045 ///
Tony Linthicum1213a7a2011-12-12 21:14:40 +000046
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +000047 /// If the specified machine instruction is a direct
Tony Linthicum1213a7a2011-12-12 21:14:40 +000048 /// load from a stack slot, return the virtual or physical register number of
49 /// the destination along with the FrameIndex of the loaded stack slot. If
50 /// not, return 0. This predicate must return 0 if the instruction has
51 /// any side effects other than loading from the stack slot.
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +000052 unsigned isLoadFromStackSlot(const MachineInstr &MI,
Craig Topper906c2cd2014-04-29 07:58:16 +000053 int &FrameIndex) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +000054
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +000055 /// If the specified machine instruction is a direct
Tony Linthicum1213a7a2011-12-12 21:14:40 +000056 /// store to a stack slot, return the virtual or physical register number of
57 /// the source reg along with the FrameIndex of the loaded stack slot. If
58 /// not, return 0. This predicate must return 0 if the instruction has
59 /// any side effects other than storing to the stack slot.
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +000060 unsigned isStoreToStackSlot(const MachineInstr &MI,
Craig Topper906c2cd2014-04-29 07:58:16 +000061 int &FrameIndex) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +000062
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +000063 /// Analyze the branching code at the end of MBB, returning
64 /// true if it cannot be understood (e.g. it's a switch dispatch or isn't
65 /// implemented for a target). Upon success, this returns false and returns
66 /// with the following information in various cases:
67 ///
68 /// 1. If this block ends with no branches (it just falls through to its succ)
69 /// just return false, leaving TBB/FBB null.
70 /// 2. If this block ends with only an unconditional branch, it sets TBB to be
71 /// the destination block.
72 /// 3. If this block ends with a conditional branch and it falls through to a
73 /// successor block, it sets TBB to be the branch destination block and a
74 /// list of operands that evaluate the condition. These operands can be
75 /// passed to other TargetInstrInfo methods to create new branches.
76 /// 4. If this block ends with a conditional branch followed by an
77 /// unconditional branch, it returns the 'true' destination in TBB, the
78 /// 'false' destination in FBB, and a list of operands that evaluate the
79 /// condition. These operands can be passed to other TargetInstrInfo
80 /// methods to create new branches.
81 ///
Matt Arsenault1b9fc8e2016-09-14 20:43:16 +000082 /// Note that removeBranch and insertBranch must be implemented to support
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +000083 /// cases where this method returns success.
84 ///
85 /// If AllowModify is true, then this routine is allowed to modify the basic
86 /// block (e.g. delete instructions after the unconditional branch).
87 ///
Jacques Pienaar71c30a12016-07-15 14:41:04 +000088 bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
89 MachineBasicBlock *&FBB,
90 SmallVectorImpl<MachineOperand> &Cond,
91 bool AllowModify) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +000092
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +000093 /// Remove the branching code at the end of the specific MBB.
94 /// This is only invoked in cases where AnalyzeBranch returns success. It
95 /// returns the number of instructions that were removed.
Matt Arsenault1b9fc8e2016-09-14 20:43:16 +000096 unsigned removeBranch(MachineBasicBlock &MBB,
Matt Arsenaulta2b036e2016-09-14 17:23:48 +000097 int *BytesRemoved = nullptr) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +000098
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +000099 /// Insert branch code into the end of the specified MachineBasicBlock.
100 /// The operands to this method are the same as those
101 /// returned by AnalyzeBranch. This is only invoked in cases where
102 /// AnalyzeBranch returns success. It returns the number of instructions
103 /// inserted.
104 ///
105 /// It is also invoked by tail merging to add unconditional branches in
106 /// cases where AnalyzeBranch doesn't apply because there was no original
107 /// branch to analyze. At least this much must be implemented, else tail
108 /// merging needs to be disabled.
Matt Arsenaulte8e0f5c2016-09-14 17:24:15 +0000109 unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
Ahmed Bougachac88bf542015-06-11 19:30:37 +0000110 MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond,
Matt Arsenaulta2b036e2016-09-14 17:23:48 +0000111 const DebugLoc &DL,
112 int *BytesAdded = nullptr) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000113
Brendon Cahoon254f8892016-07-29 16:44:44 +0000114 /// Analyze the loop code, return true if it cannot be understood. Upon
115 /// success, this function returns false and returns information about the
116 /// induction variable and compare instruction used at the end.
117 bool analyzeLoop(MachineLoop &L, MachineInstr *&IndVarInst,
118 MachineInstr *&CmpInst) const override;
119
120 /// Generate code to reduce the loop iteration by one and check if the loop is
121 /// finished. Return the value/register of the the new loop count. We need
122 /// this function when peeling off one or more iterations of a loop. This
123 /// function assumes the nth iteration is peeled first.
124 unsigned reduceLoopCount(MachineBasicBlock &MBB,
Krzysztof Parzyszek8fb181c2016-08-01 17:55:48 +0000125 MachineInstr *IndVar, MachineInstr &Cmp,
Brendon Cahoon254f8892016-07-29 16:44:44 +0000126 SmallVectorImpl<MachineOperand> &Cond,
127 SmallVectorImpl<MachineInstr *> &PrevInsts,
128 unsigned Iter, unsigned MaxIter) const override;
129
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000130 /// Return true if it's profitable to predicate
131 /// instructions with accumulated instruction latency of "NumCycles"
132 /// of the specified basic block, where the probability of the instructions
133 /// being executed is given by Probability, and Confidence is a measure
134 /// of our confidence that it will be properly predicted.
135 bool isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumCycles,
136 unsigned ExtraPredCycles,
137 BranchProbability Probability) const override;
Krzysztof Parzyszekcfe285e2013-02-11 20:04:29 +0000138
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000139 /// Second variant of isProfitableToIfCvt. This one
140 /// checks for the case where two basic blocks from true and false path
141 /// of a if-then-else (diamond) are predicated on mutally exclusive
142 /// predicates, where the probability of the true path being taken is given
143 /// by Probability, and Confidence is a measure of our confidence that it
144 /// will be properly predicted.
145 bool isProfitableToIfCvt(MachineBasicBlock &TMBB,
146 unsigned NumTCycles, unsigned ExtraTCycles,
147 MachineBasicBlock &FMBB,
148 unsigned NumFCycles, unsigned ExtraFCycles,
149 BranchProbability Probability) const override;
150
151 /// Return true if it's profitable for if-converter to duplicate instructions
152 /// of specified accumulated instruction latencies in the specified MBB to
153 /// enable if-conversion.
154 /// The probability of the instructions being executed is given by
155 /// Probability, and Confidence is a measure of our confidence that it
156 /// will be properly predicted.
157 bool isProfitableToDupForIfCvt(MachineBasicBlock &MBB, unsigned NumCycles,
158 BranchProbability Probability) const override;
159
160 /// Emit instructions to copy a pair of physical registers.
161 ///
162 /// This function should support copies within any legal register class as
163 /// well as any cross-class copies created during instruction selection.
164 ///
165 /// The source and destination registers may overlap, which may require a
166 /// careful implementation when multiple copy instructions are required for
167 /// large registers. See for example the ARM target.
Benjamin Kramerbdc49562016-06-12 15:39:02 +0000168 void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
169 const DebugLoc &DL, unsigned DestReg, unsigned SrcReg,
Craig Topper906c2cd2014-04-29 07:58:16 +0000170 bool KillSrc) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000171
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000172 /// Store the specified register of the given register class to the specified
173 /// stack frame index. The store instruction is to be added to the given
174 /// machine basic block before the specified machine instruction. If isKill
175 /// is true, the register operand is the last use and must be marked kill.
Craig Topper906c2cd2014-04-29 07:58:16 +0000176 void storeRegToStackSlot(MachineBasicBlock &MBB,
177 MachineBasicBlock::iterator MBBI,
178 unsigned SrcReg, bool isKill, int FrameIndex,
179 const TargetRegisterClass *RC,
180 const TargetRegisterInfo *TRI) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000181
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000182 /// Load the specified register of the given register class from the specified
183 /// stack frame index. The load instruction is to be added to the given
184 /// machine basic block before the specified machine instruction.
Craig Topper906c2cd2014-04-29 07:58:16 +0000185 void loadRegFromStackSlot(MachineBasicBlock &MBB,
186 MachineBasicBlock::iterator MBBI,
187 unsigned DestReg, int FrameIndex,
188 const TargetRegisterClass *RC,
189 const TargetRegisterInfo *TRI) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000190
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000191 /// This function is called for all pseudo instructions
Colin LeMahieu7b1799c2015-03-09 22:05:21 +0000192 /// that remain after register allocation. Many pseudo instructions are
193 /// created to help register allocation. This is the place to convert them
194 /// into real instructions. The target can edit MI in place, or it can insert
195 /// new instructions and erase MI. The function should return true if
196 /// anything was changed.
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +0000197 bool expandPostRAPseudo(MachineInstr &MI) const override;
Colin LeMahieu7b1799c2015-03-09 22:05:21 +0000198
Brendon Cahoon254f8892016-07-29 16:44:44 +0000199 /// \brief Get the base register and byte offset of a load/store instr.
200 bool getMemOpBaseRegImmOfs(MachineInstr &LdSt, unsigned &BaseReg,
201 int64_t &Offset,
202 const TargetRegisterInfo *TRI) const override;
203
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000204 /// Reverses the branch condition of the specified condition list,
205 /// returning false on success and true if it cannot be reversed.
Matt Arsenault1b9fc8e2016-09-14 20:43:16 +0000206 bool reverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond)
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000207 const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000208
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000209 /// Insert a noop into the instruction stream at the specified point.
210 void insertNoop(MachineBasicBlock &MBB,
211 MachineBasicBlock::iterator MI) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000212
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000213 /// Returns true if the instruction is already predicated.
Duncan P. N. Exon Smith6307eb52016-02-23 02:46:52 +0000214 bool isPredicated(const MachineInstr &MI) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000215
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000216 /// Return true for post-incremented instructions.
Krzysztof Parzyszek8fb181c2016-08-01 17:55:48 +0000217 bool isPostIncrement(const MachineInstr &MI) const override;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000218
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000219 /// Convert the instruction into a predicated instruction.
220 /// It returns true if the operation was successful.
Duncan P. N. Exon Smith6307eb52016-02-23 02:46:52 +0000221 bool PredicateInstruction(MachineInstr &MI,
Ahmed Bougachac88bf542015-06-11 19:30:37 +0000222 ArrayRef<MachineOperand> Cond) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000223
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000224 /// Returns true if the first specified predicate
225 /// subsumes the second, e.g. GE subsumes GT.
Ahmed Bougachac88bf542015-06-11 19:30:37 +0000226 bool SubsumesPredicate(ArrayRef<MachineOperand> Pred1,
227 ArrayRef<MachineOperand> Pred2) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000228
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000229 /// If the specified instruction defines any predicate
230 /// or condition code register(s) used for predication, returns true as well
231 /// as the definition predicate(s) by reference.
Duncan P. N. Exon Smith6307eb52016-02-23 02:46:52 +0000232 bool DefinesPredicate(MachineInstr &MI,
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000233 std::vector<MachineOperand> &Pred) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000234
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000235 /// Return true if the specified instruction can be predicated.
236 /// By default, this returns true for every instruction with a
237 /// PredicateOperand.
Krzysztof Parzyszekcc318712017-03-03 18:30:54 +0000238 bool isPredicable(const MachineInstr &MI) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000239
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000240 /// Test if the given instruction should be considered a scheduling boundary.
241 /// This primarily includes labels and terminators.
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +0000242 bool isSchedulingBoundary(const MachineInstr &MI,
Craig Topper906c2cd2014-04-29 07:58:16 +0000243 const MachineBasicBlock *MBB,
244 const MachineFunction &MF) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000245
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000246 /// Measure the specified inline asm to determine an approximation of its
247 /// length.
248 unsigned getInlineAsmLength(const char *Str,
249 const MCAsmInfo &MAI) const override;
250
251 /// Allocate and return a hazard recognizer to use for this target when
252 /// scheduling the machine instructions after register allocation.
253 ScheduleHazardRecognizer*
254 CreateTargetPostRAHazardRecognizer(const InstrItineraryData*,
255 const ScheduleDAG *DAG) const override;
256
257 /// For a comparison instruction, return the source registers
258 /// in SrcReg and SrcReg2 if having two register operands, and the value it
259 /// compares against in CmpValue. Return true if the comparison instruction
260 /// can be analyzed.
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +0000261 bool analyzeCompare(const MachineInstr &MI, unsigned &SrcReg,
262 unsigned &SrcReg2, int &Mask, int &Value) const override;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000263
264 /// Compute the instruction latency of a given instruction.
265 /// If the instruction has higher cost when predicated, it's returned via
266 /// PredCost.
267 unsigned getInstrLatency(const InstrItineraryData *ItinData,
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +0000268 const MachineInstr &MI,
Eugene Zelenkob2ca1b32017-01-04 02:02:05 +0000269 unsigned *PredCost = nullptr) const override;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000270
271 /// Create machine specific model for scheduling.
272 DFAPacketizer *
273 CreateTargetScheduleState(const TargetSubtargetInfo &STI) const override;
274
275 // Sometimes, it is possible for the target
276 // to tell, even without aliasing information, that two MIs access different
277 // memory addresses. This function returns true if two MIs access different
278 // memory addresses and false otherwise.
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +0000279 bool
280 areMemAccessesTriviallyDisjoint(MachineInstr &MIa, MachineInstr &MIb,
281 AliasAnalysis *AA = nullptr) const override;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000282
Brendon Cahoon254f8892016-07-29 16:44:44 +0000283 /// For instructions with a base and offset, return the position of the
284 /// base register and offset operands.
Krzysztof Parzyszek8fb181c2016-08-01 17:55:48 +0000285 bool getBaseAndOffsetPosition(const MachineInstr &MI, unsigned &BasePos,
Brendon Cahoon254f8892016-07-29 16:44:44 +0000286 unsigned &OffsetPos) const override;
287
288 /// If the instruction is an increment of a constant value, return the amount.
Krzysztof Parzyszek8fb181c2016-08-01 17:55:48 +0000289 bool getIncrementValue(const MachineInstr &MI, int &Value) const override;
Brendon Cahoon254f8892016-07-29 16:44:44 +0000290
Krzysztof Parzyszek2af50372017-05-03 20:10:36 +0000291 /// getOperandLatency - Compute and return the use operand latency of a given
292 /// pair of def and use.
293 /// In most cases, the static scheduling itinerary was enough to determine the
294 /// operand latency. But it may not be possible for instructions with variable
295 /// number of defs / uses.
296 ///
297 /// This is a raw interface to the itinerary that may be directly overriden by
298 /// a target. Use computeOperandLatency to get the best estimate of latency.
299 int getOperandLatency(const InstrItineraryData *ItinData,
300 const MachineInstr &DefMI, unsigned DefIdx,
301 const MachineInstr &UseMI,
302 unsigned UseIdx) const override;
303
Dean Michael Berris6d6addb2016-09-01 01:58:24 +0000304 bool isTailCall(const MachineInstr &MI) const override;
305
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000306 /// HexagonInstrInfo specifics.
307 ///
308
309 const HexagonRegisterInfo &getRegisterInfo() const { return RI; }
310
311 unsigned createVR(MachineFunction* MF, MVT VT) const;
312
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000313 bool isAbsoluteSet(const MachineInstr &MI) const;
314 bool isAccumulator(const MachineInstr &MI) const;
315 bool isComplex(const MachineInstr &MI) const;
316 bool isCompoundBranchInstr(const MachineInstr &MI) const;
317 bool isCondInst(const MachineInstr &MI) const;
318 bool isConditionalALU32 (const MachineInstr &MI) const;
319 bool isConditionalLoad(const MachineInstr &MI) const;
320 bool isConditionalStore(const MachineInstr &MI) const;
321 bool isConditionalTransfer(const MachineInstr &MI) const;
322 bool isConstExtended(const MachineInstr &MI) const;
323 bool isDeallocRet(const MachineInstr &MI) const;
324 bool isDependent(const MachineInstr &ProdMI,
325 const MachineInstr &ConsMI) const;
326 bool isDotCurInst(const MachineInstr &MI) const;
327 bool isDotNewInst(const MachineInstr &MI) const;
328 bool isDuplexPair(const MachineInstr &MIa, const MachineInstr &MIb) const;
329 bool isEarlySourceInstr(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000330 bool isEndLoopN(unsigned Opcode) const;
331 bool isExpr(unsigned OpType) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000332 bool isExtendable(const MachineInstr &MI) const;
333 bool isExtended(const MachineInstr &MI) const;
334 bool isFloat(const MachineInstr &MI) const;
335 bool isHVXMemWithAIndirect(const MachineInstr &I,
336 const MachineInstr &J) const;
337 bool isIndirectCall(const MachineInstr &MI) const;
338 bool isIndirectL4Return(const MachineInstr &MI) const;
339 bool isJumpR(const MachineInstr &MI) const;
340 bool isJumpWithinBranchRange(const MachineInstr &MI, unsigned offset) const;
341 bool isLateInstrFeedsEarlyInstr(const MachineInstr &LRMI,
342 const MachineInstr &ESMI) const;
343 bool isLateResultInstr(const MachineInstr &MI) const;
344 bool isLateSourceInstr(const MachineInstr &MI) const;
345 bool isLoopN(const MachineInstr &MI) const;
346 bool isMemOp(const MachineInstr &MI) const;
347 bool isNewValue(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000348 bool isNewValue(unsigned Opcode) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000349 bool isNewValueInst(const MachineInstr &MI) const;
350 bool isNewValueJump(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000351 bool isNewValueJump(unsigned Opcode) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000352 bool isNewValueStore(const MachineInstr &MI) const;
Jyotsna Verma300f0b92013-05-10 20:27:34 +0000353 bool isNewValueStore(unsigned Opcode) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000354 bool isOperandExtended(const MachineInstr &MI, unsigned OperandNum) const;
Duncan P. N. Exon Smith6307eb52016-02-23 02:46:52 +0000355 bool isPredicatedNew(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000356 bool isPredicatedNew(unsigned Opcode) const;
Duncan P. N. Exon Smith6307eb52016-02-23 02:46:52 +0000357 bool isPredicatedTrue(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000358 bool isPredicatedTrue(unsigned Opcode) const;
359 bool isPredicated(unsigned Opcode) const;
360 bool isPredicateLate(unsigned Opcode) const;
361 bool isPredictedTaken(unsigned Opcode) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000362 bool isSaveCalleeSavedRegsCall(const MachineInstr &MI) const;
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +0000363 bool isSignExtendingLoad(const MachineInstr &MI) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000364 bool isSolo(const MachineInstr &MI) const;
365 bool isSpillPredRegOp(const MachineInstr &MI) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000366 bool isTC1(const MachineInstr &MI) const;
367 bool isTC2(const MachineInstr &MI) const;
368 bool isTC2Early(const MachineInstr &MI) const;
369 bool isTC4x(const MachineInstr &MI) const;
370 bool isToBeScheduledASAP(const MachineInstr &MI1,
371 const MachineInstr &MI2) const;
Krzysztof Parzyszek2af50372017-05-03 20:10:36 +0000372 bool isHVXVec(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000373 bool isValidAutoIncImm(const EVT VT, const int Offset) const;
374 bool isValidOffset(unsigned Opcode, int Offset, bool Extend = true) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000375 bool isVecAcc(const MachineInstr &MI) const;
376 bool isVecALU(const MachineInstr &MI) const;
377 bool isVecUsableNextPacket(const MachineInstr &ProdMI,
378 const MachineInstr &ConsMI) const;
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +0000379 bool isZeroExtendingLoad(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000380
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000381 bool addLatencyToSchedule(const MachineInstr &MI1,
382 const MachineInstr &MI2) const;
383 bool canExecuteInBundle(const MachineInstr &First,
384 const MachineInstr &Second) const;
Krzysztof Parzyszek1b689da2016-08-11 21:14:25 +0000385 bool doesNotReturn(const MachineInstr &CallMI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000386 bool hasEHLabel(const MachineBasicBlock *B) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000387 bool hasNonExtEquivalent(const MachineInstr &MI) const;
388 bool hasPseudoInstrPair(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000389 bool hasUncondBranch(const MachineBasicBlock *B) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000390 bool mayBeCurLoad(const MachineInstr &MI) const;
391 bool mayBeNewStore(const MachineInstr &MI) const;
392 bool producesStall(const MachineInstr &ProdMI,
393 const MachineInstr &ConsMI) const;
394 bool producesStall(const MachineInstr &MI,
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000395 MachineBasicBlock::const_instr_iterator MII) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000396 bool predCanBeUsedAsDotNew(const MachineInstr &MI, unsigned PredReg) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000397 bool PredOpcodeHasJMP_c(unsigned Opcode) const;
398 bool predOpcodeHasNot(ArrayRef<MachineOperand> Cond) const;
399
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000400 short getAbsoluteForm(const MachineInstr &MI) const;
401 unsigned getAddrMode(const MachineInstr &MI) const;
402 unsigned getBaseAndOffset(const MachineInstr &MI, int &Offset,
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000403 unsigned &AccessSize) const;
Krzysztof Parzyszekf5cbac92016-04-29 15:49:13 +0000404 short getBaseWithLongOffset(short Opcode) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000405 short getBaseWithLongOffset(const MachineInstr &MI) const;
406 short getBaseWithRegOffset(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000407 SmallVector<MachineInstr*,2> getBranchingInstrs(MachineBasicBlock& MBB) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000408 unsigned getCExtOpNum(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000409 HexagonII::CompoundGroup
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000410 getCompoundCandidateGroup(const MachineInstr &MI) const;
411 unsigned getCompoundOpcode(const MachineInstr &GA,
412 const MachineInstr &GB) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000413 int getCondOpcode(int Opc, bool sense) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000414 int getDotCurOp(const MachineInstr &MI) const;
Krzysztof Parzyszek0a8043e2017-05-03 15:28:56 +0000415 int getNonDotCurOp(const MachineInstr &MI) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000416 int getDotNewOp(const MachineInstr &MI) const;
417 int getDotNewPredJumpOp(const MachineInstr &MI,
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000418 const MachineBranchProbabilityInfo *MBPI) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000419 int getDotNewPredOp(const MachineInstr &MI,
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000420 const MachineBranchProbabilityInfo *MBPI) const;
Krzysztof Parzyszek143158b2017-03-06 17:03:16 +0000421 int getDotOldOp(const MachineInstr &MI) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000422 HexagonII::SubInstructionGroup getDuplexCandidateGroup(const MachineInstr &MI)
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000423 const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000424 short getEquivalentHWInstr(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000425 MachineInstr *getFirstNonDbgInst(MachineBasicBlock *BB) const;
426 unsigned getInstrTimingClassLatency(const InstrItineraryData *ItinData,
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000427 const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000428 bool getInvertedPredSense(SmallVectorImpl<MachineOperand> &Cond) const;
429 unsigned getInvertedPredicatedOpcode(const int Opc) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000430 int getMaxValue(const MachineInstr &MI) const;
431 unsigned getMemAccessSize(const MachineInstr &MI) const;
432 int getMinValue(const MachineInstr &MI) const;
433 short getNonExtOpcode(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000434 bool getPredReg(ArrayRef<MachineOperand> Cond, unsigned &PredReg,
435 unsigned &PredRegPos, unsigned &PredRegFlags) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000436 short getPseudoInstrPair(const MachineInstr &MI) const;
437 short getRegForm(const MachineInstr &MI) const;
438 unsigned getSize(const MachineInstr &MI) const;
439 uint64_t getType(const MachineInstr &MI) const;
440 unsigned getUnits(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000441
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000442 /// getInstrTimingClassLatency - Compute the instruction latency of a given
443 /// instruction using Timing Class information, if available.
444 unsigned nonDbgBBSize(const MachineBasicBlock *BB) const;
445 unsigned nonDbgBundleSize(MachineBasicBlock::const_iterator BundleHead) const;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000446
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000447 void immediateExtend(MachineInstr &MI) const;
448 bool invertAndChangeJumpTarget(MachineInstr &MI,
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000449 MachineBasicBlock* NewTarget) const;
450 void genAllInsnTimingClasses(MachineFunction &MF) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000451 bool reversePredSense(MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000452 unsigned reversePrediction(unsigned Opcode) const;
453 bool validateBranchCond(const ArrayRef<MachineOperand> &Cond) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000454 short xformRegToImmOffset(const MachineInstr &MI) const;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000455};
456
Eugene Zelenkob2ca1b32017-01-04 02:02:05 +0000457} // end namespace llvm
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000458
Eugene Zelenkob2ca1b32017-01-04 02:02:05 +0000459#endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONINSTRINFO_H