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