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
62 /// Copies the debug values of the variables that read the register First and
63 /// Second define to just after \p Second, in their original order, and sets
64 /// each dependent original undef. If a copy would read a value that changes
65 /// in between, nothing is copied and only the originals are set undef.
66 ///
67 /// Call this before the replacement for First and Second is created, and
68 /// insert the replacement before \p Second. The replacement must not write a
69 /// register the copies read, unless First or Second writes it too.
71 MachineInstr &Second) const;
72
73 bool hasQFPInstrs(const MachineFunction &MF) const;
74
75 /// TargetInstrInfo overrides.
76
77 /// If the specified machine instruction is a direct
78 /// load from a stack slot, return the virtual or physical register number of
79 /// the destination along with the FrameIndex of the loaded stack slot. If
80 /// not, return 0. This predicate must return 0 if the instruction has
81 /// any side effects other than loading from the stack slot.
83 int &FrameIndex) const override;
84
85 /// If the specified machine instruction is a direct
86 /// store to a stack slot, return the virtual or physical register number of
87 /// the source reg along with the FrameIndex of the loaded stack slot. If
88 /// not, return 0. This predicate must return 0 if the instruction has
89 /// any side effects other than storing to the stack slot.
91 int &FrameIndex) const override;
92
93 /// Check if the instruction or the bundle of instructions has
94 /// load from stack slots. Return the frameindex and machine memory operand
95 /// if true.
97 const MachineInstr &MI,
99
100 /// Check if the instruction or the bundle of instructions has
101 /// store to stack slots. Return the frameindex and machine memory operand
102 /// if true.
104 const MachineInstr &MI,
106
108
109 /// Analyze the branching code at the end of MBB, returning
110 /// true if it cannot be understood (e.g. it's a switch dispatch or isn't
111 /// implemented for a target). Upon success, this returns false and returns
112 /// with the following information in various cases:
113 ///
114 /// 1. If this block ends with no branches (it just falls through to its succ)
115 /// just return false, leaving TBB/FBB null.
116 /// 2. If this block ends with only an unconditional branch, it sets TBB to be
117 /// the destination block.
118 /// 3. If this block ends with a conditional branch and it falls through to a
119 /// successor block, it sets TBB to be the branch destination block and a
120 /// list of operands that evaluate the condition. These operands can be
121 /// passed to other TargetInstrInfo methods to create new branches.
122 /// 4. If this block ends with a conditional branch followed by an
123 /// unconditional branch, it returns the 'true' destination in TBB, the
124 /// 'false' destination in FBB, and a list of operands that evaluate the
125 /// condition. These operands can be passed to other TargetInstrInfo
126 /// methods to create new branches.
127 ///
128 /// Note that removeBranch and insertBranch must be implemented to support
129 /// cases where this method returns success.
130 ///
131 /// If AllowModify is true, then this routine is allowed to modify the basic
132 /// block (e.g. delete instructions after the unconditional branch).
134 MachineBasicBlock *&FBB,
136 bool AllowModify) const override;
137
138 /// Remove the branching code at the end of the specific MBB.
139 /// This is only invoked in cases where analyzeBranch returns success. It
140 /// returns the number of instructions that were removed.
142 int *BytesRemoved = nullptr) const override;
143
144 /// Insert branch code into the end of the specified MachineBasicBlock.
145 /// The operands to this method are the same as those
146 /// returned by analyzeBranch. This is only invoked in cases where
147 /// analyzeBranch returns success. It returns the number of instructions
148 /// inserted.
149 ///
150 /// It is also invoked by tail merging to add unconditional branches in
151 /// cases where analyzeBranch doesn't apply because there was no original
152 /// branch to analyze. At least this much must be implemented, else tail
153 /// merging needs to be disabled.
156 const DebugLoc &DL,
157 int *BytesAdded = nullptr) const override;
158
159 /// Analyze loop L, which must be a single-basic-block loop, and if the
160 /// conditions can be understood enough produce a PipelinerLoopInfo object.
161 std::unique_ptr<PipelinerLoopInfo>
162 analyzeLoopForPipelining(MachineBasicBlock *LoopBB) const override;
163
164 /// Return true if it's profitable to predicate
165 /// instructions with accumulated instruction latency of "NumCycles"
166 /// of the specified basic block, where the probability of the instructions
167 /// being executed is given by Probability, and Confidence is a measure
168 /// of our confidence that it will be properly predicted.
169 bool isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumCycles,
170 unsigned ExtraPredCycles,
171 BranchProbability Probability) const override;
172
173 /// Second variant of isProfitableToIfCvt. This one
174 /// checks for the case where two basic blocks from true and false path
175 /// of a if-then-else (diamond) are predicated on mutually exclusive
176 /// predicates, where the probability of the true path being taken is given
177 /// by Probability, and Confidence is a measure of our confidence that it
178 /// will be properly predicted.
180 unsigned NumTCycles, unsigned ExtraTCycles,
181 MachineBasicBlock &FMBB,
182 unsigned NumFCycles, unsigned ExtraFCycles,
183 BranchProbability Probability) const override;
184
185 /// Return true if it's profitable for if-converter to duplicate instructions
186 /// of specified accumulated instruction latencies in the specified MBB to
187 /// enable if-conversion.
188 /// The probability of the instructions being executed is given by
189 /// Probability, and Confidence is a measure of our confidence that it
190 /// will be properly predicted.
191 bool isProfitableToDupForIfCvt(MachineBasicBlock &MBB, unsigned NumCycles,
192 BranchProbability Probability) const override;
193
194 /// Emit instructions to copy a pair of physical registers.
195 ///
196 /// This function should support copies within any legal register class as
197 /// well as any cross-class copies created during instruction selection.
198 ///
199 /// The source and destination registers may overlap, which may require a
200 /// careful implementation when multiple copy instructions are required for
201 /// large registers. See for example the ARM target.
203 const DebugLoc &DL, Register DestReg, Register SrcReg,
204 bool KillSrc, bool RenamableDest = false,
205 bool RenamableSrc = false) const override;
206
207 /// Store the specified register of the given register class to the specified
208 /// stack frame index. The store instruction is to be added to the given
209 /// machine basic block before the specified machine instruction. If isKill
210 /// is true, the register operand is the last use and must be marked kill.
213 bool isKill, int FrameIndex, const TargetRegisterClass *RC, Register VReg,
214 MachineInstr::MIFlag Flags = MachineInstr::NoFlags) const override;
215
216 /// Load the specified register of the given register class from the specified
217 /// stack frame index. The load instruction is to be added to the given
218 /// machine basic block before the specified machine instruction.
221 Register DestReg, int FrameIndex, const TargetRegisterClass *RC,
222 Register VReg, unsigned SubReg = 0,
223 MachineInstr::MIFlag Flags = MachineInstr::NoFlags) const override;
224
225 /// This function is called for all pseudo instructions
226 /// that remain after register allocation. Many pseudo instructions are
227 /// created to help register allocation. This is the place to convert them
228 /// into real instructions. The target can edit MI in place, or it can insert
229 /// new instructions and erase MI. The function should return true if
230 /// anything was changed.
231 bool expandPostRAPseudo(MachineInstr &MI) const override;
232
233 /// Get the base register and byte offset of a load/store instr.
235 const MachineInstr &LdSt,
237 bool &OffsetIsScalable, LocationSize &Width) const override;
238
239 /// Reverses the branch condition of the specified condition list,
240 /// returning false on success and true if it cannot be reversed.
242 const override;
243
244 /// Insert a noop into the instruction stream at the specified point.
246 MachineBasicBlock::iterator MI) const override;
247
248 /// Returns true if the instruction is already predicated.
249 bool isPredicated(const MachineInstr &MI) const override;
250
251 /// Return true for post-incremented instructions.
252 bool isPostIncrement(const MachineInstr &MI) const override;
253 bool isPostIncWithImmOffset(const MachineInstr &MI) const;
254
255 /// Convert the instruction into a predicated instruction.
256 /// It returns true if the operation was successful.
258 ArrayRef<MachineOperand> Cond) const override;
259
260 /// Returns true if the first specified predicate
261 /// subsumes the second, e.g. GE subsumes GT.
263 ArrayRef<MachineOperand> Pred2) const override;
264
265 /// If the specified instruction defines any predicate
266 /// or condition code register(s) used for predication, returns true as well
267 /// as the definition predicate(s) by reference.
268 bool ClobbersPredicate(MachineInstr &MI, std::vector<MachineOperand> &Pred,
269 bool SkipDead) const override;
270
271 /// Return true if the specified instruction can be predicated.
272 /// By default, this returns true for every instruction with a
273 /// PredicateOperand.
274 bool isPredicable(const MachineInstr &MI) const override;
275
276 /// Test if the given instruction should be considered a scheduling boundary.
277 /// This primarily includes labels and terminators.
279 const MachineBasicBlock *MBB,
280 const MachineFunction &MF) const override;
281
282 /// Measure the specified inline asm to determine an approximation of its
283 /// length.
284 unsigned getInlineAsmLength(
285 const char *Str,
286 const MCAsmInfo &MAI,
287 const TargetSubtargetInfo *STI = nullptr) const override;
288
289 /// Allocate and return a hazard recognizer to use for this target when
290 /// scheduling the machine instructions after register allocation.
293 const ScheduleDAG *DAG) const override;
294
295 /// For a comparison instruction, return the source registers
296 /// in SrcReg and SrcReg2 if having two register operands, and the value it
297 /// compares against in CmpValue. Return true if the comparison instruction
298 /// can be analyzed.
299 bool analyzeCompare(const MachineInstr &MI, Register &SrcReg,
300 Register &SrcReg2, int64_t &Mask,
301 int64_t &Value) const override;
302
303 /// Compute the instruction latency of a given instruction.
304 /// If the instruction has higher cost when predicated, it's returned via
305 /// PredCost.
306 unsigned getInstrLatency(const InstrItineraryData *ItinData,
307 const MachineInstr &MI,
308 unsigned *PredCost = nullptr) const override;
309
310 /// Create machine specific model for scheduling.
312 CreateTargetScheduleState(const TargetSubtargetInfo &STI) const override;
313
314 // Sometimes, it is possible for the target
315 // to tell, even without aliasing information, that two MIs access different
316 // memory addresses. This function returns true if two MIs access different
317 // memory addresses and false otherwise.
318 bool
320 const MachineInstr &MIb) const override;
321
322 /// For instructions with a base and offset, return the position of the
323 /// base register and offset operands.
324 bool getBaseAndOffsetPosition(const MachineInstr &MI, unsigned &BasePos,
325 unsigned &OffsetPos) const override;
326
327 /// If the instruction is an increment of a constant value, return the amount.
328 bool getIncrementValue(const MachineInstr &MI, int &Value) const override;
329
330 /// getOperandLatency - Compute and return the use operand latency of a given
331 /// pair of def and use.
332 /// In most cases, the static scheduling itinerary was enough to determine the
333 /// operand latency. But it may not be possible for instructions with variable
334 /// number of defs / uses.
335 ///
336 /// This is a raw interface to the itinerary that may be directly overridden
337 /// by a target. Use computeOperandLatency to get the best estimate of
338 /// latency.
339 std::optional<unsigned> getOperandLatency(const InstrItineraryData *ItinData,
340 const MachineInstr &DefMI,
341 unsigned DefIdx,
342 const MachineInstr &UseMI,
343 unsigned UseIdx) const override;
344
345 /// Decompose the machine operand's target flags into two values - the direct
346 /// target flag value and any of bit flags that are applied.
347 std::pair<unsigned, unsigned>
348 decomposeMachineOperandsTargetFlags(unsigned TF) const override;
349
350 /// Return an array that contains the direct target flag values and their
351 /// names.
352 ///
353 /// MIR Serialization is able to serialize only the target flags that are
354 /// defined by this method.
357
358 /// Return an array that contains the bitmask target flag values and their
359 /// names.
360 ///
361 /// MIR Serialization is able to serialize only the target flags that are
362 /// defined by this method.
365
366 bool isTailCall(const MachineInstr &MI) const override;
367 bool isAsCheapAsAMove(const MachineInstr &MI) const override;
368
369 // Return true if the instruction should be sunk by MachineSink.
370 // MachineSink determines on its own whether the instruction is safe to sink;
371 // this gives the target a hook to override the default behavior with regards
372 // to which instructions should be sunk.
373 bool shouldSink(const MachineInstr &MI) const override;
374
375 /// HexagonInstrInfo specifics.
376
377 Register createVR(MachineFunction *MF, MVT VT) const;
378 MachineInstr *findLoopInstr(MachineBasicBlock *BB, unsigned EndLoopOp,
379 MachineBasicBlock *TargetBB,
381
382 bool isAbsoluteSet(const MachineInstr &MI) const;
383 bool isAccumulator(const MachineInstr &MI) const;
384 bool isAddrModeWithOffset(const MachineInstr &MI) const;
385 bool isBaseImmOffset(const MachineInstr &MI) const;
386 bool isComplex(const MachineInstr &MI) const;
387 bool isCompoundBranchInstr(const MachineInstr &MI) const;
388 bool isConstExtended(const MachineInstr &MI) const;
389 bool isDeallocRet(const MachineInstr &MI) const;
390 bool isDependent(const MachineInstr &ProdMI,
391 const MachineInstr &ConsMI) const;
392 bool isDotCurInst(const MachineInstr &MI) const;
393 bool isDotNewInst(const MachineInstr &MI) const;
394 bool isDuplexPair(const MachineInstr &MIa, const MachineInstr &MIb) const;
395 bool isEndLoopN(unsigned Opcode) const;
396 bool isExpr(unsigned OpType) const;
397 bool isExtendable(const MachineInstr &MI) const;
398 bool isExtended(const MachineInstr &MI) const;
399 bool isFloat(const MachineInstr &MI) const;
401 const MachineInstr &J) const;
402 bool isIndirectCall(const MachineInstr &MI) const;
403 bool isIndirectL4Return(const MachineInstr &MI) const;
404 bool isJumpR(const MachineInstr &MI) const;
405 bool isJumpWithinBranchRange(const MachineInstr &MI, unsigned offset) const;
406 bool isLateSourceInstr(const MachineInstr &MI) const;
407 bool isLoopN(const MachineInstr &MI) const;
408 bool isMemOp(const MachineInstr &MI) const;
409 bool isNewValue(const MachineInstr &MI) const;
410 bool isNewValue(unsigned Opcode) const;
411 bool isNewValueInst(const MachineInstr &MI) const;
412 bool isNewValueJump(const MachineInstr &MI) const;
413 bool isNewValueJump(unsigned Opcode) const;
414 bool isNewValueStore(const MachineInstr &MI) const;
415 bool isNewValueStore(unsigned Opcode) const;
416 bool isOperandExtended(const MachineInstr &MI, unsigned OperandNum) const;
417 bool isPredicatedNew(const MachineInstr &MI) const;
418 bool isPredicatedNew(unsigned Opcode) const;
419 bool isPredicatedTrue(const MachineInstr &MI) const;
420 bool isPredicatedTrue(unsigned Opcode) const;
421 bool isPredicated(unsigned Opcode) const;
422 bool isPredicateLate(unsigned Opcode) const;
423 bool isPredictedTaken(unsigned Opcode) const;
424 bool isPureSlot0(const MachineInstr &MI) const;
425 bool isRestrictNoSlot1Store(const MachineInstr &MI) const;
426 bool isSaveCalleeSavedRegsCall(const MachineInstr &MI) const;
427 bool isSignExtendingLoad(const MachineInstr &MI) const;
428 bool isSolo(const MachineInstr &MI) const;
429 bool isSpillPredRegOp(const MachineInstr &MI) const;
430 bool isTC1(const MachineInstr &MI) const;
431 bool isTC2(const MachineInstr &MI) const;
432 bool isTC2Early(const MachineInstr &MI) const;
433 bool isTC4x(const MachineInstr &MI) const;
434 bool isToBeScheduledASAP(const MachineInstr &MI1,
435 const MachineInstr &MI2) const;
436 bool isHVXVec(const MachineInstr &MI) const;
437 bool isHLXVec(const MachineInstr &MI) const;
438 bool isValidAutoIncImm(const EVT VT, const int Offset) const;
439 bool isValidOffset(unsigned Opcode, int Offset, bool Extend = true) const;
440 bool isVecAcc(const MachineInstr &MI) const;
441 bool isVecALU(const MachineInstr &MI) const;
442 bool isVecUsableNextPacket(const MachineInstr &ProdMI,
443 const MachineInstr &ConsMI) const;
444 bool isZeroExtendingLoad(const MachineInstr &MI) const;
445
446 bool addLatencyToSchedule(const MachineInstr &MI1,
447 const MachineInstr &MI2) const;
449 const MachineInstr &Second) const;
450 bool doesNotReturn(const MachineInstr &CallMI) const;
451 bool hasEHLabel(const MachineBasicBlock *B) const;
452 bool hasNonExtEquivalent(const MachineInstr &MI) const;
453 bool hasUncondBranch(const MachineBasicBlock *B) const;
454 bool mayBeCurLoad(const MachineInstr &MI) const;
455 bool mayBeNewStore(const MachineInstr &MI) const;
456 // Identify HLX pseudos that expand to a tmp load or new store and a copy.
457 bool isTmpLoadPseudo(const MachineInstr &MI) const;
458 bool isNewStorePseudo(const MachineInstr &MI) const;
459 bool producesStall(const MachineInstr &ProdMI,
460 const MachineInstr &ConsMI) const;
461 bool producesStall(const MachineInstr &MI,
463 bool predCanBeUsedAsDotNew(const MachineInstr &MI, Register PredReg) const;
464 bool PredOpcodeHasJMP_c(unsigned Opcode) const;
466
467 unsigned getAddrMode(const MachineInstr &MI) const;
469 LocationSize &AccessSize) const;
471 unsigned getCExtOpNum(const MachineInstr &MI) const;
474 unsigned getCompoundOpcode(const MachineInstr &GA,
475 const MachineInstr &GB) const;
476 int getDuplexOpcode(const MachineInstr &MI, bool ForBigCore = true) const;
477 int getCondOpcode(int Opc, bool sense) const;
478 int getDotCurOp(const MachineInstr &MI) const;
479 int getNonDotCurOp(const MachineInstr &MI) const;
480 int getDotNewOp(const MachineInstr &MI) const;
482 const MachineBranchProbabilityInfo *MBPI) const;
484 const MachineBranchProbabilityInfo *MBPI) const;
485 int getDotOldOp(const MachineInstr &MI) const;
488 unsigned getInstrTimingClassLatency(const InstrItineraryData *ItinData,
489 const MachineInstr &MI) const;
491 unsigned getInvertedPredicatedOpcode(const int Opc) const;
492 int getMaxValue(const MachineInstr &MI) const;
493 unsigned getMemAccessSize(const MachineInstr &MI) const;
494 int getMinValue(const MachineInstr &MI) const;
495 short getNonExtOpcode(const MachineInstr &MI) const;
497 unsigned &PredRegPos, RegState &PredRegFlags) const;
498 short getRegForm(const MachineInstr &MI) const;
499 unsigned getSize(const MachineInstr &MI) const;
500 uint64_t getType(const MachineInstr &MI) const;
502
504
505 /// getInstrTimingClassLatency - Compute the instruction latency of a given
506 /// instruction using Timing Class information, if available.
507 unsigned nonDbgBBSize(const MachineBasicBlock *BB) const;
508 unsigned nonDbgBundleSize(MachineBasicBlock::const_iterator BundleHead) const;
509
510 void immediateExtend(MachineInstr &MI) const;
512 MachineBasicBlock *NewTarget) const;
514 bool reversePredSense(MachineInstr &MI) const;
515 unsigned reversePrediction(unsigned Opcode) const;
517
519 bool getBundleNoShuf(const MachineInstr &MIB) const;
520
521 // When TinyCore with Duplexes is enabled, this function is used to translate
522 // tiny-instructions to big-instructions and vice versa to get the slot
523 // consumption.
525 bool ToBigInstrs) const;
527 bool ToBigInstrs = true) const;
529 bool ToBigInstrs) const;
530 bool useMachineCombiner() const override { return true; }
532 bool Invert) const override;
533
534 // Addressing mode relations.
535 short changeAddrMode_abs_io(short Opc) const;
536 short changeAddrMode_io_abs(short Opc) const;
537 short changeAddrMode_io_pi(short Opc) const;
538 short changeAddrMode_io_rr(short Opc) const;
539 short changeAddrMode_pi_io(short Opc) const;
540 short changeAddrMode_rr_io(short Opc) const;
541 short changeAddrMode_rr_ur(short Opc) const;
542 short changeAddrMode_ur_rr(short Opc) const;
543
545 return changeAddrMode_abs_io(MI.getOpcode());
546 }
548 return changeAddrMode_io_abs(MI.getOpcode());
549 }
551 return changeAddrMode_io_rr(MI.getOpcode());
552 }
554 return changeAddrMode_rr_io(MI.getOpcode());
555 }
557 return changeAddrMode_rr_ur(MI.getOpcode());
558 }
560 return changeAddrMode_ur_rr(MI.getOpcode());
561 }
562
563 MCInst getNop() const override;
564 bool isQFPMul(const MachineInstr *MF) const;
565
566 // Check if the instruction uses a qf32/qf16 operand.
567 // 'Index' specifies the input operand number (1..3). If 0, check any.
568 bool usesQF32Operand(MachineInstr *MI, unsigned Index = 0) const;
569 bool usesQF16Operand(MachineInstr *MI, unsigned Index = 0) const;
570 bool usesQFOperand(MachineInstr *MI, unsigned Index = 0) const;
571
572 // Check if the instruction has a qf32/qf16 output.
573 bool isQFP32Instr(MachineInstr *MI) const;
574 bool isQFP16Instr(MachineInstr *MI) const;
575 bool isQFPInstr(MachineInstr *MI) const;
576};
577
578/// \brief Create RegSubRegPair from a register MachineOperand
579inline TargetInstrInfo::RegSubRegPair
580getRegSubRegPair(const MachineOperand &O) {
581 assert(O.isReg());
582 return TargetInstrInfo::RegSubRegPair(O.getReg(), O.getSubReg());
583}
584
585} // end namespace llvm
586
587#endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONINSTRINFO_H
MachineInstrBuilder & UseMI
MachineInstrBuilder MachineInstrBuilder & DefMI
SDValue Pred
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
uint64_t 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
uint64_t IntrinsicInst * II
SmallVector< MachineOperand, 4 > Cond
const SmallVectorImpl< MachineOperand > MachineBasicBlock * TBB
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
bool isTmpLoadPseudo(const MachineInstr &MI) const
int getDuplexOpcode(const MachineInstr &MI, bool ForBigCore=true) const
bool isHLXVec(const MachineInstr &MI) 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 getMemOperandsWithOffsetWidth(const MachineInstr &LdSt, SmallVectorImpl< const MachineOperand * > &BaseOps, int64_t &Offset, bool &OffsetIsScalable, LocationSize &Width) const override
Get the base register and byte offset of a load/store instr.
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 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
void moveDependentDebugValues(MachineInstr &First, MachineInstr &Second) const
Copies the debug values of the variables that read the register First and Second define to just after...
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 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
bool hasUncondBranch(const MachineBasicBlock *B) const
short getNonExtOpcode(const MachineInstr &MI) const
bool isNewStorePseudo(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
bool isValidOffset(unsigned Opcode, int Offset, bool Extend=true) 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....
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.