blob: 158f181b35d2b7515b5300fce580726f4ccf1304 [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"
Jyotsna Verma1d297502013-05-02 15:39:30 +000019#include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
Chandler Carruth8a8cd2b2014-01-07 11:48:04 +000020#include "llvm/Target/TargetFrameLowering.h"
21#include "llvm/Target/TargetInstrInfo.h"
Tony Linthicum1213a7a2011-12-12 21:14:40 +000022
23#define GET_INSTRINFO_HEADER
24#include "HexagonGenInstrInfo.inc"
25
26namespace llvm {
27
Patrik Hagglund8d09a6c2014-03-15 09:11:41 +000028struct EVT;
Eric Christopher234a1ec2015-03-12 06:07:16 +000029class HexagonSubtarget;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +000030
Tony Linthicum1213a7a2011-12-12 21:14:40 +000031class HexagonInstrInfo : public HexagonGenInstrInfo {
Juergen Ributzkad12ccbd2013-11-19 00:57:56 +000032 virtual void anchor();
Tony Linthicum1213a7a2011-12-12 21:14:40 +000033 const HexagonRegisterInfo RI;
Jyotsna Verma5ed51812013-05-01 21:37:34 +000034
Tony Linthicum1213a7a2011-12-12 21:14:40 +000035public:
36 explicit HexagonInstrInfo(HexagonSubtarget &ST);
37
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +000038 /// TargetInstrInfo overrides.
Tony Linthicum1213a7a2011-12-12 21:14:40 +000039 ///
Tony Linthicum1213a7a2011-12-12 21:14:40 +000040
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +000041 /// If the specified machine instruction is a direct
Tony Linthicum1213a7a2011-12-12 21:14:40 +000042 /// load from a stack slot, return the virtual or physical register number of
43 /// the destination along with the FrameIndex of the loaded stack slot. If
44 /// not, return 0. This predicate must return 0 if the instruction has
45 /// any side effects other than loading from the stack slot.
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +000046 unsigned isLoadFromStackSlot(const MachineInstr &MI,
Craig Topper906c2cd2014-04-29 07:58:16 +000047 int &FrameIndex) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +000048
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +000049 /// If the specified machine instruction is a direct
Tony Linthicum1213a7a2011-12-12 21:14:40 +000050 /// store to a stack slot, return the virtual or physical register number of
51 /// the source reg along with the FrameIndex of the loaded stack slot. If
52 /// not, return 0. This predicate must return 0 if the instruction has
53 /// any side effects other than storing to the stack slot.
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +000054 unsigned isStoreToStackSlot(const MachineInstr &MI,
Craig Topper906c2cd2014-04-29 07:58:16 +000055 int &FrameIndex) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +000056
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +000057 /// Analyze the branching code at the end of MBB, returning
58 /// true if it cannot be understood (e.g. it's a switch dispatch or isn't
59 /// implemented for a target). Upon success, this returns false and returns
60 /// with the following information in various cases:
61 ///
62 /// 1. If this block ends with no branches (it just falls through to its succ)
63 /// just return false, leaving TBB/FBB null.
64 /// 2. If this block ends with only an unconditional branch, it sets TBB to be
65 /// the destination block.
66 /// 3. If this block ends with a conditional branch and it falls through to a
67 /// successor block, it sets TBB to be the branch destination block and a
68 /// list of operands that evaluate the condition. These operands can be
69 /// passed to other TargetInstrInfo methods to create new branches.
70 /// 4. If this block ends with a conditional branch followed by an
71 /// unconditional branch, it returns the 'true' destination in TBB, the
72 /// 'false' destination in FBB, and a list of operands that evaluate the
73 /// condition. These operands can be passed to other TargetInstrInfo
74 /// methods to create new branches.
75 ///
76 /// Note that RemoveBranch and InsertBranch must be implemented to support
77 /// cases where this method returns success.
78 ///
79 /// If AllowModify is true, then this routine is allowed to modify the basic
80 /// block (e.g. delete instructions after the unconditional branch).
81 ///
Jacques Pienaar71c30a12016-07-15 14:41:04 +000082 bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
83 MachineBasicBlock *&FBB,
84 SmallVectorImpl<MachineOperand> &Cond,
85 bool AllowModify) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +000086
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +000087 /// Remove the branching code at the end of the specific MBB.
88 /// This is only invoked in cases where AnalyzeBranch returns success. It
89 /// returns the number of instructions that were removed.
Matt Arsenaulta2b036e2016-09-14 17:23:48 +000090 unsigned RemoveBranch(MachineBasicBlock &MBB,
91 int *BytesRemoved = nullptr) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +000092
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +000093 /// Insert branch code into the end of the specified MachineBasicBlock.
94 /// The operands to this method are the same as those
95 /// returned by AnalyzeBranch. This is only invoked in cases where
96 /// AnalyzeBranch returns success. It returns the number of instructions
97 /// inserted.
98 ///
99 /// It is also invoked by tail merging to add unconditional branches in
100 /// cases where AnalyzeBranch doesn't apply because there was no original
101 /// branch to analyze. At least this much must be implemented, else tail
102 /// merging needs to be disabled.
Craig Topper906c2cd2014-04-29 07:58:16 +0000103 unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
Ahmed Bougachac88bf542015-06-11 19:30:37 +0000104 MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond,
Matt Arsenaulta2b036e2016-09-14 17:23:48 +0000105 const DebugLoc &DL,
106 int *BytesAdded = nullptr) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000107
Brendon Cahoon254f8892016-07-29 16:44:44 +0000108 /// Analyze the loop code, return true if it cannot be understood. Upon
109 /// success, this function returns false and returns information about the
110 /// induction variable and compare instruction used at the end.
111 bool analyzeLoop(MachineLoop &L, MachineInstr *&IndVarInst,
112 MachineInstr *&CmpInst) const override;
113
114 /// Generate code to reduce the loop iteration by one and check if the loop is
115 /// finished. Return the value/register of the the new loop count. We need
116 /// this function when peeling off one or more iterations of a loop. This
117 /// function assumes the nth iteration is peeled first.
118 unsigned reduceLoopCount(MachineBasicBlock &MBB,
Krzysztof Parzyszek8fb181c2016-08-01 17:55:48 +0000119 MachineInstr *IndVar, MachineInstr &Cmp,
Brendon Cahoon254f8892016-07-29 16:44:44 +0000120 SmallVectorImpl<MachineOperand> &Cond,
121 SmallVectorImpl<MachineInstr *> &PrevInsts,
122 unsigned Iter, unsigned MaxIter) const override;
123
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000124 /// Return true if it's profitable to predicate
125 /// instructions with accumulated instruction latency of "NumCycles"
126 /// of the specified basic block, where the probability of the instructions
127 /// being executed is given by Probability, and Confidence is a measure
128 /// of our confidence that it will be properly predicted.
129 bool isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumCycles,
130 unsigned ExtraPredCycles,
131 BranchProbability Probability) const override;
Krzysztof Parzyszekcfe285e2013-02-11 20:04:29 +0000132
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000133 /// Second variant of isProfitableToIfCvt. This one
134 /// checks for the case where two basic blocks from true and false path
135 /// of a if-then-else (diamond) are predicated on mutally exclusive
136 /// predicates, where the probability of the true path being taken is given
137 /// by Probability, and Confidence is a measure of our confidence that it
138 /// will be properly predicted.
139 bool isProfitableToIfCvt(MachineBasicBlock &TMBB,
140 unsigned NumTCycles, unsigned ExtraTCycles,
141 MachineBasicBlock &FMBB,
142 unsigned NumFCycles, unsigned ExtraFCycles,
143 BranchProbability Probability) const override;
144
145 /// Return true if it's profitable for if-converter to duplicate instructions
146 /// of specified accumulated instruction latencies in the specified MBB to
147 /// enable if-conversion.
148 /// The probability of the instructions being executed is given by
149 /// Probability, and Confidence is a measure of our confidence that it
150 /// will be properly predicted.
151 bool isProfitableToDupForIfCvt(MachineBasicBlock &MBB, unsigned NumCycles,
152 BranchProbability Probability) const override;
153
154 /// Emit instructions to copy a pair of physical registers.
155 ///
156 /// This function should support copies within any legal register class as
157 /// well as any cross-class copies created during instruction selection.
158 ///
159 /// The source and destination registers may overlap, which may require a
160 /// careful implementation when multiple copy instructions are required for
161 /// large registers. See for example the ARM target.
Benjamin Kramerbdc49562016-06-12 15:39:02 +0000162 void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
163 const DebugLoc &DL, unsigned DestReg, unsigned SrcReg,
Craig Topper906c2cd2014-04-29 07:58:16 +0000164 bool KillSrc) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000165
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000166 /// Store the specified register of the given register class to the specified
167 /// stack frame index. The store instruction is to be added to the given
168 /// machine basic block before the specified machine instruction. If isKill
169 /// is true, the register operand is the last use and must be marked kill.
Craig Topper906c2cd2014-04-29 07:58:16 +0000170 void storeRegToStackSlot(MachineBasicBlock &MBB,
171 MachineBasicBlock::iterator MBBI,
172 unsigned SrcReg, bool isKill, int FrameIndex,
173 const TargetRegisterClass *RC,
174 const TargetRegisterInfo *TRI) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000175
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000176 /// Load the specified register of the given register class from the specified
177 /// stack frame index. The load instruction is to be added to the given
178 /// machine basic block before the specified machine instruction.
Craig Topper906c2cd2014-04-29 07:58:16 +0000179 void loadRegFromStackSlot(MachineBasicBlock &MBB,
180 MachineBasicBlock::iterator MBBI,
181 unsigned DestReg, int FrameIndex,
182 const TargetRegisterClass *RC,
183 const TargetRegisterInfo *TRI) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000184
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000185 /// This function is called for all pseudo instructions
Colin LeMahieu7b1799c2015-03-09 22:05:21 +0000186 /// that remain after register allocation. Many pseudo instructions are
187 /// created to help register allocation. This is the place to convert them
188 /// into real instructions. The target can edit MI in place, or it can insert
189 /// new instructions and erase MI. The function should return true if
190 /// anything was changed.
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +0000191 bool expandPostRAPseudo(MachineInstr &MI) const override;
Colin LeMahieu7b1799c2015-03-09 22:05:21 +0000192
Brendon Cahoon254f8892016-07-29 16:44:44 +0000193 /// \brief Get the base register and byte offset of a load/store instr.
194 bool getMemOpBaseRegImmOfs(MachineInstr &LdSt, unsigned &BaseReg,
195 int64_t &Offset,
196 const TargetRegisterInfo *TRI) const override;
197
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000198 /// Reverses the branch condition of the specified condition list,
199 /// returning false on success and true if it cannot be reversed.
200 bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond)
201 const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000202
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000203 /// Insert a noop into the instruction stream at the specified point.
204 void insertNoop(MachineBasicBlock &MBB,
205 MachineBasicBlock::iterator MI) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000206
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000207 /// Returns true if the instruction is already predicated.
Duncan P. N. Exon Smith6307eb52016-02-23 02:46:52 +0000208 bool isPredicated(const MachineInstr &MI) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000209
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000210 /// Return true for post-incremented instructions.
Krzysztof Parzyszek8fb181c2016-08-01 17:55:48 +0000211 bool isPostIncrement(const MachineInstr &MI) const override;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000212
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000213 /// Convert the instruction into a predicated instruction.
214 /// It returns true if the operation was successful.
Duncan P. N. Exon Smith6307eb52016-02-23 02:46:52 +0000215 bool PredicateInstruction(MachineInstr &MI,
Ahmed Bougachac88bf542015-06-11 19:30:37 +0000216 ArrayRef<MachineOperand> Cond) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000217
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000218 /// Returns true if the first specified predicate
219 /// subsumes the second, e.g. GE subsumes GT.
Ahmed Bougachac88bf542015-06-11 19:30:37 +0000220 bool SubsumesPredicate(ArrayRef<MachineOperand> Pred1,
221 ArrayRef<MachineOperand> Pred2) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000222
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000223 /// If the specified instruction defines any predicate
224 /// or condition code register(s) used for predication, returns true as well
225 /// as the definition predicate(s) by reference.
Duncan P. N. Exon Smith6307eb52016-02-23 02:46:52 +0000226 bool DefinesPredicate(MachineInstr &MI,
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000227 std::vector<MachineOperand> &Pred) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000228
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000229 /// Return true if the specified instruction can be predicated.
230 /// By default, this returns true for every instruction with a
231 /// PredicateOperand.
Duncan P. N. Exon Smith6307eb52016-02-23 02:46:52 +0000232 bool isPredicable(MachineInstr &MI) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000233
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000234 /// Test if the given instruction should be considered a scheduling boundary.
235 /// This primarily includes labels and terminators.
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +0000236 bool isSchedulingBoundary(const MachineInstr &MI,
Craig Topper906c2cd2014-04-29 07:58:16 +0000237 const MachineBasicBlock *MBB,
238 const MachineFunction &MF) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000239
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000240 /// Measure the specified inline asm to determine an approximation of its
241 /// length.
242 unsigned getInlineAsmLength(const char *Str,
243 const MCAsmInfo &MAI) const override;
244
245 /// Allocate and return a hazard recognizer to use for this target when
246 /// scheduling the machine instructions after register allocation.
247 ScheduleHazardRecognizer*
248 CreateTargetPostRAHazardRecognizer(const InstrItineraryData*,
249 const ScheduleDAG *DAG) const override;
250
251 /// For a comparison instruction, return the source registers
252 /// in SrcReg and SrcReg2 if having two register operands, and the value it
253 /// compares against in CmpValue. Return true if the comparison instruction
254 /// can be analyzed.
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +0000255 bool analyzeCompare(const MachineInstr &MI, unsigned &SrcReg,
256 unsigned &SrcReg2, int &Mask, int &Value) const override;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000257
258 /// Compute the instruction latency of a given instruction.
259 /// If the instruction has higher cost when predicated, it's returned via
260 /// PredCost.
261 unsigned getInstrLatency(const InstrItineraryData *ItinData,
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +0000262 const MachineInstr &MI,
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000263 unsigned *PredCost = 0) const override;
264
265 /// Create machine specific model for scheduling.
266 DFAPacketizer *
267 CreateTargetScheduleState(const TargetSubtargetInfo &STI) const override;
268
269 // Sometimes, it is possible for the target
270 // to tell, even without aliasing information, that two MIs access different
271 // memory addresses. This function returns true if two MIs access different
272 // memory addresses and false otherwise.
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +0000273 bool
274 areMemAccessesTriviallyDisjoint(MachineInstr &MIa, MachineInstr &MIb,
275 AliasAnalysis *AA = nullptr) const override;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000276
Brendon Cahoon254f8892016-07-29 16:44:44 +0000277 /// For instructions with a base and offset, return the position of the
278 /// base register and offset operands.
Krzysztof Parzyszek8fb181c2016-08-01 17:55:48 +0000279 bool getBaseAndOffsetPosition(const MachineInstr &MI, unsigned &BasePos,
Brendon Cahoon254f8892016-07-29 16:44:44 +0000280 unsigned &OffsetPos) const override;
281
282 /// If the instruction is an increment of a constant value, return the amount.
Krzysztof Parzyszek8fb181c2016-08-01 17:55:48 +0000283 bool getIncrementValue(const MachineInstr &MI, int &Value) const override;
Brendon Cahoon254f8892016-07-29 16:44:44 +0000284
Dean Michael Berris6d6addb2016-09-01 01:58:24 +0000285 bool isTailCall(const MachineInstr &MI) const override;
286
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000287 /// HexagonInstrInfo specifics.
288 ///
289
290 const HexagonRegisterInfo &getRegisterInfo() const { return RI; }
291
292 unsigned createVR(MachineFunction* MF, MVT VT) const;
293
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000294 bool isAbsoluteSet(const MachineInstr &MI) const;
295 bool isAccumulator(const MachineInstr &MI) const;
296 bool isComplex(const MachineInstr &MI) const;
297 bool isCompoundBranchInstr(const MachineInstr &MI) const;
298 bool isCondInst(const MachineInstr &MI) const;
299 bool isConditionalALU32 (const MachineInstr &MI) const;
300 bool isConditionalLoad(const MachineInstr &MI) const;
301 bool isConditionalStore(const MachineInstr &MI) const;
302 bool isConditionalTransfer(const MachineInstr &MI) const;
303 bool isConstExtended(const MachineInstr &MI) const;
304 bool isDeallocRet(const MachineInstr &MI) const;
305 bool isDependent(const MachineInstr &ProdMI,
306 const MachineInstr &ConsMI) const;
307 bool isDotCurInst(const MachineInstr &MI) const;
308 bool isDotNewInst(const MachineInstr &MI) const;
309 bool isDuplexPair(const MachineInstr &MIa, const MachineInstr &MIb) const;
310 bool isEarlySourceInstr(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000311 bool isEndLoopN(unsigned Opcode) const;
312 bool isExpr(unsigned OpType) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000313 bool isExtendable(const MachineInstr &MI) const;
314 bool isExtended(const MachineInstr &MI) const;
315 bool isFloat(const MachineInstr &MI) const;
316 bool isHVXMemWithAIndirect(const MachineInstr &I,
317 const MachineInstr &J) const;
318 bool isIndirectCall(const MachineInstr &MI) const;
319 bool isIndirectL4Return(const MachineInstr &MI) const;
320 bool isJumpR(const MachineInstr &MI) const;
321 bool isJumpWithinBranchRange(const MachineInstr &MI, unsigned offset) const;
322 bool isLateInstrFeedsEarlyInstr(const MachineInstr &LRMI,
323 const MachineInstr &ESMI) const;
324 bool isLateResultInstr(const MachineInstr &MI) const;
325 bool isLateSourceInstr(const MachineInstr &MI) const;
326 bool isLoopN(const MachineInstr &MI) const;
327 bool isMemOp(const MachineInstr &MI) const;
328 bool isNewValue(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000329 bool isNewValue(unsigned Opcode) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000330 bool isNewValueInst(const MachineInstr &MI) const;
331 bool isNewValueJump(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000332 bool isNewValueJump(unsigned Opcode) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000333 bool isNewValueStore(const MachineInstr &MI) const;
Jyotsna Verma300f0b92013-05-10 20:27:34 +0000334 bool isNewValueStore(unsigned Opcode) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000335 bool isOperandExtended(const MachineInstr &MI, unsigned OperandNum) const;
Duncan P. N. Exon Smith6307eb52016-02-23 02:46:52 +0000336 bool isPredicatedNew(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000337 bool isPredicatedNew(unsigned Opcode) const;
Duncan P. N. Exon Smith6307eb52016-02-23 02:46:52 +0000338 bool isPredicatedTrue(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000339 bool isPredicatedTrue(unsigned Opcode) const;
340 bool isPredicated(unsigned Opcode) const;
341 bool isPredicateLate(unsigned Opcode) const;
342 bool isPredictedTaken(unsigned Opcode) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000343 bool isSaveCalleeSavedRegsCall(const MachineInstr &MI) const;
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +0000344 bool isSignExtendingLoad(const MachineInstr &MI) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000345 bool isSolo(const MachineInstr &MI) const;
346 bool isSpillPredRegOp(const MachineInstr &MI) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000347 bool isTC1(const MachineInstr &MI) const;
348 bool isTC2(const MachineInstr &MI) const;
349 bool isTC2Early(const MachineInstr &MI) const;
350 bool isTC4x(const MachineInstr &MI) const;
351 bool isToBeScheduledASAP(const MachineInstr &MI1,
352 const MachineInstr &MI2) const;
353 bool isV60VectorInstruction(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000354 bool isValidAutoIncImm(const EVT VT, const int Offset) const;
355 bool isValidOffset(unsigned Opcode, int Offset, bool Extend = true) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000356 bool isVecAcc(const MachineInstr &MI) const;
357 bool isVecALU(const MachineInstr &MI) const;
358 bool isVecUsableNextPacket(const MachineInstr &ProdMI,
359 const MachineInstr &ConsMI) const;
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +0000360 bool isZeroExtendingLoad(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000361
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000362 bool addLatencyToSchedule(const MachineInstr &MI1,
363 const MachineInstr &MI2) const;
364 bool canExecuteInBundle(const MachineInstr &First,
365 const MachineInstr &Second) const;
Krzysztof Parzyszek1b689da2016-08-11 21:14:25 +0000366 bool doesNotReturn(const MachineInstr &CallMI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000367 bool hasEHLabel(const MachineBasicBlock *B) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000368 bool hasNonExtEquivalent(const MachineInstr &MI) const;
369 bool hasPseudoInstrPair(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000370 bool hasUncondBranch(const MachineBasicBlock *B) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000371 bool mayBeCurLoad(const MachineInstr &MI) const;
372 bool mayBeNewStore(const MachineInstr &MI) const;
373 bool producesStall(const MachineInstr &ProdMI,
374 const MachineInstr &ConsMI) const;
375 bool producesStall(const MachineInstr &MI,
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000376 MachineBasicBlock::const_instr_iterator MII) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000377 bool predCanBeUsedAsDotNew(const MachineInstr &MI, unsigned PredReg) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000378 bool PredOpcodeHasJMP_c(unsigned Opcode) const;
379 bool predOpcodeHasNot(ArrayRef<MachineOperand> Cond) const;
380
381
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000382 short getAbsoluteForm(const MachineInstr &MI) const;
383 unsigned getAddrMode(const MachineInstr &MI) const;
384 unsigned getBaseAndOffset(const MachineInstr &MI, int &Offset,
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000385 unsigned &AccessSize) const;
Krzysztof Parzyszekf5cbac92016-04-29 15:49:13 +0000386 short getBaseWithLongOffset(short Opcode) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000387 short getBaseWithLongOffset(const MachineInstr &MI) const;
388 short getBaseWithRegOffset(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000389 SmallVector<MachineInstr*,2> getBranchingInstrs(MachineBasicBlock& MBB) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000390 unsigned getCExtOpNum(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000391 HexagonII::CompoundGroup
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000392 getCompoundCandidateGroup(const MachineInstr &MI) const;
393 unsigned getCompoundOpcode(const MachineInstr &GA,
394 const MachineInstr &GB) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000395 int getCondOpcode(int Opc, bool sense) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000396 int getDotCurOp(const MachineInstr &MI) const;
397 int getDotNewOp(const MachineInstr &MI) const;
398 int getDotNewPredJumpOp(const MachineInstr &MI,
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000399 const MachineBranchProbabilityInfo *MBPI) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000400 int getDotNewPredOp(const MachineInstr &MI,
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000401 const MachineBranchProbabilityInfo *MBPI) const;
402 int getDotOldOp(const int opc) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000403 HexagonII::SubInstructionGroup getDuplexCandidateGroup(const MachineInstr &MI)
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000404 const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000405 short getEquivalentHWInstr(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000406 MachineInstr *getFirstNonDbgInst(MachineBasicBlock *BB) const;
407 unsigned getInstrTimingClassLatency(const InstrItineraryData *ItinData,
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000408 const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000409 bool getInvertedPredSense(SmallVectorImpl<MachineOperand> &Cond) const;
410 unsigned getInvertedPredicatedOpcode(const int Opc) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000411 int getMaxValue(const MachineInstr &MI) const;
412 unsigned getMemAccessSize(const MachineInstr &MI) const;
413 int getMinValue(const MachineInstr &MI) const;
414 short getNonExtOpcode(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000415 bool getPredReg(ArrayRef<MachineOperand> Cond, unsigned &PredReg,
416 unsigned &PredRegPos, unsigned &PredRegFlags) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000417 short getPseudoInstrPair(const MachineInstr &MI) const;
418 short getRegForm(const MachineInstr &MI) const;
419 unsigned getSize(const MachineInstr &MI) const;
420 uint64_t getType(const MachineInstr &MI) const;
421 unsigned getUnits(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000422 unsigned getValidSubTargets(const unsigned Opcode) const;
423
424
425 /// getInstrTimingClassLatency - Compute the instruction latency of a given
426 /// instruction using Timing Class information, if available.
427 unsigned nonDbgBBSize(const MachineBasicBlock *BB) const;
428 unsigned nonDbgBundleSize(MachineBasicBlock::const_iterator BundleHead) const;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000429
Jyotsna Verma84256432013-03-01 17:37:13 +0000430
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000431 void immediateExtend(MachineInstr &MI) const;
432 bool invertAndChangeJumpTarget(MachineInstr &MI,
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000433 MachineBasicBlock* NewTarget) const;
434 void genAllInsnTimingClasses(MachineFunction &MF) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000435 bool reversePredSense(MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000436 unsigned reversePrediction(unsigned Opcode) const;
437 bool validateBranchCond(const ArrayRef<MachineOperand> &Cond) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000438 short xformRegToImmOffset(const MachineInstr &MI) const;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000439};
440
Alexander Kornienkof00654e2015-06-23 09:49:53 +0000441}
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000442
443#endif