blob: 7cbce26125012f3da9c8e657f67e100db604b778 [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.
Craig Topper906c2cd2014-04-29 07:58:16 +000046 unsigned isLoadFromStackSlot(const MachineInstr *MI,
47 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.
Craig Topper906c2cd2014-04-29 07:58:16 +000054 unsigned isStoreToStackSlot(const MachineInstr *MI,
55 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 ///
Craig Topper906c2cd2014-04-29 07:58:16 +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
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000106 /// Return true if it's profitable to predicate
107 /// instructions with accumulated instruction latency of "NumCycles"
108 /// of the specified basic block, where the probability of the instructions
109 /// being executed is given by Probability, and Confidence is a measure
110 /// of our confidence that it will be properly predicted.
111 bool isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumCycles,
112 unsigned ExtraPredCycles,
113 BranchProbability Probability) const override;
Krzysztof Parzyszekcfe285e2013-02-11 20:04:29 +0000114
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000115 /// Second variant of isProfitableToIfCvt. This one
116 /// checks for the case where two basic blocks from true and false path
117 /// of a if-then-else (diamond) are predicated on mutally exclusive
118 /// predicates, where the probability of the true path being taken is given
119 /// by Probability, and Confidence is a measure of our confidence that it
120 /// will be properly predicted.
121 bool isProfitableToIfCvt(MachineBasicBlock &TMBB,
122 unsigned NumTCycles, unsigned ExtraTCycles,
123 MachineBasicBlock &FMBB,
124 unsigned NumFCycles, unsigned ExtraFCycles,
125 BranchProbability Probability) const override;
126
127 /// Return true if it's profitable for if-converter to duplicate instructions
128 /// of specified accumulated instruction latencies in the specified MBB to
129 /// enable if-conversion.
130 /// The probability of the instructions being executed is given by
131 /// Probability, and Confidence is a measure of our confidence that it
132 /// will be properly predicted.
133 bool isProfitableToDupForIfCvt(MachineBasicBlock &MBB, unsigned NumCycles,
134 BranchProbability Probability) const override;
135
136 /// Emit instructions to copy a pair of physical registers.
137 ///
138 /// This function should support copies within any legal register class as
139 /// well as any cross-class copies created during instruction selection.
140 ///
141 /// The source and destination registers may overlap, which may require a
142 /// careful implementation when multiple copy instructions are required for
143 /// large registers. See for example the ARM target.
Benjamin Kramerbdc49562016-06-12 15:39:02 +0000144 void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
145 const DebugLoc &DL, unsigned DestReg, unsigned SrcReg,
Craig Topper906c2cd2014-04-29 07:58:16 +0000146 bool KillSrc) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000147
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000148 /// Store the specified register of the given register class to the specified
149 /// stack frame index. The store instruction is to be added to the given
150 /// machine basic block before the specified machine instruction. If isKill
151 /// is true, the register operand is the last use and must be marked kill.
Craig Topper906c2cd2014-04-29 07:58:16 +0000152 void storeRegToStackSlot(MachineBasicBlock &MBB,
153 MachineBasicBlock::iterator MBBI,
154 unsigned SrcReg, bool isKill, int FrameIndex,
155 const TargetRegisterClass *RC,
156 const TargetRegisterInfo *TRI) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000157
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000158 /// Load the specified register of the given register class from the specified
159 /// stack frame index. The load instruction is to be added to the given
160 /// machine basic block before the specified machine instruction.
Craig Topper906c2cd2014-04-29 07:58:16 +0000161 void loadRegFromStackSlot(MachineBasicBlock &MBB,
162 MachineBasicBlock::iterator MBBI,
163 unsigned DestReg, int FrameIndex,
164 const TargetRegisterClass *RC,
165 const TargetRegisterInfo *TRI) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000166
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000167 /// This function is called for all pseudo instructions
Colin LeMahieu7b1799c2015-03-09 22:05:21 +0000168 /// that remain after register allocation. Many pseudo instructions are
169 /// created to help register allocation. This is the place to convert them
170 /// into real instructions. The target can edit MI in place, or it can insert
171 /// new instructions and erase MI. The function should return true if
172 /// anything was changed.
173 bool expandPostRAPseudo(MachineBasicBlock::iterator MI) const override;
174
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000175 /// Reverses the branch condition of the specified condition list,
176 /// returning false on success and true if it cannot be reversed.
177 bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond)
178 const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000179
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000180 /// Insert a noop into the instruction stream at the specified point.
181 void insertNoop(MachineBasicBlock &MBB,
182 MachineBasicBlock::iterator MI) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000183
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000184 /// Returns true if the instruction is already predicated.
Duncan P. N. Exon Smith6307eb52016-02-23 02:46:52 +0000185 bool isPredicated(const MachineInstr &MI) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000186
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000187 /// Convert the instruction into a predicated instruction.
188 /// It returns true if the operation was successful.
Duncan P. N. Exon Smith6307eb52016-02-23 02:46:52 +0000189 bool PredicateInstruction(MachineInstr &MI,
Ahmed Bougachac88bf542015-06-11 19:30:37 +0000190 ArrayRef<MachineOperand> Cond) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000191
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000192 /// Returns true if the first specified predicate
193 /// subsumes the second, e.g. GE subsumes GT.
Ahmed Bougachac88bf542015-06-11 19:30:37 +0000194 bool SubsumesPredicate(ArrayRef<MachineOperand> Pred1,
195 ArrayRef<MachineOperand> Pred2) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000196
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000197 /// If the specified instruction defines any predicate
198 /// or condition code register(s) used for predication, returns true as well
199 /// as the definition predicate(s) by reference.
Duncan P. N. Exon Smith6307eb52016-02-23 02:46:52 +0000200 bool DefinesPredicate(MachineInstr &MI,
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000201 std::vector<MachineOperand> &Pred) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000202
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000203 /// Return true if the specified instruction can be predicated.
204 /// By default, this returns true for every instruction with a
205 /// PredicateOperand.
Duncan P. N. Exon Smith6307eb52016-02-23 02:46:52 +0000206 bool isPredicable(MachineInstr &MI) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000207
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000208 /// Test if the given instruction should be considered a scheduling boundary.
209 /// This primarily includes labels and terminators.
Craig Topper906c2cd2014-04-29 07:58:16 +0000210 bool isSchedulingBoundary(const MachineInstr *MI,
211 const MachineBasicBlock *MBB,
212 const MachineFunction &MF) const override;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000213
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000214 /// Measure the specified inline asm to determine an approximation of its
215 /// length.
216 unsigned getInlineAsmLength(const char *Str,
217 const MCAsmInfo &MAI) const override;
218
219 /// Allocate and return a hazard recognizer to use for this target when
220 /// scheduling the machine instructions after register allocation.
221 ScheduleHazardRecognizer*
222 CreateTargetPostRAHazardRecognizer(const InstrItineraryData*,
223 const ScheduleDAG *DAG) const override;
224
225 /// For a comparison instruction, return the source registers
226 /// in SrcReg and SrcReg2 if having two register operands, and the value it
227 /// compares against in CmpValue. Return true if the comparison instruction
228 /// can be analyzed.
229 bool analyzeCompare(const MachineInstr *MI,
230 unsigned &SrcReg, unsigned &SrcReg2,
231 int &Mask, int &Value) const override;
232
233 /// Compute the instruction latency of a given instruction.
234 /// If the instruction has higher cost when predicated, it's returned via
235 /// PredCost.
236 unsigned getInstrLatency(const InstrItineraryData *ItinData,
237 const MachineInstr *MI,
238 unsigned *PredCost = 0) const override;
239
240 /// Create machine specific model for scheduling.
241 DFAPacketizer *
242 CreateTargetScheduleState(const TargetSubtargetInfo &STI) const override;
243
244 // Sometimes, it is possible for the target
245 // to tell, even without aliasing information, that two MIs access different
246 // memory addresses. This function returns true if two MIs access different
247 // memory addresses and false otherwise.
248 bool areMemAccessesTriviallyDisjoint(MachineInstr *MIa, MachineInstr *MIb,
249 AliasAnalysis *AA = nullptr)
250 const override;
251
252
253 /// HexagonInstrInfo specifics.
254 ///
255
256 const HexagonRegisterInfo &getRegisterInfo() const { return RI; }
257
258 unsigned createVR(MachineFunction* MF, MVT VT) const;
259
260 bool isAbsoluteSet(const MachineInstr* MI) const;
261 bool isAccumulator(const MachineInstr *MI) const;
262 bool isComplex(const MachineInstr *MI) const;
263 bool isCompoundBranchInstr(const MachineInstr *MI) const;
264 bool isCondInst(const MachineInstr *MI) const;
Chandler Carruth3c3bb552012-04-23 18:25:57 +0000265 bool isConditionalALU32 (const MachineInstr* MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000266 bool isConditionalLoad(const MachineInstr* MI) const;
Sirish Pandef8e5e3c2012-05-03 21:52:53 +0000267 bool isConditionalStore(const MachineInstr* MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000268 bool isConditionalTransfer(const MachineInstr* MI) const;
269 bool isConstExtended(const MachineInstr *MI) const;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000270 bool isDeallocRet(const MachineInstr *MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000271 bool isDependent(const MachineInstr *ProdMI,
272 const MachineInstr *ConsMI) const;
273 bool isDotCurInst(const MachineInstr* MI) const;
274 bool isDotNewInst(const MachineInstr* MI) const;
275 bool isDuplexPair(const MachineInstr *MIa, const MachineInstr *MIb) const;
Krzysztof Parzyszek5e6f2bd2015-12-14 21:32:25 +0000276 bool isEarlySourceInstr(const MachineInstr *MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000277 bool isEndLoopN(unsigned Opcode) const;
278 bool isExpr(unsigned OpType) const;
Sirish Pandef8e5e3c2012-05-03 21:52:53 +0000279 bool isExtendable(const MachineInstr* MI) const;
280 bool isExtended(const MachineInstr* MI) const;
Krzysztof Parzyszek5e6f2bd2015-12-14 21:32:25 +0000281 bool isFloat(const MachineInstr *MI) const;
Krzysztof Parzyszek56bbf542015-12-16 19:36:12 +0000282 bool isHVXMemWithAIndirect(const MachineInstr *I,
283 const MachineInstr *J) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000284 bool isIndirectCall(const MachineInstr *MI) const;
285 bool isIndirectL4Return(const MachineInstr *MI) const;
286 bool isJumpR(const MachineInstr *MI) const;
287 bool isJumpWithinBranchRange(const MachineInstr *MI, unsigned offset) const;
Krzysztof Parzyszek5e6f2bd2015-12-14 21:32:25 +0000288 bool isLateInstrFeedsEarlyInstr(const MachineInstr *LRMI,
289 const MachineInstr *ESMI) const;
290 bool isLateResultInstr(const MachineInstr *MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000291 bool isLateSourceInstr(const MachineInstr *MI) const;
Krzysztof Parzyszek5e6f2bd2015-12-14 21:32:25 +0000292 bool isLoopN(const MachineInstr *MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000293 bool isMemOp(const MachineInstr *MI) const;
294 bool isNewValue(const MachineInstr* MI) const;
295 bool isNewValue(unsigned Opcode) const;
296 bool isNewValueInst(const MachineInstr* MI) const;
297 bool isNewValueJump(const MachineInstr* MI) const;
298 bool isNewValueJump(unsigned Opcode) const;
Sirish Pandef8e5e3c2012-05-03 21:52:53 +0000299 bool isNewValueStore(const MachineInstr* MI) const;
Jyotsna Verma300f0b92013-05-10 20:27:34 +0000300 bool isNewValueStore(unsigned Opcode) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000301 bool isOperandExtended(const MachineInstr *MI, unsigned OperandNum) const;
302 bool isPostIncrement(const MachineInstr* MI) const;
Duncan P. N. Exon Smith6307eb52016-02-23 02:46:52 +0000303 bool isPredicatedNew(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000304 bool isPredicatedNew(unsigned Opcode) const;
Duncan P. N. Exon Smith6307eb52016-02-23 02:46:52 +0000305 bool isPredicatedTrue(const MachineInstr &MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000306 bool isPredicatedTrue(unsigned Opcode) const;
307 bool isPredicated(unsigned Opcode) const;
308 bool isPredicateLate(unsigned Opcode) const;
309 bool isPredictedTaken(unsigned Opcode) const;
310 bool isSaveCalleeSavedRegsCall(const MachineInstr *MI) const;
Krzysztof Parzyszekfd02aad2016-02-12 18:37:23 +0000311 bool isSignExtendingLoad(const MachineInstr *MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000312 bool isSolo(const MachineInstr* MI) const;
313 bool isSpillPredRegOp(const MachineInstr *MI) const;
314 bool isTC1(const MachineInstr *MI) const;
315 bool isTC2(const MachineInstr *MI) const;
316 bool isTC2Early(const MachineInstr *MI) const;
317 bool isTC4x(const MachineInstr *MI) const;
318 bool isV60VectorInstruction(const MachineInstr *MI) const;
319 bool isValidAutoIncImm(const EVT VT, const int Offset) const;
320 bool isValidOffset(unsigned Opcode, int Offset, bool Extend = true) const;
321 bool isVecAcc(const MachineInstr *MI) const;
322 bool isVecALU(const MachineInstr *MI) const;
323 bool isVecUsableNextPacket(const MachineInstr *ProdMI,
324 const MachineInstr *ConsMI) const;
Krzysztof Parzyszekfd02aad2016-02-12 18:37:23 +0000325 bool isZeroExtendingLoad(const MachineInstr *MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000326
327
Krzysztof Parzyszek56bbf542015-12-16 19:36:12 +0000328 bool canExecuteInBundle(const MachineInstr *First,
329 const MachineInstr *Second) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000330 bool hasEHLabel(const MachineBasicBlock *B) const;
331 bool hasNonExtEquivalent(const MachineInstr *MI) const;
Krzysztof Parzyszek5e6f2bd2015-12-14 21:32:25 +0000332 bool hasPseudoInstrPair(const MachineInstr *MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000333 bool hasUncondBranch(const MachineBasicBlock *B) const;
334 bool mayBeCurLoad(const MachineInstr* MI) const;
335 bool mayBeNewStore(const MachineInstr* MI) const;
336 bool producesStall(const MachineInstr *ProdMI,
337 const MachineInstr *ConsMI) const;
338 bool producesStall(const MachineInstr *MI,
339 MachineBasicBlock::const_instr_iterator MII) const;
Krzysztof Parzyszek5e6f2bd2015-12-14 21:32:25 +0000340 bool predCanBeUsedAsDotNew(const MachineInstr *MI, unsigned PredReg) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000341 bool PredOpcodeHasJMP_c(unsigned Opcode) const;
342 bool predOpcodeHasNot(ArrayRef<MachineOperand> Cond) const;
343
344
Krzysztof Parzyszekf5cbac92016-04-29 15:49:13 +0000345 short getAbsoluteForm(const MachineInstr *MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000346 unsigned getAddrMode(const MachineInstr* MI) const;
347 unsigned getBaseAndOffset(const MachineInstr *MI, int &Offset,
348 unsigned &AccessSize) const;
349 bool getBaseAndOffsetPosition(const MachineInstr *MI, unsigned &BasePos,
350 unsigned &OffsetPos) const;
Krzysztof Parzyszekf5cbac92016-04-29 15:49:13 +0000351 short getBaseWithLongOffset(short Opcode) const;
352 short getBaseWithLongOffset(const MachineInstr *MI) const;
353 short getBaseWithRegOffset(const MachineInstr *MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000354 SmallVector<MachineInstr*,2> getBranchingInstrs(MachineBasicBlock& MBB) const;
355 unsigned getCExtOpNum(const MachineInstr *MI) const;
356 HexagonII::CompoundGroup
357 getCompoundCandidateGroup(const MachineInstr *MI) const;
358 unsigned getCompoundOpcode(const MachineInstr *GA,
359 const MachineInstr *GB) const;
360 int getCondOpcode(int Opc, bool sense) const;
361 int getDotCurOp(const MachineInstr* MI) const;
362 int getDotNewOp(const MachineInstr* MI) const;
Krzysztof Parzyszek5e6f2bd2015-12-14 21:32:25 +0000363 int getDotNewPredJumpOp(const MachineInstr *MI,
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000364 const MachineBranchProbabilityInfo *MBPI) const;
Krzysztof Parzyszek5e6f2bd2015-12-14 21:32:25 +0000365 int getDotNewPredOp(const MachineInstr *MI,
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000366 const MachineBranchProbabilityInfo *MBPI) const;
367 int getDotOldOp(const int opc) const;
368 HexagonII::SubInstructionGroup getDuplexCandidateGroup(const MachineInstr *MI)
369 const;
Krzysztof Parzyszek5e6f2bd2015-12-14 21:32:25 +0000370 short getEquivalentHWInstr(const MachineInstr *MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000371 MachineInstr *getFirstNonDbgInst(MachineBasicBlock *BB) const;
372 unsigned getInstrTimingClassLatency(const InstrItineraryData *ItinData,
373 const MachineInstr *MI) const;
374 bool getInvertedPredSense(SmallVectorImpl<MachineOperand> &Cond) const;
375 unsigned getInvertedPredicatedOpcode(const int Opc) const;
376 int getMaxValue(const MachineInstr *MI) const;
377 unsigned getMemAccessSize(const MachineInstr* MI) const;
378 int getMinValue(const MachineInstr *MI) const;
379 short getNonExtOpcode(const MachineInstr *MI) const;
380 bool getPredReg(ArrayRef<MachineOperand> Cond, unsigned &PredReg,
381 unsigned &PredRegPos, unsigned &PredRegFlags) const;
Krzysztof Parzyszek5e6f2bd2015-12-14 21:32:25 +0000382 short getPseudoInstrPair(const MachineInstr *MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000383 short getRegForm(const MachineInstr *MI) const;
384 unsigned getSize(const MachineInstr *MI) const;
385 uint64_t getType(const MachineInstr* MI) const;
386 unsigned getUnits(const MachineInstr* MI) const;
387 unsigned getValidSubTargets(const unsigned Opcode) const;
388
389
390 /// getInstrTimingClassLatency - Compute the instruction latency of a given
391 /// instruction using Timing Class information, if available.
392 unsigned nonDbgBBSize(const MachineBasicBlock *BB) const;
393 unsigned nonDbgBundleSize(MachineBasicBlock::const_iterator BundleHead) const;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000394
Jyotsna Verma84256432013-03-01 17:37:13 +0000395
396 void immediateExtend(MachineInstr *MI) const;
Krzysztof Parzyszekb9a1c3a2015-11-24 14:55:26 +0000397 bool invertAndChangeJumpTarget(MachineInstr* MI,
398 MachineBasicBlock* NewTarget) const;
399 void genAllInsnTimingClasses(MachineFunction &MF) const;
400 bool reversePredSense(MachineInstr* MI) const;
401 unsigned reversePrediction(unsigned Opcode) const;
402 bool validateBranchCond(const ArrayRef<MachineOperand> &Cond) const;
Krzysztof Parzyszekf5cbac92016-04-29 15:49:13 +0000403 short xformRegToImmOffset(const MachineInstr *MI) const;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000404};
405
Alexander Kornienkof00654e2015-06-23 09:49:53 +0000406}
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000407
408#endif