blob: 72f89ab8ff2cc1774a75c6c402c0dbd7a688073c [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.
Craig Topper906c2cd2014-04-29 07:58:16 +000090 unsigned RemoveBranch(MachineBasicBlock &MBB) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +000091
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +000092 /// Insert branch code into the end of the specified MachineBasicBlock.
93 /// The operands to this method are the same as those
94 /// returned by AnalyzeBranch. This is only invoked in cases where
95 /// AnalyzeBranch returns success. It returns the number of instructions
96 /// inserted.
97 ///
98 /// It is also invoked by tail merging to add unconditional branches in
99 /// cases where AnalyzeBranch doesn't apply because there was no original
100 /// branch to analyze. At least this much must be implemented, else tail
101 /// merging needs to be disabled.
Craig Topper906c2cd2014-04-29 07:58:16 +0000102 unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
Ahmed Bougachac88bf542015-06-11 19:30:37 +0000103 MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond,
Benjamin Kramerbdc49562016-06-12 15:39:02 +0000104 const DebugLoc &DL) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000105
Brendon Cahoon254f8892016-07-29 16:44:44 +0000106 /// Analyze the loop code, return true if it cannot be understood. Upon
107 /// success, this function returns false and returns information about the
108 /// induction variable and compare instruction used at the end.
109 bool analyzeLoop(MachineLoop &L, MachineInstr *&IndVarInst,
110 MachineInstr *&CmpInst) const override;
111
112 /// Generate code to reduce the loop iteration by one and check if the loop is
113 /// finished. Return the value/register of the the new loop count. We need
114 /// this function when peeling off one or more iterations of a loop. This
115 /// function assumes the nth iteration is peeled first.
116 unsigned reduceLoopCount(MachineBasicBlock &MBB,
Krzysztof Parzyszek8fb181c2016-08-01 17:55:48 +0000117 MachineInstr *IndVar, MachineInstr &Cmp,
Brendon Cahoon254f8892016-07-29 16:44:44 +0000118 SmallVectorImpl<MachineOperand> &Cond,
119 SmallVectorImpl<MachineInstr *> &PrevInsts,
120 unsigned Iter, unsigned MaxIter) const override;
121
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000122 /// Return true if it's profitable to predicate
123 /// instructions with accumulated instruction latency of "NumCycles"
124 /// of the specified basic block, where the probability of the instructions
125 /// being executed is given by Probability, and Confidence is a measure
126 /// of our confidence that it will be properly predicted.
127 bool isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumCycles,
128 unsigned ExtraPredCycles,
129 BranchProbability Probability) const override;
Krzysztof Parzyszekcfe285e2013-02-11 20:04:29 +0000130
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000131 /// Second variant of isProfitableToIfCvt. This one
132 /// checks for the case where two basic blocks from true and false path
133 /// of a if-then-else (diamond) are predicated on mutally exclusive
134 /// predicates, where the probability of the true path being taken is given
135 /// by Probability, and Confidence is a measure of our confidence that it
136 /// will be properly predicted.
137 bool isProfitableToIfCvt(MachineBasicBlock &TMBB,
138 unsigned NumTCycles, unsigned ExtraTCycles,
139 MachineBasicBlock &FMBB,
140 unsigned NumFCycles, unsigned ExtraFCycles,
141 BranchProbability Probability) const override;
142
143 /// Return true if it's profitable for if-converter to duplicate instructions
144 /// of specified accumulated instruction latencies in the specified MBB to
145 /// enable if-conversion.
146 /// The probability of the instructions being executed is given by
147 /// Probability, and Confidence is a measure of our confidence that it
148 /// will be properly predicted.
149 bool isProfitableToDupForIfCvt(MachineBasicBlock &MBB, unsigned NumCycles,
150 BranchProbability Probability) const override;
151
152 /// Emit instructions to copy a pair of physical registers.
153 ///
154 /// This function should support copies within any legal register class as
155 /// well as any cross-class copies created during instruction selection.
156 ///
157 /// The source and destination registers may overlap, which may require a
158 /// careful implementation when multiple copy instructions are required for
159 /// large registers. See for example the ARM target.
Benjamin Kramerbdc49562016-06-12 15:39:02 +0000160 void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
161 const DebugLoc &DL, unsigned DestReg, unsigned SrcReg,
Craig Topper906c2cd2014-04-29 07:58:16 +0000162 bool KillSrc) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000163
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000164 /// Store the specified register of the given register class to the specified
165 /// stack frame index. The store instruction is to be added to the given
166 /// machine basic block before the specified machine instruction. If isKill
167 /// is true, the register operand is the last use and must be marked kill.
Craig Topper906c2cd2014-04-29 07:58:16 +0000168 void storeRegToStackSlot(MachineBasicBlock &MBB,
169 MachineBasicBlock::iterator MBBI,
170 unsigned SrcReg, bool isKill, int FrameIndex,
171 const TargetRegisterClass *RC,
172 const TargetRegisterInfo *TRI) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000173
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000174 /// Load the specified register of the given register class from the specified
175 /// stack frame index. The load instruction is to be added to the given
176 /// machine basic block before the specified machine instruction.
Craig Topper906c2cd2014-04-29 07:58:16 +0000177 void loadRegFromStackSlot(MachineBasicBlock &MBB,
178 MachineBasicBlock::iterator MBBI,
179 unsigned DestReg, int FrameIndex,
180 const TargetRegisterClass *RC,
181 const TargetRegisterInfo *TRI) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000182
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000183 /// This function is called for all pseudo instructions
Colin LeMahieu7b1799c2015-03-09 22:05:21 +0000184 /// that remain after register allocation. Many pseudo instructions are
185 /// created to help register allocation. This is the place to convert them
186 /// into real instructions. The target can edit MI in place, or it can insert
187 /// new instructions and erase MI. The function should return true if
188 /// anything was changed.
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +0000189 bool expandPostRAPseudo(MachineInstr &MI) const override;
Colin LeMahieu7b1799c2015-03-09 22:05:21 +0000190
Brendon Cahoon254f8892016-07-29 16:44:44 +0000191 /// \brief Get the base register and byte offset of a load/store instr.
192 bool getMemOpBaseRegImmOfs(MachineInstr &LdSt, unsigned &BaseReg,
193 int64_t &Offset,
194 const TargetRegisterInfo *TRI) const override;
195
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000196 /// Reverses the branch condition of the specified condition list,
197 /// returning false on success and true if it cannot be reversed.
198 bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond)
199 const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000200
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000201 /// Insert a noop into the instruction stream at the specified point.
202 void insertNoop(MachineBasicBlock &MBB,
203 MachineBasicBlock::iterator MI) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000204
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000205 /// Returns true if the instruction is already predicated.
Duncan P. N. Exon Smith6307eb52016-02-23 02:46:52 +0000206 bool isPredicated(const MachineInstr &MI) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000207
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000208 /// Return true for post-incremented instructions.
Krzysztof Parzyszek8fb181c2016-08-01 17:55:48 +0000209 bool isPostIncrement(const MachineInstr &MI) const override;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000210
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000211 /// Convert the instruction into a predicated instruction.
212 /// It returns true if the operation was successful.
Duncan P. N. Exon Smith6307eb52016-02-23 02:46:52 +0000213 bool PredicateInstruction(MachineInstr &MI,
Ahmed Bougachac88bf542015-06-11 19:30:37 +0000214 ArrayRef<MachineOperand> Cond) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000215
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000216 /// Returns true if the first specified predicate
217 /// subsumes the second, e.g. GE subsumes GT.
Ahmed Bougachac88bf542015-06-11 19:30:37 +0000218 bool SubsumesPredicate(ArrayRef<MachineOperand> Pred1,
219 ArrayRef<MachineOperand> Pred2) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000220
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000221 /// If the specified instruction defines any predicate
222 /// or condition code register(s) used for predication, returns true as well
223 /// as the definition predicate(s) by reference.
Duncan P. N. Exon Smith6307eb52016-02-23 02:46:52 +0000224 bool DefinesPredicate(MachineInstr &MI,
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000225 std::vector<MachineOperand> &Pred) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000226
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000227 /// Return true if the specified instruction can be predicated.
228 /// By default, this returns true for every instruction with a
229 /// PredicateOperand.
Duncan P. N. Exon Smith6307eb52016-02-23 02:46:52 +0000230 bool isPredicable(MachineInstr &MI) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000231
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000232 /// Test if the given instruction should be considered a scheduling boundary.
233 /// This primarily includes labels and terminators.
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +0000234 bool isSchedulingBoundary(const MachineInstr &MI,
Craig Topper906c2cd2014-04-29 07:58:16 +0000235 const MachineBasicBlock *MBB,
236 const MachineFunction &MF) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000237
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000238 /// Measure the specified inline asm to determine an approximation of its
239 /// length.
240 unsigned getInlineAsmLength(const char *Str,
241 const MCAsmInfo &MAI) const override;
242
243 /// Allocate and return a hazard recognizer to use for this target when
244 /// scheduling the machine instructions after register allocation.
245 ScheduleHazardRecognizer*
246 CreateTargetPostRAHazardRecognizer(const InstrItineraryData*,
247 const ScheduleDAG *DAG) const override;
248
249 /// For a comparison instruction, return the source registers
250 /// in SrcReg and SrcReg2 if having two register operands, and the value it
251 /// compares against in CmpValue. Return true if the comparison instruction
252 /// can be analyzed.
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +0000253 bool analyzeCompare(const MachineInstr &MI, unsigned &SrcReg,
254 unsigned &SrcReg2, int &Mask, int &Value) const override;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000255
256 /// Compute the instruction latency of a given instruction.
257 /// If the instruction has higher cost when predicated, it's returned via
258 /// PredCost.
259 unsigned getInstrLatency(const InstrItineraryData *ItinData,
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +0000260 const MachineInstr &MI,
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000261 unsigned *PredCost = 0) const override;
262
263 /// Create machine specific model for scheduling.
264 DFAPacketizer *
265 CreateTargetScheduleState(const TargetSubtargetInfo &STI) const override;
266
267 // Sometimes, it is possible for the target
268 // to tell, even without aliasing information, that two MIs access different
269 // memory addresses. This function returns true if two MIs access different
270 // memory addresses and false otherwise.
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +0000271 bool
272 areMemAccessesTriviallyDisjoint(MachineInstr &MIa, MachineInstr &MIb,
273 AliasAnalysis *AA = nullptr) const override;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000274
Brendon Cahoon254f8892016-07-29 16:44:44 +0000275 /// For instructions with a base and offset, return the position of the
276 /// base register and offset operands.
Krzysztof Parzyszek8fb181c2016-08-01 17:55:48 +0000277 bool getBaseAndOffsetPosition(const MachineInstr &MI, unsigned &BasePos,
Brendon Cahoon254f8892016-07-29 16:44:44 +0000278 unsigned &OffsetPos) const override;
279
280 /// If the instruction is an increment of a constant value, return the amount.
Krzysztof Parzyszek8fb181c2016-08-01 17:55:48 +0000281 bool getIncrementValue(const MachineInstr &MI, int &Value) const override;
Brendon Cahoon254f8892016-07-29 16:44:44 +0000282
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000283 /// HexagonInstrInfo specifics.
284 ///
285
286 const HexagonRegisterInfo &getRegisterInfo() const { return RI; }
287
288 unsigned createVR(MachineFunction* MF, MVT VT) const;
289
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000290 bool isAbsoluteSet(const MachineInstr &MI) const;
291 bool isAccumulator(const MachineInstr &MI) const;
292 bool isComplex(const MachineInstr &MI) const;
293 bool isCompoundBranchInstr(const MachineInstr &MI) const;
294 bool isCondInst(const MachineInstr &MI) const;
295 bool isConditionalALU32 (const MachineInstr &MI) const;
296 bool isConditionalLoad(const MachineInstr &MI) const;
297 bool isConditionalStore(const MachineInstr &MI) const;
298 bool isConditionalTransfer(const MachineInstr &MI) const;
299 bool isConstExtended(const MachineInstr &MI) const;
300 bool isDeallocRet(const MachineInstr &MI) const;
301 bool isDependent(const MachineInstr &ProdMI,
302 const MachineInstr &ConsMI) const;
303 bool isDotCurInst(const MachineInstr &MI) const;
304 bool isDotNewInst(const MachineInstr &MI) const;
305 bool isDuplexPair(const MachineInstr &MIa, const MachineInstr &MIb) const;
306 bool isEarlySourceInstr(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000307 bool isEndLoopN(unsigned Opcode) const;
308 bool isExpr(unsigned OpType) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000309 bool isExtendable(const MachineInstr &MI) const;
310 bool isExtended(const MachineInstr &MI) const;
311 bool isFloat(const MachineInstr &MI) const;
312 bool isHVXMemWithAIndirect(const MachineInstr &I,
313 const MachineInstr &J) const;
314 bool isIndirectCall(const MachineInstr &MI) const;
315 bool isIndirectL4Return(const MachineInstr &MI) const;
316 bool isJumpR(const MachineInstr &MI) const;
317 bool isJumpWithinBranchRange(const MachineInstr &MI, unsigned offset) const;
318 bool isLateInstrFeedsEarlyInstr(const MachineInstr &LRMI,
319 const MachineInstr &ESMI) const;
320 bool isLateResultInstr(const MachineInstr &MI) const;
321 bool isLateSourceInstr(const MachineInstr &MI) const;
322 bool isLoopN(const MachineInstr &MI) const;
323 bool isMemOp(const MachineInstr &MI) const;
324 bool isNewValue(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000325 bool isNewValue(unsigned Opcode) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000326 bool isNewValueInst(const MachineInstr &MI) const;
327 bool isNewValueJump(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000328 bool isNewValueJump(unsigned Opcode) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000329 bool isNewValueStore(const MachineInstr &MI) const;
Jyotsna Verma300f0b92013-05-10 20:27:34 +0000330 bool isNewValueStore(unsigned Opcode) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000331 bool isOperandExtended(const MachineInstr &MI, unsigned OperandNum) const;
Duncan P. N. Exon Smith6307eb52016-02-23 02:46:52 +0000332 bool isPredicatedNew(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000333 bool isPredicatedNew(unsigned Opcode) const;
Duncan P. N. Exon Smith6307eb52016-02-23 02:46:52 +0000334 bool isPredicatedTrue(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000335 bool isPredicatedTrue(unsigned Opcode) const;
336 bool isPredicated(unsigned Opcode) const;
337 bool isPredicateLate(unsigned Opcode) const;
338 bool isPredictedTaken(unsigned Opcode) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000339 bool isSaveCalleeSavedRegsCall(const MachineInstr &MI) const;
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +0000340 bool isSignExtendingLoad(const MachineInstr &MI) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000341 bool isSolo(const MachineInstr &MI) const;
342 bool isSpillPredRegOp(const MachineInstr &MI) const;
343 bool isTailCall(const MachineInstr &MI) const;
344 bool isTC1(const MachineInstr &MI) const;
345 bool isTC2(const MachineInstr &MI) const;
346 bool isTC2Early(const MachineInstr &MI) const;
347 bool isTC4x(const MachineInstr &MI) const;
348 bool isToBeScheduledASAP(const MachineInstr &MI1,
349 const MachineInstr &MI2) const;
350 bool isV60VectorInstruction(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000351 bool isValidAutoIncImm(const EVT VT, const int Offset) const;
352 bool isValidOffset(unsigned Opcode, int Offset, bool Extend = true) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000353 bool isVecAcc(const MachineInstr &MI) const;
354 bool isVecALU(const MachineInstr &MI) const;
355 bool isVecUsableNextPacket(const MachineInstr &ProdMI,
356 const MachineInstr &ConsMI) const;
Duncan P. N. Exon Smith9cfc75c2016-06-30 00:01:54 +0000357 bool isZeroExtendingLoad(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000358
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000359 bool addLatencyToSchedule(const MachineInstr &MI1,
360 const MachineInstr &MI2) const;
361 bool canExecuteInBundle(const MachineInstr &First,
362 const MachineInstr &Second) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000363 bool hasEHLabel(const MachineBasicBlock *B) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000364 bool hasNonExtEquivalent(const MachineInstr &MI) const;
365 bool hasPseudoInstrPair(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000366 bool hasUncondBranch(const MachineBasicBlock *B) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000367 bool mayBeCurLoad(const MachineInstr &MI) const;
368 bool mayBeNewStore(const MachineInstr &MI) const;
369 bool producesStall(const MachineInstr &ProdMI,
370 const MachineInstr &ConsMI) const;
371 bool producesStall(const MachineInstr &MI,
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000372 MachineBasicBlock::const_instr_iterator MII) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000373 bool predCanBeUsedAsDotNew(const MachineInstr &MI, unsigned PredReg) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000374 bool PredOpcodeHasJMP_c(unsigned Opcode) const;
375 bool predOpcodeHasNot(ArrayRef<MachineOperand> Cond) const;
376
377
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000378 short getAbsoluteForm(const MachineInstr &MI) const;
379 unsigned getAddrMode(const MachineInstr &MI) const;
380 unsigned getBaseAndOffset(const MachineInstr &MI, int &Offset,
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000381 unsigned &AccessSize) const;
Krzysztof Parzyszekf5cbac92016-04-29 15:49:13 +0000382 short getBaseWithLongOffset(short Opcode) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000383 short getBaseWithLongOffset(const MachineInstr &MI) const;
384 short getBaseWithRegOffset(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000385 SmallVector<MachineInstr*,2> getBranchingInstrs(MachineBasicBlock& MBB) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000386 unsigned getCExtOpNum(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000387 HexagonII::CompoundGroup
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000388 getCompoundCandidateGroup(const MachineInstr &MI) const;
389 unsigned getCompoundOpcode(const MachineInstr &GA,
390 const MachineInstr &GB) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000391 int getCondOpcode(int Opc, bool sense) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000392 int getDotCurOp(const MachineInstr &MI) const;
393 int getDotNewOp(const MachineInstr &MI) const;
394 int getDotNewPredJumpOp(const MachineInstr &MI,
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000395 const MachineBranchProbabilityInfo *MBPI) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000396 int getDotNewPredOp(const MachineInstr &MI,
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000397 const MachineBranchProbabilityInfo *MBPI) const;
398 int getDotOldOp(const int opc) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000399 HexagonII::SubInstructionGroup getDuplexCandidateGroup(const MachineInstr &MI)
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000400 const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000401 short getEquivalentHWInstr(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000402 MachineInstr *getFirstNonDbgInst(MachineBasicBlock *BB) const;
403 unsigned getInstrTimingClassLatency(const InstrItineraryData *ItinData,
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000404 const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000405 bool getInvertedPredSense(SmallVectorImpl<MachineOperand> &Cond) const;
406 unsigned getInvertedPredicatedOpcode(const int Opc) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000407 int getMaxValue(const MachineInstr &MI) const;
408 unsigned getMemAccessSize(const MachineInstr &MI) const;
409 int getMinValue(const MachineInstr &MI) const;
410 short getNonExtOpcode(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000411 bool getPredReg(ArrayRef<MachineOperand> Cond, unsigned &PredReg,
412 unsigned &PredRegPos, unsigned &PredRegFlags) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000413 short getPseudoInstrPair(const MachineInstr &MI) const;
414 short getRegForm(const MachineInstr &MI) const;
415 unsigned getSize(const MachineInstr &MI) const;
416 uint64_t getType(const MachineInstr &MI) const;
417 unsigned getUnits(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000418 unsigned getValidSubTargets(const unsigned Opcode) const;
419
420
421 /// getInstrTimingClassLatency - Compute the instruction latency of a given
422 /// instruction using Timing Class information, if available.
423 unsigned nonDbgBBSize(const MachineBasicBlock *BB) const;
424 unsigned nonDbgBundleSize(MachineBasicBlock::const_iterator BundleHead) const;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000425
Jyotsna Verma84256432013-03-01 17:37:13 +0000426
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000427 void immediateExtend(MachineInstr &MI) const;
428 bool invertAndChangeJumpTarget(MachineInstr &MI,
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000429 MachineBasicBlock* NewTarget) const;
430 void genAllInsnTimingClasses(MachineFunction &MF) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000431 bool reversePredSense(MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000432 unsigned reversePrediction(unsigned Opcode) const;
433 bool validateBranchCond(const ArrayRef<MachineOperand> &Cond) const;
Krzysztof Parzyszekf0b34a52016-07-29 21:49:42 +0000434 short xformRegToImmOffset(const MachineInstr &MI) const;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000435};
436
Alexander Kornienkof00654e2015-06-23 09:49:53 +0000437}
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000438
439#endif