LLVM 24.0.0git
HexagonInstrInfo.h
Go to the documentation of this file.
1//===- HexagonInstrInfo.h - Hexagon Instruction Information -----*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file contains the Hexagon implementation of the TargetInstrInfo class.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONINSTRINFO_H
14#define LLVM_LIB_TARGET_HEXAGON_HEXAGONINSTRINFO_H
15
17#include "llvm/ADT/ArrayRef.h"
23#include <cstdint>
24#include <vector>
25
26#include "HexagonRegisterInfo.h"
27
28#define GET_INSTRINFO_HEADER
29#include "HexagonGenInstrInfo.inc"
30
31namespace llvm {
32
33class HexagonSubtarget;
34class MachineBranchProbabilityInfo;
35class MachineFunction;
36class MachineInstr;
37class MachineOperand;
38class TargetRegisterInfo;
39
41 const HexagonRegisterInfo RegInfo;
42 const HexagonSubtarget &Subtarget;
43
44 enum BundleAttribute {
45 memShufDisabledMask = 0x4
46 };
47
48 virtual void anchor();
49
50public:
51 explicit HexagonInstrInfo(const HexagonSubtarget &ST);
52
53 const HexagonRegisterInfo &getRegisterInfo() const { return RegInfo; }
54
56 InlineAsm::ConstraintCode C) const override {
57 return &Hexagon::IntRegsRegClass;
58 }
59
60 bool isMIBefore(const MachineInstr *A, const MachineInstr *B) const;
61 bool hasQFPInstrs(const MachineFunction &MF) const;
62
63 /// TargetInstrInfo overrides.
64
65 /// If the specified machine instruction is a direct
66 /// load from a stack slot, return the virtual or physical register number of
67 /// the destination along with the FrameIndex of the loaded stack slot. If
68 /// not, return 0. This predicate must return 0 if the instruction has
69 /// any side effects other than loading from the stack slot.
71 int &FrameIndex) const override;
72
73 /// If the specified machine instruction is a direct
74 /// store to a stack slot, return the virtual or physical register number of
75 /// the source reg along with the FrameIndex of the loaded stack slot. If
76 /// not, return 0. This predicate must return 0 if the instruction has
77 /// any side effects other than storing to the stack slot.
79 int &FrameIndex) const override;
80
81 /// Check if the instruction or the bundle of instructions has
82 /// load from stack slots. Return the frameindex and machine memory operand
83 /// if true.
85 const MachineInstr &MI,
87
88 /// Check if the instruction or the bundle of instructions has
89 /// store to stack slots. Return the frameindex and machine memory operand
90 /// if true.
92 const MachineInstr &MI,
94
96
97 /// Analyze the branching code at the end of MBB, returning
98 /// true if it cannot be understood (e.g. it's a switch dispatch or isn't
99 /// implemented for a target). Upon success, this returns false and returns
100 /// with the following information in various cases:
101 ///
102 /// 1. If this block ends with no branches (it just falls through to its succ)
103 /// just return false, leaving TBB/FBB null.
104 /// 2. If this block ends with only an unconditional branch, it sets TBB to be
105 /// the destination block.
106 /// 3. If this block ends with a conditional branch and it falls through to a
107 /// successor block, it sets TBB to be the branch destination block and a
108 /// list of operands that evaluate the condition. These operands can be
109 /// passed to other TargetInstrInfo methods to create new branches.
110 /// 4. If this block ends with a conditional branch followed by an
111 /// unconditional branch, it returns the 'true' destination in TBB, the
112 /// 'false' destination in FBB, and a list of operands that evaluate the
113 /// condition. These operands can be passed to other TargetInstrInfo
114 /// methods to create new branches.
115 ///
116 /// Note that removeBranch and insertBranch must be implemented to support
117 /// cases where this method returns success.
118 ///
119 /// If AllowModify is true, then this routine is allowed to modify the basic
120 /// block (e.g. delete instructions after the unconditional branch).
122 MachineBasicBlock *&FBB,
124 bool AllowModify) const override;
125
126 /// Remove the branching code at the end of the specific MBB.
127 /// This is only invoked in cases where analyzeBranch returns success. It
128 /// returns the number of instructions that were removed.
130 int *BytesRemoved = nullptr) const override;
131
132 /// Insert branch code into the end of the specified MachineBasicBlock.
133 /// The operands to this method are the same as those
134 /// returned by analyzeBranch. This is only invoked in cases where
135 /// analyzeBranch returns success. It returns the number of instructions
136 /// inserted.
137 ///
138 /// It is also invoked by tail merging to add unconditional branches in
139 /// cases where analyzeBranch doesn't apply because there was no original
140 /// branch to analyze. At least this much must be implemented, else tail
141 /// merging needs to be disabled.
144 const DebugLoc &DL,
145 int *BytesAdded = nullptr) const override;
146
147 /// Analyze loop L, which must be a single-basic-block loop, and if the
148 /// conditions can be understood enough produce a PipelinerLoopInfo object.
149 std::unique_ptr<PipelinerLoopInfo>
150 analyzeLoopForPipelining(MachineBasicBlock *LoopBB) const override;
151
152 /// Return true if it's profitable to predicate
153 /// instructions with accumulated instruction latency of "NumCycles"
154 /// of the specified basic block, where the probability of the instructions
155 /// being executed is given by Probability, and Confidence is a measure
156 /// of our confidence that it will be properly predicted.
157 bool isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumCycles,
158 unsigned ExtraPredCycles,
159 BranchProbability Probability) const override;
160
161 /// Second variant of isProfitableToIfCvt. This one
162 /// checks for the case where two basic blocks from true and false path
163 /// of a if-then-else (diamond) are predicated on mutually exclusive
164 /// predicates, where the probability of the true path being taken is given
165 /// by Probability, and Confidence is a measure of our confidence that it
166 /// will be properly predicted.
168 unsigned NumTCycles, unsigned ExtraTCycles,
169 MachineBasicBlock &FMBB,
170 unsigned NumFCycles, unsigned ExtraFCycles,
171 BranchProbability Probability) const override;
172
173 /// Return true if it's profitable for if-converter to duplicate instructions
174 /// of specified accumulated instruction latencies in the specified MBB to
175 /// enable if-conversion.
176 /// The probability of the instructions being executed is given by
177 /// Probability, and Confidence is a measure of our confidence that it
178 /// will be properly predicted.
179 bool isProfitableToDupForIfCvt(MachineBasicBlock &MBB, unsigned NumCycles,
180 BranchProbability Probability) const override;
181
182 /// Emit instructions to copy a pair of physical registers.
183 ///
184 /// This function should support copies within any legal register class as
185 /// well as any cross-class copies created during instruction selection.
186 ///
187 /// The source and destination registers may overlap, which may require a
188 /// careful implementation when multiple copy instructions are required for
189 /// large registers. See for example the ARM target.
191 const DebugLoc &DL, Register DestReg, Register SrcReg,
192 bool KillSrc, bool RenamableDest = false,
193 bool RenamableSrc = false) const override;
194
195 /// Store the specified register of the given register class to the specified
196 /// stack frame index. The store instruction is to be added to the given
197 /// machine basic block before the specified machine instruction. If isKill
198 /// is true, the register operand is the last use and must be marked kill.
201 bool isKill, int FrameIndex, const TargetRegisterClass *RC, Register VReg,
202 MachineInstr::MIFlag Flags = MachineInstr::NoFlags) const override;
203
204 /// Load the specified register of the given register class from the specified
205 /// stack frame index. The load instruction is to be added to the given
206 /// machine basic block before the specified machine instruction.
209 Register DestReg, int FrameIndex, const TargetRegisterClass *RC,
210 Register VReg, unsigned SubReg = 0,
211 MachineInstr::MIFlag Flags = MachineInstr::NoFlags) const override;
212
213 /// This function is called for all pseudo instructions
214 /// that remain after register allocation. Many pseudo instructions are
215 /// created to help register allocation. This is the place to convert them
216 /// into real instructions. The target can edit MI in place, or it can insert
217 /// new instructions and erase MI. The function should return true if
218 /// anything was changed.
219 bool expandPostRAPseudo(MachineInstr &MI) const override;
220
221 /// Get the base register and byte offset of a load/store instr.
223 const MachineInstr &LdSt,
225 bool &OffsetIsScalable, LocationSize &Width,
226 const TargetRegisterInfo *TRI) const override;
227
228 /// Reverses the branch condition of the specified condition list,
229 /// returning false on success and true if it cannot be reversed.
231 const override;
232
233 /// Insert a noop into the instruction stream at the specified point.
235 MachineBasicBlock::iterator MI) const override;
236
237 /// Returns true if the instruction is already predicated.
238 bool isPredicated(const MachineInstr &MI) const override;
239
240 /// Return true for post-incremented instructions.
241 bool isPostIncrement(const MachineInstr &MI) const override;
242 bool isPostIncWithImmOffset(const MachineInstr &MI) const;
243
244 /// Convert the instruction into a predicated instruction.
245 /// It returns true if the operation was successful.
247 ArrayRef<MachineOperand> Cond) const override;
248
249 /// Returns true if the first specified predicate
250 /// subsumes the second, e.g. GE subsumes GT.
252 ArrayRef<MachineOperand> Pred2) const override;
253
254 /// If the specified instruction defines any predicate
255 /// or condition code register(s) used for predication, returns true as well
256 /// as the definition predicate(s) by reference.
257 bool ClobbersPredicate(MachineInstr &MI, std::vector<MachineOperand> &Pred,
258 bool SkipDead) const override;
259
260 /// Return true if the specified instruction can be predicated.
261 /// By default, this returns true for every instruction with a
262 /// PredicateOperand.
263 bool isPredicable(const MachineInstr &MI) const override;
264
265 /// Test if the given instruction should be considered a scheduling boundary.
266 /// This primarily includes labels and terminators.
268 const MachineBasicBlock *MBB,
269 const MachineFunction &MF) const override;
270
271 /// Measure the specified inline asm to determine an approximation of its
272 /// length.
273 unsigned getInlineAsmLength(
274 const char *Str,
275 const MCAsmInfo &MAI,
276 const TargetSubtargetInfo *STI = nullptr) const override;
277
278 /// Allocate and return a hazard recognizer to use for this target when
279 /// scheduling the machine instructions after register allocation.
282 const ScheduleDAG *DAG) const override;
283
284 /// For a comparison instruction, return the source registers
285 /// in SrcReg and SrcReg2 if having two register operands, and the value it
286 /// compares against in CmpValue. Return true if the comparison instruction
287 /// can be analyzed.
288 bool analyzeCompare(const MachineInstr &MI, Register &SrcReg,
289 Register &SrcReg2, int64_t &Mask,
290 int64_t &Value) const override;
291
292 /// Compute the instruction latency of a given instruction.
293 /// If the instruction has higher cost when predicated, it's returned via
294 /// PredCost.
295 unsigned getInstrLatency(const InstrItineraryData *ItinData,
296 const MachineInstr &MI,
297 unsigned *PredCost = nullptr) const override;
298
299 /// Create machine specific model for scheduling.
301 CreateTargetScheduleState(const TargetSubtargetInfo &STI) const override;
302
303 // Sometimes, it is possible for the target
304 // to tell, even without aliasing information, that two MIs access different
305 // memory addresses. This function returns true if two MIs access different
306 // memory addresses and false otherwise.
307 bool
309 const MachineInstr &MIb) const override;
310
311 /// For instructions with a base and offset, return the position of the
312 /// base register and offset operands.
313 bool getBaseAndOffsetPosition(const MachineInstr &MI, unsigned &BasePos,
314 unsigned &OffsetPos) const override;
315
316 /// If the instruction is an increment of a constant value, return the amount.
317 bool getIncrementValue(const MachineInstr &MI, int &Value) const override;
318
319 /// getOperandLatency - Compute and return the use operand latency of a given
320 /// pair of def and use.
321 /// In most cases, the static scheduling itinerary was enough to determine the
322 /// operand latency. But it may not be possible for instructions with variable
323 /// number of defs / uses.
324 ///
325 /// This is a raw interface to the itinerary that may be directly overridden
326 /// by a target. Use computeOperandLatency to get the best estimate of
327 /// latency.
328 std::optional<unsigned> getOperandLatency(const InstrItineraryData *ItinData,
329 const MachineInstr &DefMI,
330 unsigned DefIdx,
331 const MachineInstr &UseMI,
332 unsigned UseIdx) const override;
333
334 /// Decompose the machine operand's target flags into two values - the direct
335 /// target flag value and any of bit flags that are applied.
336 std::pair<unsigned, unsigned>
337 decomposeMachineOperandsTargetFlags(unsigned TF) const override;
338
339 /// Return an array that contains the direct target flag values and their
340 /// names.
341 ///
342 /// MIR Serialization is able to serialize only the target flags that are
343 /// defined by this method.
346
347 /// Return an array that contains the bitmask target flag values and their
348 /// names.
349 ///
350 /// MIR Serialization is able to serialize only the target flags that are
351 /// defined by this method.
354
355 bool isTailCall(const MachineInstr &MI) const override;
356 bool isAsCheapAsAMove(const MachineInstr &MI) const override;
357
358 // Return true if the instruction should be sunk by MachineSink.
359 // MachineSink determines on its own whether the instruction is safe to sink;
360 // this gives the target a hook to override the default behavior with regards
361 // to which instructions should be sunk.
362 bool shouldSink(const MachineInstr &MI) const override;
363
364 /// HexagonInstrInfo specifics.
365
366 Register createVR(MachineFunction *MF, MVT VT) const;
367 MachineInstr *findLoopInstr(MachineBasicBlock *BB, unsigned EndLoopOp,
368 MachineBasicBlock *TargetBB,
370
371 bool isAbsoluteSet(const MachineInstr &MI) const;
372 bool isAccumulator(const MachineInstr &MI) const;
373 bool isAddrModeWithOffset(const MachineInstr &MI) const;
374 bool isBaseImmOffset(const MachineInstr &MI) const;
375 bool isComplex(const MachineInstr &MI) const;
376 bool isCompoundBranchInstr(const MachineInstr &MI) const;
377 bool isConstExtended(const MachineInstr &MI) const;
378 bool isDeallocRet(const MachineInstr &MI) const;
379 bool isDependent(const MachineInstr &ProdMI,
380 const MachineInstr &ConsMI) const;
381 bool isDotCurInst(const MachineInstr &MI) const;
382 bool isDotNewInst(const MachineInstr &MI) const;
383 bool isDuplexPair(const MachineInstr &MIa, const MachineInstr &MIb) const;
384 bool isEndLoopN(unsigned Opcode) const;
385 bool isExpr(unsigned OpType) const;
386 bool isExtendable(const MachineInstr &MI) const;
387 bool isExtended(const MachineInstr &MI) const;
388 bool isFloat(const MachineInstr &MI) const;
390 const MachineInstr &J) const;
391 bool isIndirectCall(const MachineInstr &MI) const;
392 bool isIndirectL4Return(const MachineInstr &MI) const;
393 bool isJumpR(const MachineInstr &MI) const;
394 bool isJumpWithinBranchRange(const MachineInstr &MI, unsigned offset) const;
395 bool isLateSourceInstr(const MachineInstr &MI) const;
396 bool isLoopN(const MachineInstr &MI) const;
397 bool isMemOp(const MachineInstr &MI) const;
398 bool isNewValue(const MachineInstr &MI) const;
399 bool isNewValue(unsigned Opcode) const;
400 bool isNewValueInst(const MachineInstr &MI) const;
401 bool isNewValueJump(const MachineInstr &MI) const;
402 bool isNewValueJump(unsigned Opcode) const;
403 bool isNewValueStore(const MachineInstr &MI) const;
404 bool isNewValueStore(unsigned Opcode) const;
405 bool isOperandExtended(const MachineInstr &MI, unsigned OperandNum) const;
406 bool isPredicatedNew(const MachineInstr &MI) const;
407 bool isPredicatedNew(unsigned Opcode) const;
408 bool isPredicatedTrue(const MachineInstr &MI) const;
409 bool isPredicatedTrue(unsigned Opcode) const;
410 bool isPredicated(unsigned Opcode) const;
411 bool isPredicateLate(unsigned Opcode) const;
412 bool isPredictedTaken(unsigned Opcode) const;
413 bool isPureSlot0(const MachineInstr &MI) const;
414 bool isRestrictNoSlot1Store(const MachineInstr &MI) const;
415 bool isSaveCalleeSavedRegsCall(const MachineInstr &MI) const;
416 bool isSignExtendingLoad(const MachineInstr &MI) const;
417 bool isSolo(const MachineInstr &MI) const;
418 bool isSpillPredRegOp(const MachineInstr &MI) const;
419 bool isTC1(const MachineInstr &MI) const;
420 bool isTC2(const MachineInstr &MI) const;
421 bool isTC2Early(const MachineInstr &MI) const;
422 bool isTC4x(const MachineInstr &MI) const;
423 bool isToBeScheduledASAP(const MachineInstr &MI1,
424 const MachineInstr &MI2) const;
425 bool isHVXVec(const MachineInstr &MI) const;
426 bool isValidAutoIncImm(const EVT VT, const int Offset) const;
427 bool isValidOffset(unsigned Opcode, int Offset,
428 const TargetRegisterInfo *TRI, bool Extend = true) const;
429 bool isVecAcc(const MachineInstr &MI) const;
430 bool isVecALU(const MachineInstr &MI) const;
431 bool isVecUsableNextPacket(const MachineInstr &ProdMI,
432 const MachineInstr &ConsMI) const;
433 bool isZeroExtendingLoad(const MachineInstr &MI) const;
434
435 bool addLatencyToSchedule(const MachineInstr &MI1,
436 const MachineInstr &MI2) const;
438 const MachineInstr &Second) const;
439 bool doesNotReturn(const MachineInstr &CallMI) const;
440 bool hasEHLabel(const MachineBasicBlock *B) const;
441 bool hasNonExtEquivalent(const MachineInstr &MI) const;
442 bool hasPseudoInstrPair(const MachineInstr &MI) const;
443 bool hasUncondBranch(const MachineBasicBlock *B) const;
444 bool mayBeCurLoad(const MachineInstr &MI) const;
445 bool mayBeNewStore(const MachineInstr &MI) const;
446 bool producesStall(const MachineInstr &ProdMI,
447 const MachineInstr &ConsMI) const;
448 bool producesStall(const MachineInstr &MI,
450 bool predCanBeUsedAsDotNew(const MachineInstr &MI, Register PredReg) const;
451 bool PredOpcodeHasJMP_c(unsigned Opcode) const;
453
454 unsigned getAddrMode(const MachineInstr &MI) const;
456 LocationSize &AccessSize) const;
458 unsigned getCExtOpNum(const MachineInstr &MI) const;
461 unsigned getCompoundOpcode(const MachineInstr &GA,
462 const MachineInstr &GB) const;
463 int getDuplexOpcode(const MachineInstr &MI, bool ForBigCore = true) const;
464 int getCondOpcode(int Opc, bool sense) const;
465 int getDotCurOp(const MachineInstr &MI) const;
466 int getNonDotCurOp(const MachineInstr &MI) const;
467 int getDotNewOp(const MachineInstr &MI) const;
469 const MachineBranchProbabilityInfo *MBPI) const;
471 const MachineBranchProbabilityInfo *MBPI) const;
472 int getDotOldOp(const MachineInstr &MI) const;
474 const;
475 short getEquivalentHWInstr(const MachineInstr &MI) const;
476 unsigned getInstrTimingClassLatency(const InstrItineraryData *ItinData,
477 const MachineInstr &MI) const;
479 unsigned getInvertedPredicatedOpcode(const int Opc) const;
480 int getMaxValue(const MachineInstr &MI) const;
481 unsigned getMemAccessSize(const MachineInstr &MI) const;
482 int getMinValue(const MachineInstr &MI) const;
483 short getNonExtOpcode(const MachineInstr &MI) const;
485 unsigned &PredRegPos, RegState &PredRegFlags) const;
486 short getPseudoInstrPair(const MachineInstr &MI) const;
487 short getRegForm(const MachineInstr &MI) const;
488 unsigned getSize(const MachineInstr &MI) const;
489 uint64_t getType(const MachineInstr &MI) const;
491
493
494 /// getInstrTimingClassLatency - Compute the instruction latency of a given
495 /// instruction using Timing Class information, if available.
496 unsigned nonDbgBBSize(const MachineBasicBlock *BB) const;
497 unsigned nonDbgBundleSize(MachineBasicBlock::const_iterator BundleHead) const;
498
499 void immediateExtend(MachineInstr &MI) const;
501 MachineBasicBlock *NewTarget) const;
503 bool reversePredSense(MachineInstr &MI) const;
504 unsigned reversePrediction(unsigned Opcode) const;
506
508 bool getBundleNoShuf(const MachineInstr &MIB) const;
509
510 // When TinyCore with Duplexes is enabled, this function is used to translate
511 // tiny-instructions to big-instructions and vice versa to get the slot
512 // consumption.
514 bool ToBigInstrs) const;
516 bool ToBigInstrs = true) const;
518 bool ToBigInstrs) const;
519 bool useMachineCombiner() const override { return true; }
521 bool Invert) const override;
522
523 // Addressing mode relations.
524 short changeAddrMode_abs_io(short Opc) const;
525 short changeAddrMode_io_abs(short Opc) const;
526 short changeAddrMode_io_pi(short Opc) const;
527 short changeAddrMode_io_rr(short Opc) const;
528 short changeAddrMode_pi_io(short Opc) const;
529 short changeAddrMode_rr_io(short Opc) const;
530 short changeAddrMode_rr_ur(short Opc) const;
531 short changeAddrMode_ur_rr(short Opc) const;
532
534 return changeAddrMode_abs_io(MI.getOpcode());
535 }
537 return changeAddrMode_io_abs(MI.getOpcode());
538 }
540 return changeAddrMode_io_rr(MI.getOpcode());
541 }
543 return changeAddrMode_rr_io(MI.getOpcode());
544 }
546 return changeAddrMode_rr_ur(MI.getOpcode());
547 }
549 return changeAddrMode_ur_rr(MI.getOpcode());
550 }
551
552 MCInst getNop() const override;
553 bool isQFPMul(const MachineInstr *MF) const;
554
555 // Check if the instruction uses a qf32/qf16 operand.
556 // 'Index' specifies the input operand number (1..3). If 0, check any.
557 bool usesQF32Operand(MachineInstr *MI, unsigned Index = 0) const;
558 bool usesQF16Operand(MachineInstr *MI, unsigned Index = 0) const;
559 bool usesQFOperand(MachineInstr *MI, unsigned Index = 0) const;
560
561 // Check if the instruction has a qf32/qf16 output.
562 bool isQFP32Instr(MachineInstr *MI) const;
563 bool isQFP16Instr(MachineInstr *MI) const;
564 bool isQFPInstr(MachineInstr *MI) const;
565};
566
567/// \brief Create RegSubRegPair from a register MachineOperand
568inline TargetInstrInfo::RegSubRegPair
569getRegSubRegPair(const MachineOperand &O) {
570 assert(O.isReg());
571 return TargetInstrInfo::RegSubRegPair(O.getReg(), O.getSubReg());
572}
573
574} // end namespace llvm
575
576#endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONINSTRINFO_H
MachineInstrBuilder & UseMI
MachineInstrBuilder MachineInstrBuilder & DefMI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
unsigned uint64_t
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
DXIL Forward Handle Accesses
IRTranslator LLVM IR MI
#define I(x, y, z)
Definition MD5.cpp:57
Register const TargetRegisterInfo * TRI
uint64_t IntrinsicInst * II
const SmallVectorImpl< MachineOperand > MachineBasicBlock * TBB
const SmallVectorImpl< MachineOperand > & Cond
This file defines the SmallVector class.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
A debug info location.
Definition DebugLoc.h:126
short getEquivalentHWInstr(const MachineInstr &MI) const
int getDuplexOpcode(const MachineInstr &MI, bool ForBigCore=true) const
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
Remove the branching code at the end of the specific MBB.
bool isPredicated(const MachineInstr &MI) const override
Returns true if the instruction is already predicated.
bool isHVXMemWithAIndirect(const MachineInstr &I, const MachineInstr &J) const
short changeAddrMode_abs_io(short Opc) const
bool isRestrictNoSlot1Store(const MachineInstr &MI) const
short getRegForm(const MachineInstr &MI) const
bool isVecALU(const MachineInstr &MI) const
bool isCompoundBranchInstr(const MachineInstr &MI) const
bool isDuplexPair(const MachineInstr &MIa, const MachineInstr &MIb) const
Symmetrical. See if these two instructions are fit for duplex pair.
bool isJumpR(const MachineInstr &MI) const
ScheduleHazardRecognizer * CreateTargetPostRAHazardRecognizer(const InstrItineraryData *II, const ScheduleDAG *DAG) const override
Allocate and return a hazard recognizer to use for this target when scheduling the machine instructio...
std::pair< unsigned, unsigned > decomposeMachineOperandsTargetFlags(unsigned TF) const override
Decompose the machine operand's target flags into two values - the direct target flag value and any o...
bool producesStall(const MachineInstr &ProdMI, const MachineInstr &ConsMI) const
bool invertAndChangeJumpTarget(MachineInstr &MI, MachineBasicBlock *NewTarget) const
void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, Register SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, Register VReg, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
Store the specified register of the given register class to the specified stack frame index.
bool isPredictedTaken(unsigned Opcode) const
bool isSaveCalleeSavedRegsCall(const MachineInstr &MI) const
bool hasQFPInstrs(const MachineFunction &MF) const
Register isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const override
TargetInstrInfo overrides.
unsigned nonDbgBundleSize(MachineBasicBlock::const_iterator BundleHead) const
int getDotNewPredOp(const MachineInstr &MI, const MachineBranchProbabilityInfo *MBPI) const
bool isQFP32Instr(MachineInstr *MI) const
bool ClobbersPredicate(MachineInstr &MI, std::vector< MachineOperand > &Pred, bool SkipDead) const override
If the specified instruction defines any predicate or condition code register(s) used for predication...
unsigned getInvertedPredicatedOpcode(const int Opc) const
bool isPureSlot0(const MachineInstr &MI) const
bool doesNotReturn(const MachineInstr &CallMI) const
HexagonII::SubInstructionGroup getDuplexCandidateGroup(const MachineInstr &MI) const
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify) const override
Analyze the branching code at the end of MBB, returning true if it cannot be understood (e....
bool usesQF16Operand(MachineInstr *MI, unsigned Index=0) const
bool isPredicatedNew(const MachineInstr &MI) const
bool isSignExtendingLoad(const MachineInstr &MI) const
bool isVecAcc(const MachineInstr &MI) const
bool reversePredSense(MachineInstr &MI) const
bool isPostIncWithImmOffset(const MachineInstr &MI) const
bool isQFPMul(const MachineInstr *MF) const
unsigned getAddrMode(const MachineInstr &MI) const
MCInst getNop() const override
bool isJumpWithinBranchRange(const MachineInstr &MI, unsigned offset) const
bool mayBeNewStore(const MachineInstr &MI) const
short changeAddrMode_rr_ur(const MachineInstr &MI) const
bool isOperandExtended(const MachineInstr &MI, unsigned OperandNum) const
bool canExecuteInBundle(const MachineInstr &First, const MachineInstr &Second) const
Can these instructions execute at the same time in a bundle.
bool isQFP16Instr(MachineInstr *MI) const
std::optional< unsigned > getOperandLatency(const InstrItineraryData *ItinData, const MachineInstr &DefMI, unsigned DefIdx, const MachineInstr &UseMI, unsigned UseIdx) const override
getOperandLatency - Compute and return the use operand latency of a given pair of def and use.
bool isAddrModeWithOffset(const MachineInstr &MI) const
bool getMemOperandsWithOffsetWidth(const MachineInstr &LdSt, SmallVectorImpl< const MachineOperand * > &BaseOps, int64_t &Offset, bool &OffsetIsScalable, LocationSize &Width, const TargetRegisterInfo *TRI) const override
Get the base register and byte offset of a load/store instr.
bool isValidOffset(unsigned Opcode, int Offset, const TargetRegisterInfo *TRI, bool Extend=true) const
bool isBaseImmOffset(const MachineInstr &MI) const
bool isAbsoluteSet(const MachineInstr &MI) const
short changeAddrMode_io_pi(short Opc) const
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, Register DestReg, Register SrcReg, bool KillSrc, bool RenamableDest=false, bool RenamableSrc=false) const override
Emit instructions to copy a pair of physical registers.
const HexagonRegisterInfo & getRegisterInfo() const
short changeAddrMode_pi_io(short Opc) const
bool analyzeCompare(const MachineInstr &MI, Register &SrcReg, Register &SrcReg2, int64_t &Mask, int64_t &Value) const override
For a comparison instruction, return the source registers in SrcReg and SrcReg2 if having two registe...
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
Reverses the branch condition of the specified condition list, returning false on success and true if...
std::unique_ptr< PipelinerLoopInfo > analyzeLoopForPipelining(MachineBasicBlock *LoopBB) const override
Analyze loop L, which must be a single-basic-block loop, and if the conditions can be understood enou...
bool isLoopN(const MachineInstr &MI) const
bool isSpillPredRegOp(const MachineInstr &MI) const
bool hasStoreToStackSlot(const MachineInstr &MI, SmallVectorImpl< const MachineMemOperand * > &Accesses) const override
Check if the instruction or the bundle of instructions has store to stack slots.
ArrayRef< std::pair< unsigned, const char * > > getSerializableDirectMachineOperandTargetFlags() const override
Return an array that contains the direct target flag values and their names.
bool useMachineCombiner() const override
bool isIndirectCall(const MachineInstr &MI) const
short changeAddrMode_ur_rr(short Opc) const
bool isValidAutoIncImm(const EVT VT, const int Offset) const
bool hasNonExtEquivalent(const MachineInstr &MI) const
bool isConstExtended(const MachineInstr &MI) const
bool getIncrementValue(const MachineInstr &MI, int &Value) const override
If the instruction is an increment of a constant value, return the amount.
int getCondOpcode(int Opc, bool sense) const
MachineInstr * findLoopInstr(MachineBasicBlock *BB, unsigned EndLoopOp, MachineBasicBlock *TargetBB, SmallPtrSet< MachineBasicBlock *, 8 > &Visited) const
Find the hardware loop instruction used to set-up the specified loop.
unsigned getInstrTimingClassLatency(const InstrItineraryData *ItinData, const MachineInstr &MI) const
bool usesQF32Operand(MachineInstr *MI, unsigned Index=0) const
bool isAccumulator(const MachineInstr &MI) const
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
Insert branch code into the end of the specified MachineBasicBlock.
unsigned getInstrLatency(const InstrItineraryData *ItinData, const MachineInstr &MI, unsigned *PredCost=nullptr) const override
Compute the instruction latency of a given instruction.
bool PredOpcodeHasJMP_c(unsigned Opcode) const
bool isNewValue(const MachineInstr &MI) const
Register createVR(MachineFunction *MF, MVT VT) const
HexagonInstrInfo specifics.
bool isDotCurInst(const MachineInstr &MI) const
bool validateBranchCond(const ArrayRef< MachineOperand > &Cond) const
bool isExtended(const MachineInstr &MI) const
bool isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumCycles, unsigned ExtraPredCycles, BranchProbability Probability) const override
Return true if it's profitable to predicate instructions with accumulated instruction latency of "Num...
bool isAsCheapAsAMove(const MachineInstr &MI) const override
int getMaxValue(const MachineInstr &MI) const
bool isPredicateLate(unsigned Opcode) const
short changeAddrMode_rr_ur(short Opc) const
bool hasPseudoInstrPair(const MachineInstr &MI) const
bool isNewValueInst(const MachineInstr &MI) const
unsigned getInlineAsmLength(const char *Str, const MCAsmInfo &MAI, const TargetSubtargetInfo *STI=nullptr) const override
Measure the specified inline asm to determine an approximation of its length.
bool areMemAccessesTriviallyDisjoint(const MachineInstr &MIa, const MachineInstr &MIb) const override
int getNonDotCurOp(const MachineInstr &MI) const
bool isIndirectL4Return(const MachineInstr &MI) const
unsigned reversePrediction(unsigned Opcode) const
ArrayRef< std::pair< unsigned, const char * > > getSerializableBitmaskMachineOperandTargetFlags() const override
Return an array that contains the bitmask target flag values and their names.
bool isAssociativeAndCommutative(const MachineInstr &Inst, bool Invert) const override
short changeAddrMode_rr_io(const MachineInstr &MI) const
InstrStage::FuncUnits getUnits(const MachineInstr &MI) const
short changeAddrMode_ur_rr(const MachineInstr &MI) const
unsigned getMemAccessSize(const MachineInstr &MI) const
bool predOpcodeHasNot(ArrayRef< MachineOperand > Cond) const
bool isComplex(const MachineInstr &MI) const
bool isPostIncrement(const MachineInstr &MI) const override
Return true for post-incremented instructions.
void setBundleNoShuf(MachineBasicBlock::instr_iterator MIB) const
short changeAddrMode_io_abs(const MachineInstr &MI) const
MachineBasicBlock::instr_iterator expandVGatherPseudo(MachineInstr &MI) const
void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, Register DestReg, int FrameIndex, const TargetRegisterClass *RC, Register VReg, unsigned SubReg=0, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
Load the specified register of the given register class from the specified stack frame index.
int getDotNewOp(const MachineInstr &MI) const
void changeDuplexOpcode(MachineBasicBlock::instr_iterator MII, bool ToBigInstrs) const
bool isMemOp(const MachineInstr &MI) const
int getDotOldOp(const MachineInstr &MI) const
short getPseudoInstrPair(const MachineInstr &MI) const
bool hasUncondBranch(const MachineBasicBlock *B) const
short getNonExtOpcode(const MachineInstr &MI) const
bool isTailCall(const MachineInstr &MI) const override
void insertNoop(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const override
Insert a noop into the instruction stream at the specified point.
bool isDeallocRet(const MachineInstr &MI) const
HexagonInstrInfo(const HexagonSubtarget &ST)
unsigned getCExtOpNum(const MachineInstr &MI) const
bool isSolo(const MachineInstr &MI) const
DFAPacketizer * CreateTargetScheduleState(const TargetSubtargetInfo &STI) const override
Create machine specific model for scheduling.
bool isLateSourceInstr(const MachineInstr &MI) const
bool isDotNewInst(const MachineInstr &MI) const
void translateInstrsForDup(MachineFunction &MF, bool ToBigInstrs=true) const
bool isTC1(const MachineInstr &MI) const
bool isSchedulingBoundary(const MachineInstr &MI, const MachineBasicBlock *MBB, const MachineFunction &MF) const override
Test if the given instruction should be considered a scheduling boundary.
bool predCanBeUsedAsDotNew(const MachineInstr &MI, Register PredReg) const
unsigned getSize(const MachineInstr &MI) const
bool isProfitableToDupForIfCvt(MachineBasicBlock &MBB, unsigned NumCycles, BranchProbability Probability) const override
Return true if it's profitable for if-converter to duplicate instructions of specified accumulated in...
short changeAddrMode_io_abs(short Opc) const
int getDotCurOp(const MachineInstr &MI) const
bool expandPostRAPseudo(MachineInstr &MI) const override
This function is called for all pseudo instructions that remain after register allocation.
bool isMIBefore(const MachineInstr *A, const MachineInstr *B) const
bool isExpr(unsigned OpType) const
void genAllInsnTimingClasses(MachineFunction &MF) const
bool isTC2Early(const MachineInstr &MI) const
bool hasEHLabel(const MachineBasicBlock *B) const
bool shouldSink(const MachineInstr &MI) const override
bool isZeroExtendingLoad(const MachineInstr &MI) const
short changeAddrMode_rr_io(short Opc) const
bool isHVXVec(const MachineInstr &MI) const
bool isDependent(const MachineInstr &ProdMI, const MachineInstr &ConsMI) const
short changeAddrMode_io_rr(short Opc) const
bool SubsumesPredicate(ArrayRef< MachineOperand > Pred1, ArrayRef< MachineOperand > Pred2) const override
Returns true if the first specified predicate subsumes the second, e.g.
bool mayBeCurLoad(const MachineInstr &MI) const
bool getBundleNoShuf(const MachineInstr &MIB) const
bool isNewValueJump(const MachineInstr &MI) const
bool isTC4x(const MachineInstr &MI) const
bool PredicateInstruction(MachineInstr &MI, ArrayRef< MachineOperand > Cond) const override
Convert the instruction into a predicated instruction.
bool getPredReg(ArrayRef< MachineOperand > Cond, Register &PredReg, unsigned &PredRegPos, RegState &PredRegFlags) const
bool isFloat(const MachineInstr &MI) const
bool isQFPInstr(MachineInstr *MI) const
bool isToBeScheduledASAP(const MachineInstr &MI1, const MachineInstr &MI2) const
MachineOperand * getBaseAndOffset(const MachineInstr &MI, int64_t &Offset, LocationSize &AccessSize) const
bool getInvertedPredSense(SmallVectorImpl< MachineOperand > &Cond) const
unsigned nonDbgBBSize(const MachineBasicBlock *BB) const
getInstrTimingClassLatency - Compute the instruction latency of a given instruction using Timing Clas...
uint64_t getType(const MachineInstr &MI) const
bool isEndLoopN(unsigned Opcode) const
bool getBaseAndOffsetPosition(const MachineInstr &MI, unsigned &BasePos, unsigned &OffsetPos) const override
For instructions with a base and offset, return the position of the base register and offset operands...
bool isPredicable(const MachineInstr &MI) const override
Return true if the specified instruction can be predicated.
bool isExtendable(const MachineInstr &MI) const
short changeAddrMode_abs_io(const MachineInstr &MI) const
void immediateExtend(MachineInstr &MI) const
immediateExtend - Changes the instruction in place to one using an immediate extender.
short changeAddrMode_io_rr(const MachineInstr &MI) const
HexagonII::CompoundGroup getCompoundCandidateGroup(const MachineInstr &MI) const
bool hasLoadFromStackSlot(const MachineInstr &MI, SmallVectorImpl< const MachineMemOperand * > &Accesses) const override
Check if the instruction or the bundle of instructions has load from stack slots.
SmallVector< MachineInstr *, 2 > getBranchingInstrs(MachineBasicBlock &MBB) const
const TargetRegisterClass * getInlineAsmMemoryOperandRegClass(InlineAsm::ConstraintCode C) const override
bool isPredicatedTrue(const MachineInstr &MI) const
bool isNewValueStore(const MachineInstr &MI) const
int getMinValue(const MachineInstr &MI) const
bool isVecUsableNextPacket(const MachineInstr &ProdMI, const MachineInstr &ConsMI) const
unsigned getCompoundOpcode(const MachineInstr &GA, const MachineInstr &GB) const
bool addLatencyToSchedule(const MachineInstr &MI1, const MachineInstr &MI2) const
Register isStoreToStackSlot(const MachineInstr &MI, int &FrameIndex) const override
If the specified machine instruction is a direct store to a stack slot, return the virtual or physica...
int getDotNewPredJumpOp(const MachineInstr &MI, const MachineBranchProbabilityInfo *MBPI) const
bool usesQFOperand(MachineInstr *MI, unsigned Index=0) const
bool isTC2(const MachineInstr &MI) const
Itinerary data supplied by a subtarget to be used by a target.
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition MCAsmInfo.h:67
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
Machine Value Type.
MachineInstrBundleIterator< const MachineInstr > const_iterator
Instructions::iterator instr_iterator
Instructions::const_iterator const_instr_iterator
MachineInstrBundleIterator< MachineInstr > iterator
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
Wrapper class representing virtual and physical registers.
Definition Register.h:20
HazardRecognizer - This determines whether or not an instruction can be issued this cycle,...
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
virtual bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify=false) const
Analyze the branching code at the end of MBB, returning true if it cannot be understood (e....
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
TargetSubtargetInfo - Generic base class for all target subtargets.
LLVM Value Representation.
Definition Value.h:75
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:577
TargetInstrInfo::RegSubRegPair getRegSubRegPair(const MachineOperand &O)
Create RegSubRegPair from a register MachineOperand.
RegState
Flags to represent properties of register accesses.
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
Definition ModRef.h:74
MCRegisterClass TargetRegisterClass
Definition FastISel.h:58
Extended Value Type.
Definition ValueTypes.h:35
uint64_t FuncUnits
Bitmask representing a set of functional units.