LLVM 20.0.0git
AArch64InstrInfo.h
Go to the documentation of this file.
1//===- AArch64InstrInfo.h - AArch64 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 AArch64 implementation of the TargetInstrInfo class.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_AARCH64_AARCH64INSTRINFO_H
14#define LLVM_LIB_TARGET_AARCH64_AARCH64INSTRINFO_H
15
16#include "AArch64.h"
17#include "AArch64RegisterInfo.h"
20#include <optional>
21
22#define GET_INSTRINFO_HEADER
23#include "AArch64GenInstrInfo.inc"
24
25namespace llvm {
26
27class AArch64Subtarget;
28
33
34#define FALKOR_STRIDED_ACCESS_MD "falkor.strided.access"
35
36// AArch64 MachineCombiner patterns
38 // These are patterns used to reduce the length of dependence chain.
41
42 // These are multiply-add patterns matched by the AArch64 machine combiner.
55 // NEON integers vectors
68
81
90
99
100 // Floating Point
162
173
175};
177 const AArch64RegisterInfo RI;
178 const AArch64Subtarget &Subtarget;
179
180public:
181 explicit AArch64InstrInfo(const AArch64Subtarget &STI);
182
183 /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As
184 /// such, whenever a client has an instance of instruction info, it should
185 /// always be able to get register info as well (through this method).
186 const AArch64RegisterInfo &getRegisterInfo() const { return RI; }
187
188 unsigned getInstSizeInBytes(const MachineInstr &MI) const override;
189
190 bool isAsCheapAsAMove(const MachineInstr &MI) const override;
191
192 bool isCoalescableExtInstr(const MachineInstr &MI, Register &SrcReg,
193 Register &DstReg, unsigned &SubIdx) const override;
194
195 bool
197 const MachineInstr &MIb) const override;
198
200 int &FrameIndex) const override;
202 int &FrameIndex) const override;
203
204 /// Does this instruction set its full destination register to zero?
205 static bool isGPRZero(const MachineInstr &MI);
206
207 /// Does this instruction rename a GPR without modifying bits?
208 static bool isGPRCopy(const MachineInstr &MI);
209
210 /// Does this instruction rename an FPR without modifying bits?
211 static bool isFPRCopy(const MachineInstr &MI);
212
213 /// Return true if pairing the given load or store is hinted to be
214 /// unprofitable.
215 static bool isLdStPairSuppressed(const MachineInstr &MI);
216
217 /// Return true if the given load or store is a strided memory access.
218 static bool isStridedAccess(const MachineInstr &MI);
219
220 /// Return true if it has an unscaled load/store offset.
221 static bool hasUnscaledLdStOffset(unsigned Opc);
223 return hasUnscaledLdStOffset(MI.getOpcode());
224 }
225
226 /// Returns the unscaled load/store for the scaled load/store opcode,
227 /// if there is a corresponding unscaled variant available.
228 static std::optional<unsigned> getUnscaledLdSt(unsigned Opc);
229
230 /// Scaling factor for (scaled or unscaled) load or store.
231 static int getMemScale(unsigned Opc);
232 static int getMemScale(const MachineInstr &MI) {
233 return getMemScale(MI.getOpcode());
234 }
235
236 /// Returns whether the instruction is a pre-indexed load.
237 static bool isPreLd(const MachineInstr &MI);
238
239 /// Returns whether the instruction is a pre-indexed store.
240 static bool isPreSt(const MachineInstr &MI);
241
242 /// Returns whether the instruction is a pre-indexed load/store.
243 static bool isPreLdSt(const MachineInstr &MI);
244
245 /// Returns whether the instruction is a paired load/store.
246 static bool isPairedLdSt(const MachineInstr &MI);
247
248 /// Returns the base register operator of a load/store.
249 static const MachineOperand &getLdStBaseOp(const MachineInstr &MI);
250
251 /// Returns the immediate offset operator of a load/store.
252 static const MachineOperand &getLdStOffsetOp(const MachineInstr &MI);
253
254 /// Returns whether the physical register is FP or NEON.
255 static bool isFpOrNEON(Register Reg);
256
257 /// Returns the shift amount operator of a load/store.
258 static const MachineOperand &getLdStAmountOp(const MachineInstr &MI);
259
260 /// Returns whether the instruction is FP or NEON.
261 static bool isFpOrNEON(const MachineInstr &MI);
262
263 /// Returns whether the instruction is in H form (16 bit operands)
264 static bool isHForm(const MachineInstr &MI);
265
266 /// Returns whether the instruction is in Q form (128 bit operands)
267 static bool isQForm(const MachineInstr &MI);
268
269 /// Returns whether the instruction can be compatible with non-zero BTYPE.
270 static bool hasBTISemantics(const MachineInstr &MI);
271
272 /// Returns the index for the immediate for a given instruction.
273 static unsigned getLoadStoreImmIdx(unsigned Opc);
274
275 /// Return true if pairing the given load or store may be paired with another.
276 static bool isPairableLdStInst(const MachineInstr &MI);
277
278 /// Returns true if MI is one of the TCRETURN* instructions.
279 static bool isTailCallReturnInst(const MachineInstr &MI);
280
281 /// Return the opcode that set flags when possible. The caller is
282 /// responsible for ensuring the opc has a flag setting equivalent.
283 static unsigned convertToFlagSettingOpc(unsigned Opc);
284
285 /// Return true if this is a load/store that can be potentially paired/merged.
286 bool isCandidateToMergeOrPair(const MachineInstr &MI) const;
287
288 /// Hint that pairing the given load or store is unprofitable.
289 static void suppressLdStPair(MachineInstr &MI);
290
291 std::optional<ExtAddrMode>
293 const TargetRegisterInfo *TRI) const override;
294
296 const MachineInstr &AddrI,
297 ExtAddrMode &AM) const override;
298
300 const ExtAddrMode &AM) const override;
301
304 int64_t &Offset, bool &OffsetIsScalable, LocationSize &Width,
305 const TargetRegisterInfo *TRI) const override;
306
307 /// If \p OffsetIsScalable is set to 'true', the offset is scaled by `vscale`.
308 /// This is true for some SVE instructions like ldr/str that have a
309 /// 'reg + imm' addressing mode where the immediate is an index to the
310 /// scalable vector located at 'reg + imm * vscale x #bytes'.
312 const MachineOperand *&BaseOp,
313 int64_t &Offset, bool &OffsetIsScalable,
314 TypeSize &Width,
315 const TargetRegisterInfo *TRI) const;
316
317 /// Return the immediate offset of the base register in a load/store \p LdSt.
319
320 /// Returns true if opcode \p Opc is a memory operation. If it is, set
321 /// \p Scale, \p Width, \p MinOffset, and \p MaxOffset accordingly.
322 ///
323 /// For unscaled instructions, \p Scale is set to 1. All values are in bytes.
324 /// MinOffset/MaxOffset are the un-scaled limits of the immediate in the
325 /// instruction, the actual offset limit is [MinOffset*Scale,
326 /// MaxOffset*Scale].
327 static bool getMemOpInfo(unsigned Opcode, TypeSize &Scale, TypeSize &Width,
328 int64_t &MinOffset, int64_t &MaxOffset);
329
331 int64_t Offset1, bool OffsetIsScalable1,
333 int64_t Offset2, bool OffsetIsScalable2,
334 unsigned ClusterSize,
335 unsigned NumBytes) const override;
336
338 const DebugLoc &DL, MCRegister DestReg,
339 MCRegister SrcReg, bool KillSrc, unsigned Opcode,
340 llvm::ArrayRef<unsigned> Indices) const;
342 const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg,
343 bool KillSrc, unsigned Opcode, unsigned ZeroReg,
344 llvm::ArrayRef<unsigned> Indices) const;
346 const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg,
347 bool KillSrc, bool RenamableDest = false,
348 bool RenamableSrc = false) const override;
349
352 bool isKill, int FrameIndex, const TargetRegisterClass *RC,
353 const TargetRegisterInfo *TRI, Register VReg,
354 MachineInstr::MIFlag Flags = MachineInstr::NoFlags) const override;
355
358 Register DestReg, int FrameIndex, const TargetRegisterClass *RC,
359 const TargetRegisterInfo *TRI, Register VReg,
360 MachineInstr::MIFlag Flags = MachineInstr::NoFlags) const override;
361
362 // This tells target independent code that it is okay to pass instructions
363 // with subreg operands to foldMemoryOperandImpl.
364 bool isSubregFoldable() const override { return true; }
365
370 MachineBasicBlock::iterator InsertPt, int FrameIndex,
371 LiveIntervals *LIS = nullptr,
372 VirtRegMap *VRM = nullptr) const override;
373
374 /// \returns true if a branch from an instruction with opcode \p BranchOpc
375 /// bytes is capable of jumping to a position \p BrOffset bytes away.
376 bool isBranchOffsetInRange(unsigned BranchOpc,
377 int64_t BrOffset) const override;
378
379 MachineBasicBlock *getBranchDestBlock(const MachineInstr &MI) const override;
380
382 MachineBasicBlock &NewDestBB,
383 MachineBasicBlock &RestoreBB, const DebugLoc &DL,
384 int64_t BrOffset, RegScavenger *RS) const override;
385
387 MachineBasicBlock *&FBB,
389 bool AllowModify = false) const override;
391 MachineBranchPredicate &MBP,
392 bool AllowModify) const override;
394 int *BytesRemoved = nullptr) const override;
397 const DebugLoc &DL,
398 int *BytesAdded = nullptr) const override;
399
400 std::unique_ptr<TargetInstrInfo::PipelinerLoopInfo>
401 analyzeLoopForPipelining(MachineBasicBlock *LoopBB) const override;
402
403 bool
406 Register, Register, Register, int &, int &,
407 int &) const override;
409 const DebugLoc &DL, Register DstReg,
411 Register FalseReg) const override;
412
414 MachineBasicBlock::iterator MI) const override;
415
416 MCInst getNop() const override;
417
419 const MachineBasicBlock *MBB,
420 const MachineFunction &MF) const override;
421
422 /// analyzeCompare - For a comparison instruction, return the source registers
423 /// in SrcReg and SrcReg2, and the value it compares against in CmpValue.
424 /// Return true if the comparison instruction can be analyzed.
425 bool analyzeCompare(const MachineInstr &MI, Register &SrcReg,
426 Register &SrcReg2, int64_t &CmpMask,
427 int64_t &CmpValue) const override;
428 /// optimizeCompareInstr - Convert the instruction supplying the argument to
429 /// the comparison into one that sets the zero bit in the flags register.
430 bool optimizeCompareInstr(MachineInstr &CmpInstr, Register SrcReg,
431 Register SrcReg2, int64_t CmpMask, int64_t CmpValue,
432 const MachineRegisterInfo *MRI) const override;
433 bool optimizeCondBranch(MachineInstr &MI) const override;
434
435 CombinerObjective getCombinerObjective(unsigned Pattern) const override;
436 /// Return true when a code sequence can improve throughput. It
437 /// should be called only for instructions in loops.
438 /// \param Pattern - combiner pattern
439 bool isThroughputPattern(unsigned Pattern) const override;
440 /// Return true when there is potentially a faster code sequence
441 /// for an instruction chain ending in ``Root``. All potential patterns are
442 /// listed in the ``Patterns`` array.
445 bool DoRegPressureReduce) const override;
446 /// Return true when Inst is associative and commutative so that it can be
447 /// reassociated. If Invert is true, then the inverse of Inst operation must
448 /// be checked.
450 bool Invert) const override;
451 /// When getMachineCombinerPatterns() finds patterns, this function generates
452 /// the instructions that could replace the original code sequence
454 MachineInstr &Root, unsigned Pattern,
457 DenseMap<unsigned, unsigned> &InstrIdxForVirtReg) const override;
458 /// AArch64 supports MachineCombiner.
459 bool useMachineCombiner() const override;
460
461 bool expandPostRAPseudo(MachineInstr &MI) const override;
462
463 std::pair<unsigned, unsigned>
464 decomposeMachineOperandsTargetFlags(unsigned TF) const override;
471
473 bool OutlineFromLinkOnceODRs) const override;
474 std::optional<std::unique_ptr<outliner::OutlinedFunction>>
476 const MachineModuleInfo &MMI,
477 std::vector<outliner::Candidate> &RepeatedSequenceLocs,
478 unsigned MinRepeats) const override;
480 Function &F, std::vector<outliner::Candidate> &Candidates) const override;
483 unsigned Flags) const override;
485 std::pair<MachineBasicBlock::iterator, MachineBasicBlock::iterator>>
486 getOutlinableRanges(MachineBasicBlock &MBB, unsigned &Flags) const override;
488 const outliner::OutlinedFunction &OF) const override;
492 outliner::Candidate &C) const override;
494
497 bool AllowSideEffects = true) const override;
498
499 /// Returns the vector element size (B, H, S or D) of an SVE opcode.
500 uint64_t getElementSizeForOpcode(unsigned Opc) const;
501 /// Returns true if the opcode is for an SVE instruction that sets the
502 /// condition codes as if it's results had been fed to a PTEST instruction
503 /// along with the same general predicate.
504 bool isPTestLikeOpcode(unsigned Opc) const;
505 /// Returns true if the opcode is for an SVE WHILE## instruction.
506 bool isWhileOpcode(unsigned Opc) const;
507 /// Returns true if the instruction has a shift by immediate that can be
508 /// executed in one cycle less.
509 static bool isFalkorShiftExtFast(const MachineInstr &MI);
510 /// Return true if the instructions is a SEH instruciton used for unwinding
511 /// on Windows.
512 static bool isSEHInstruction(const MachineInstr &MI);
513
514 std::optional<RegImmPair> isAddImmediate(const MachineInstr &MI,
515 Register Reg) const override;
516
517 bool isFunctionSafeToSplit(const MachineFunction &MF) const override;
518
519 bool isMBBSafeToSplitToCold(const MachineBasicBlock &MBB) const override;
520
521 std::optional<ParamLoadedValue>
522 describeLoadedValue(const MachineInstr &MI, Register Reg) const override;
523
524 unsigned int getTailDuplicateSize(CodeGenOptLevel OptLevel) const override;
525
527 MachineRegisterInfo &MRI) const override;
528
530 int64_t &NumBytes,
531 int64_t &NumPredicateVectors,
532 int64_t &NumDataVectors);
534 int64_t &ByteSized,
535 int64_t &VGSized);
536
537 // Return true if address of the form BaseReg + Scale * ScaledReg + Offset can
538 // be used for a load/store of NumBytes. BaseReg is always present and
539 // implicit.
540 bool isLegalAddressingMode(unsigned NumBytes, int64_t Offset,
541 unsigned Scale) const;
542
543 // Decrement the SP, issuing probes along the way. `TargetReg` is the new top
544 // of the stack. `FrameSetup` is passed as true, if the allocation is a part
545 // of constructing the activation frame of a function.
547 Register TargetReg,
548 bool FrameSetup) const;
549
550#define GET_INSTRINFO_HELPER_DECLS
551#include "AArch64GenInstrInfo.inc"
552
553protected:
554 /// If the specific machine instruction is an instruction that moves/copies
555 /// value from one register to another register return destination and source
556 /// registers as machine operands.
557 std::optional<DestSourcePair>
558 isCopyInstrImpl(const MachineInstr &MI) const override;
559 std::optional<DestSourcePair>
560 isCopyLikeInstrImpl(const MachineInstr &MI) const override;
561
562private:
563 unsigned getInstBundleLength(const MachineInstr &MI) const;
564
565 /// Sets the offsets on outlined instructions in \p MBB which use SP
566 /// so that they will be valid post-outlining.
567 ///
568 /// \param MBB A \p MachineBasicBlock in an outlined function.
569 void fixupPostOutline(MachineBasicBlock &MBB) const;
570
571 void instantiateCondBranch(MachineBasicBlock &MBB, const DebugLoc &DL,
572 MachineBasicBlock *TBB,
573 ArrayRef<MachineOperand> Cond) const;
574 bool substituteCmpToZero(MachineInstr &CmpInstr, unsigned SrcReg,
575 const MachineRegisterInfo &MRI) const;
576 bool removeCmpToZeroOrOne(MachineInstr &CmpInstr, unsigned SrcReg,
577 int CmpValue, const MachineRegisterInfo &MRI) const;
578
579 /// Returns an unused general-purpose register which can be used for
580 /// constructing an outlined call if one exists. Returns 0 otherwise.
581 Register findRegisterToSaveLRTo(outliner::Candidate &C) const;
582
583 /// Remove a ptest of a predicate-generating operation that already sets, or
584 /// can be made to set, the condition codes in an identical manner
585 bool optimizePTestInstr(MachineInstr *PTest, unsigned MaskReg,
586 unsigned PredReg,
587 const MachineRegisterInfo *MRI) const;
588 std::optional<unsigned>
589 canRemovePTestInstr(MachineInstr *PTest, MachineInstr *Mask,
590 MachineInstr *Pred, const MachineRegisterInfo *MRI) const;
591
592 /// verifyInstruction - Perform target specific instruction verification.
593 bool verifyInstruction(const MachineInstr &MI,
594 StringRef &ErrInfo) const override;
595};
596
597struct UsedNZCV {
598 bool N = false;
599 bool Z = false;
600 bool C = false;
601 bool V = false;
602
603 UsedNZCV() = default;
604
605 UsedNZCV &operator|=(const UsedNZCV &UsedFlags) {
606 this->N |= UsedFlags.N;
607 this->Z |= UsedFlags.Z;
608 this->C |= UsedFlags.C;
609 this->V |= UsedFlags.V;
610 return *this;
611 }
612};
613
614/// \returns Conditions flags used after \p CmpInstr in its MachineBB if NZCV
615/// flags are not alive in successors of the same \p CmpInstr and \p MI parent.
616/// \returns std::nullopt otherwise.
617///
618/// Collect instructions using that flags in \p CCUseInstrs if provided.
619std::optional<UsedNZCV>
620examineCFlagsUse(MachineInstr &MI, MachineInstr &CmpInstr,
621 const TargetRegisterInfo &TRI,
622 SmallVectorImpl<MachineInstr *> *CCUseInstrs = nullptr);
623
624/// Return true if there is an instruction /after/ \p DefMI and before \p UseMI
625/// which either reads or clobbers NZCV.
626bool isNZCVTouchedInInstructionRange(const MachineInstr &DefMI,
627 const MachineInstr &UseMI,
628 const TargetRegisterInfo *TRI);
629
630MCCFIInstruction createDefCFA(const TargetRegisterInfo &TRI, unsigned FrameReg,
631 unsigned Reg, const StackOffset &Offset,
632 bool LastAdjustmentWasScalable = true);
633MCCFIInstruction createCFAOffset(const TargetRegisterInfo &MRI, unsigned Reg,
634 const StackOffset &OffsetFromDefCFA);
635
636/// emitFrameOffset - Emit instructions as needed to set DestReg to SrcReg
637/// plus Offset. This is intended to be used from within the prolog/epilog
638/// insertion (PEI) pass, where a virtual scratch register may be allocated
639/// if necessary, to be replaced by the scavenger at the end of PEI.
640void emitFrameOffset(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
641 const DebugLoc &DL, unsigned DestReg, unsigned SrcReg,
642 StackOffset Offset, const TargetInstrInfo *TII,
644 bool SetNZCV = false, bool NeedsWinCFI = false,
645 bool *HasWinCFI = nullptr, bool EmitCFAOffset = false,
646 StackOffset InitialOffset = {},
647 unsigned FrameReg = AArch64::SP);
648
649/// rewriteAArch64FrameIndex - Rewrite MI to access 'Offset' bytes from the
650/// FP. Return false if the offset could not be handled directly in MI, and
651/// return the left-over portion by reference.
652bool rewriteAArch64FrameIndex(MachineInstr &MI, unsigned FrameRegIdx,
653 unsigned FrameReg, StackOffset &Offset,
654 const AArch64InstrInfo *TII);
655
656/// Use to report the frame offset status in isAArch64FrameOffsetLegal.
658 AArch64FrameOffsetCannotUpdate = 0x0, ///< Offset cannot apply.
659 AArch64FrameOffsetIsLegal = 0x1, ///< Offset is legal.
660 AArch64FrameOffsetCanUpdate = 0x2 ///< Offset can apply, at least partly.
662
663/// Check if the @p Offset is a valid frame offset for @p MI.
664/// The returned value reports the validity of the frame offset for @p MI.
665/// It uses the values defined by AArch64FrameOffsetStatus for that.
666/// If result == AArch64FrameOffsetCannotUpdate, @p MI cannot be updated to
667/// use an offset.eq
668/// If result & AArch64FrameOffsetIsLegal, @p Offset can completely be
669/// rewritten in @p MI.
670/// If result & AArch64FrameOffsetCanUpdate, @p Offset contains the
671/// amount that is off the limit of the legal offset.
672/// If set, @p OutUseUnscaledOp will contain the whether @p MI should be
673/// turned into an unscaled operator, which opcode is in @p OutUnscaledOp.
674/// If set, @p EmittableOffset contains the amount that can be set in @p MI
675/// (possibly with @p OutUnscaledOp if OutUseUnscaledOp is true) and that
676/// is a legal offset.
677int isAArch64FrameOffsetLegal(const MachineInstr &MI, StackOffset &Offset,
678 bool *OutUseUnscaledOp = nullptr,
679 unsigned *OutUnscaledOp = nullptr,
680 int64_t *EmittableOffset = nullptr);
681
682static inline bool isUncondBranchOpcode(int Opc) { return Opc == AArch64::B; }
683
684static inline bool isCondBranchOpcode(int Opc) {
685 switch (Opc) {
686 case AArch64::Bcc:
687 case AArch64::CBZW:
688 case AArch64::CBZX:
689 case AArch64::CBNZW:
690 case AArch64::CBNZX:
691 case AArch64::TBZW:
692 case AArch64::TBZX:
693 case AArch64::TBNZW:
694 case AArch64::TBNZX:
695 return true;
696 default:
697 return false;
698 }
699}
700
701static inline bool isIndirectBranchOpcode(int Opc) {
702 switch (Opc) {
703 case AArch64::BR:
704 case AArch64::BRAA:
705 case AArch64::BRAB:
706 case AArch64::BRAAZ:
707 case AArch64::BRABZ:
708 return true;
709 }
710 return false;
711}
712
713static inline bool isPTrueOpcode(unsigned Opc) {
714 switch (Opc) {
715 case AArch64::PTRUE_B:
716 case AArch64::PTRUE_H:
717 case AArch64::PTRUE_S:
718 case AArch64::PTRUE_D:
719 return true;
720 default:
721 return false;
722 }
723}
724
725/// Return opcode to be used for indirect calls.
726unsigned getBLRCallOpcode(const MachineFunction &MF);
727
728/// Return XPAC opcode to be used for a ptrauth strip using the given key.
729static inline unsigned getXPACOpcodeForKey(AArch64PACKey::ID K) {
730 using namespace AArch64PACKey;
731 switch (K) {
732 case IA: case IB: return AArch64::XPACI;
733 case DA: case DB: return AArch64::XPACD;
734 }
735 llvm_unreachable("Unhandled AArch64PACKey::ID enum");
736}
737
738/// Return AUT opcode to be used for a ptrauth auth using the given key, or its
739/// AUT*Z variant that doesn't take a discriminator operand, using zero instead.
740static inline unsigned getAUTOpcodeForKey(AArch64PACKey::ID K, bool Zero) {
741 using namespace AArch64PACKey;
742 switch (K) {
743 case IA: return Zero ? AArch64::AUTIZA : AArch64::AUTIA;
744 case IB: return Zero ? AArch64::AUTIZB : AArch64::AUTIB;
745 case DA: return Zero ? AArch64::AUTDZA : AArch64::AUTDA;
746 case DB: return Zero ? AArch64::AUTDZB : AArch64::AUTDB;
747 }
748 llvm_unreachable("Unhandled AArch64PACKey::ID enum");
749}
750
751/// Return PAC opcode to be used for a ptrauth sign using the given key, or its
752/// PAC*Z variant that doesn't take a discriminator operand, using zero instead.
753static inline unsigned getPACOpcodeForKey(AArch64PACKey::ID K, bool Zero) {
754 using namespace AArch64PACKey;
755 switch (K) {
756 case IA: return Zero ? AArch64::PACIZA : AArch64::PACIA;
757 case IB: return Zero ? AArch64::PACIZB : AArch64::PACIB;
758 case DA: return Zero ? AArch64::PACDZA : AArch64::PACDA;
759 case DB: return Zero ? AArch64::PACDZB : AArch64::PACDB;
760 }
761 llvm_unreachable("Unhandled AArch64PACKey::ID enum");
762}
763
764// struct TSFlags {
765#define TSFLAG_ELEMENT_SIZE_TYPE(X) (X) // 3-bits
766#define TSFLAG_DESTRUCTIVE_INST_TYPE(X) ((X) << 3) // 4-bits
767#define TSFLAG_FALSE_LANE_TYPE(X) ((X) << 7) // 2-bits
768#define TSFLAG_INSTR_FLAGS(X) ((X) << 9) // 2-bits
769#define TSFLAG_SME_MATRIX_TYPE(X) ((X) << 11) // 3-bits
770// }
771
772namespace AArch64 {
773
781};
782
795};
796
801};
802
803// NOTE: This is a bit field.
806
816};
817
818#undef TSFLAG_ELEMENT_SIZE_TYPE
819#undef TSFLAG_DESTRUCTIVE_INST_TYPE
820#undef TSFLAG_FALSE_LANE_TYPE
821#undef TSFLAG_INSTR_FLAGS
822#undef TSFLAG_SME_MATRIX_TYPE
823
827
829}
830
831} // end namespace llvm
832
833#endif
unsigned const MachineRegisterInfo * MRI
MachineInstrBuilder & UseMI
MachineInstrBuilder MachineInstrBuilder & DefMI
#define TSFLAG_DESTRUCTIVE_INST_TYPE(X)
#define TSFLAG_SME_MATRIX_TYPE(X)
#define TSFLAG_FALSE_LANE_TYPE(X)
#define TSFLAG_INSTR_FLAGS(X)
#define TSFLAG_ELEMENT_SIZE_TYPE(X)
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
const HexagonInstrInfo * TII
IRTranslator LLVM IR MI
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
unsigned const TargetRegisterInfo * TRI
unsigned Reg
const SmallVectorImpl< MachineOperand > MachineBasicBlock * TBB
const SmallVectorImpl< MachineOperand > & Cond
static bool isHForm(const MachineInstr &MI)
Returns whether the instruction is in H form (16 bit operands)
void insertSelect(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, Register DstReg, ArrayRef< MachineOperand > Cond, Register TrueReg, Register FalseReg) const override
static bool hasBTISemantics(const MachineInstr &MI)
Returns whether the instruction can be compatible with non-zero BTYPE.
static bool isQForm(const MachineInstr &MI)
Returns whether the instruction is in Q form (128 bit operands)
static void decomposeStackOffsetForFrameOffsets(const StackOffset &Offset, int64_t &NumBytes, int64_t &NumPredicateVectors, int64_t &NumDataVectors)
Returns the offset in parts to which this frame offset can be decomposed for the purpose of describin...
static bool getMemOpInfo(unsigned Opcode, TypeSize &Scale, TypeSize &Width, int64_t &MinOffset, int64_t &MaxOffset)
Returns true if opcode Opc is a memory operation.
static bool isTailCallReturnInst(const MachineInstr &MI)
Returns true if MI is one of the TCRETURN* instructions.
static bool isFPRCopy(const MachineInstr &MI)
Does this instruction rename an FPR without modifying bits?
MachineInstr * emitLdStWithAddr(MachineInstr &MemI, const ExtAddrMode &AM) const override
std::optional< DestSourcePair > isCopyInstrImpl(const MachineInstr &MI) const override
If the specific machine instruction is an instruction that moves/copies value from one register to an...
static int getMemScale(const MachineInstr &MI)
MachineBasicBlock * getBranchDestBlock(const MachineInstr &MI) const override
std::optional< RegImmPair > isAddImmediate(const MachineInstr &MI, Register Reg) const override
bool isSubregFoldable() const override
unsigned getInstSizeInBytes(const MachineInstr &MI) const override
GetInstSize - Return the number of bytes of code the specified instruction may be.
uint64_t getElementSizeForOpcode(unsigned Opc) const
Returns the vector element size (B, H, S or D) of an SVE opcode.
bool areMemAccessesTriviallyDisjoint(const MachineInstr &MIa, const MachineInstr &MIb) const override
static bool isGPRCopy(const MachineInstr &MI)
Does this instruction rename a GPR without modifying bits?
static unsigned convertToFlagSettingOpc(unsigned Opc)
Return the opcode that set flags when possible.
bool getMachineCombinerPatterns(MachineInstr &Root, SmallVectorImpl< unsigned > &Patterns, bool DoRegPressureReduce) const override
Return true when there is potentially a faster code sequence for an instruction chain ending in Root.
bool isBranchOffsetInRange(unsigned BranchOpc, int64_t BrOffset) const override
bool canInsertSelect(const MachineBasicBlock &, ArrayRef< MachineOperand > Cond, Register, Register, Register, int &, int &, int &) const override
static const MachineOperand & getLdStOffsetOp(const MachineInstr &MI)
Returns the immediate offset operator of a load/store.
bool isCoalescableExtInstr(const MachineInstr &MI, Register &SrcReg, Register &DstReg, unsigned &SubIdx) const override
bool isWhileOpcode(unsigned Opc) const
Returns true if the opcode is for an SVE WHILE## instruction.
static std::optional< unsigned > getUnscaledLdSt(unsigned Opc)
Returns the unscaled load/store for the scaled load/store opcode, if there is a corresponding unscale...
static bool hasUnscaledLdStOffset(unsigned Opc)
Return true if it has an unscaled load/store offset.
static const MachineOperand & getLdStAmountOp(const MachineInstr &MI)
Returns the shift amount operator of a load/store.
static bool hasUnscaledLdStOffset(MachineInstr &MI)
static bool isPreLdSt(const MachineInstr &MI)
Returns whether the instruction is a pre-indexed load/store.
MachineBasicBlock::iterator insertOutlinedCall(Module &M, MachineBasicBlock &MBB, MachineBasicBlock::iterator &It, MachineFunction &MF, outliner::Candidate &C) const override
std::optional< ExtAddrMode > getAddrModeFromMemoryOp(const MachineInstr &MemI, const TargetRegisterInfo *TRI) const override
bool getMemOperandsWithOffsetWidth(const MachineInstr &MI, SmallVectorImpl< const MachineOperand * > &BaseOps, int64_t &Offset, bool &OffsetIsScalable, LocationSize &Width, const TargetRegisterInfo *TRI) const override
bool analyzeBranchPredicate(MachineBasicBlock &MBB, MachineBranchPredicate &MBP, bool AllowModify) const override
static bool isSEHInstruction(const MachineInstr &MI)
Return true if the instructions is a SEH instruciton used for unwinding on Windows.
void insertIndirectBranch(MachineBasicBlock &MBB, MachineBasicBlock &NewDestBB, MachineBasicBlock &RestoreBB, const DebugLoc &DL, int64_t BrOffset, RegScavenger *RS) const override
SmallVector< std::pair< MachineBasicBlock::iterator, MachineBasicBlock::iterator > > getOutlinableRanges(MachineBasicBlock &MBB, unsigned &Flags) const override
static bool isPairableLdStInst(const MachineInstr &MI)
Return true if pairing the given load or store may be paired with another.
void genAlternativeCodeSequence(MachineInstr &Root, unsigned Pattern, SmallVectorImpl< MachineInstr * > &InsInstrs, SmallVectorImpl< MachineInstr * > &DelInstrs, DenseMap< unsigned, unsigned > &InstrIdxForVirtReg) const override
When getMachineCombinerPatterns() finds patterns, this function generates the instructions that could...
const AArch64RegisterInfo & getRegisterInfo() const
getRegisterInfo - TargetInstrInfo is a superset of MRegister info.
static bool isPreSt(const MachineInstr &MI)
Returns whether the instruction is a pre-indexed store.
MachineInstr * foldMemoryOperandImpl(MachineFunction &MF, MachineInstr &MI, ArrayRef< unsigned > Ops, MachineBasicBlock::iterator InsertPt, int FrameIndex, LiveIntervals *LIS=nullptr, VirtRegMap *VRM=nullptr) const override
void insertNoop(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const override
static bool isPairedLdSt(const MachineInstr &MI)
Returns whether the instruction is a paired load/store.
outliner::InstrType getOutliningTypeImpl(const MachineModuleInfo &MMI, MachineBasicBlock::iterator &MIT, unsigned Flags) const override
bool useMachineCombiner() const override
AArch64 supports MachineCombiner.
ArrayRef< std::pair< MachineMemOperand::Flags, const char * > > getSerializableMachineMemOperandTargetFlags() const override
bool isExtendLikelyToBeFolded(MachineInstr &ExtMI, MachineRegisterInfo &MRI) const override
static bool isFalkorShiftExtFast(const MachineInstr &MI)
Returns true if the instruction has a shift by immediate that can be executed in one cycle less.
std::optional< ParamLoadedValue > describeLoadedValue(const MachineInstr &MI, Register Reg) const override
bool getMemOperandWithOffsetWidth(const MachineInstr &MI, const MachineOperand *&BaseOp, int64_t &Offset, bool &OffsetIsScalable, TypeSize &Width, const TargetRegisterInfo *TRI) const
If OffsetIsScalable is set to 'true', the offset is scaled by vscale.
Register isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const override
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
static bool isStridedAccess(const MachineInstr &MI)
Return true if the given load or store is a strided memory access.
bool shouldClusterMemOps(ArrayRef< const MachineOperand * > BaseOps1, int64_t Offset1, bool OffsetIsScalable1, ArrayRef< const MachineOperand * > BaseOps2, int64_t Offset2, bool OffsetIsScalable2, unsigned ClusterSize, unsigned NumBytes) const override
Detect opportunities for ldp/stp formation.
bool expandPostRAPseudo(MachineInstr &MI) const override
unsigned int getTailDuplicateSize(CodeGenOptLevel OptLevel) const override
bool isFunctionSafeToOutlineFrom(MachineFunction &MF, bool OutlineFromLinkOnceODRs) const override
bool shouldOutlineFromFunctionByDefault(MachineFunction &MF) const override
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
bool isThroughputPattern(unsigned Pattern) const override
Return true when a code sequence can improve throughput.
void buildClearRegister(Register Reg, MachineBasicBlock &MBB, MachineBasicBlock::iterator Iter, DebugLoc &DL, bool AllowSideEffects=true) const override
void buildOutlinedFrame(MachineBasicBlock &MBB, MachineFunction &MF, const outliner::OutlinedFunction &OF) const override
ArrayRef< std::pair< unsigned, const char * > > getSerializableDirectMachineOperandTargetFlags() const override
MachineOperand & getMemOpBaseRegImmOfsOffsetOperand(MachineInstr &LdSt) const
Return the immediate offset of the base register in a load/store LdSt.
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify=false) const override
bool canFoldIntoAddrMode(const MachineInstr &MemI, Register Reg, const MachineInstr &AddrI, ExtAddrMode &AM) const override
static bool isLdStPairSuppressed(const MachineInstr &MI)
Return true if pairing the given load or store is hinted to be unprofitable.
bool isFunctionSafeToSplit(const MachineFunction &MF) const override
bool isAssociativeAndCommutative(const MachineInstr &Inst, bool Invert) const override
Return true when Inst is associative and commutative so that it can be reassociated.
std::unique_ptr< TargetInstrInfo::PipelinerLoopInfo > analyzeLoopForPipelining(MachineBasicBlock *LoopBB) const override
bool isSchedulingBoundary(const MachineInstr &MI, const MachineBasicBlock *MBB, const MachineFunction &MF) const override
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
MachineBasicBlock::iterator probedStackAlloc(MachineBasicBlock::iterator MBBI, Register TargetReg, bool FrameSetup) const
bool optimizeCompareInstr(MachineInstr &CmpInstr, Register SrcReg, Register SrcReg2, int64_t CmpMask, int64_t CmpValue, const MachineRegisterInfo *MRI) const override
optimizeCompareInstr - Convert the instruction supplying the argument to the comparison into one that...
static unsigned getLoadStoreImmIdx(unsigned Opc)
Returns the index for the immediate for a given instruction.
static bool isGPRZero(const MachineInstr &MI)
Does this instruction set its full destination register to zero?
std::pair< unsigned, unsigned > decomposeMachineOperandsTargetFlags(unsigned TF) const override
void copyGPRRegTuple(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg, bool KillSrc, unsigned Opcode, unsigned ZeroReg, llvm::ArrayRef< unsigned > Indices) const
bool analyzeCompare(const MachineInstr &MI, Register &SrcReg, Register &SrcReg2, int64_t &CmpMask, int64_t &CmpValue) const override
analyzeCompare - For a comparison instruction, return the source registers in SrcReg and SrcReg2,...
CombinerObjective getCombinerObjective(unsigned Pattern) const override
static bool isFpOrNEON(Register Reg)
Returns whether the physical register is FP or NEON.
bool isMBBSafeToSplitToCold(const MachineBasicBlock &MBB) const override
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg, bool KillSrc, bool RenamableDest=false, bool RenamableSrc=false) const override
bool isAsCheapAsAMove(const MachineInstr &MI) const override
bool isLegalAddressingMode(unsigned NumBytes, int64_t Offset, unsigned Scale) const
std::optional< std::unique_ptr< outliner::OutlinedFunction > > getOutliningCandidateInfo(const MachineModuleInfo &MMI, std::vector< outliner::Candidate > &RepeatedSequenceLocs, unsigned MinRepeats) const override
std::optional< DestSourcePair > isCopyLikeInstrImpl(const MachineInstr &MI) const override
static void suppressLdStPair(MachineInstr &MI)
Hint that pairing the given load or store is unprofitable.
Register isStoreToStackSlot(const MachineInstr &MI, int &FrameIndex) const override
static bool isPreLd(const MachineInstr &MI)
Returns whether the instruction is a pre-indexed load.
void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, Register SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI, Register VReg, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
ArrayRef< std::pair< unsigned, const char * > > getSerializableBitmaskMachineOperandTargetFlags() const override
void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, Register DestReg, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI, Register VReg, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
void copyPhysRegTuple(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg, bool KillSrc, unsigned Opcode, llvm::ArrayRef< unsigned > Indices) const
bool optimizeCondBranch(MachineInstr &MI) const override
Replace csincr-branch sequence by simple conditional branch.
static int getMemScale(unsigned Opc)
Scaling factor for (scaled or unscaled) load or store.
bool isCandidateToMergeOrPair(const MachineInstr &MI) const
Return true if this is a load/store that can be potentially paired/merged.
MCInst getNop() const override
static const MachineOperand & getLdStBaseOp(const MachineInstr &MI)
Returns the base register operator of a load/store.
bool isPTestLikeOpcode(unsigned Opc) const
Returns true if the opcode is for an SVE instruction that sets the condition codes as if it's results...
void mergeOutliningCandidateAttributes(Function &F, std::vector< outliner::Candidate > &Candidates) const override
static void decomposeStackOffsetForDwarfOffsets(const StackOffset &Offset, int64_t &ByteSized, int64_t &VGSized)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
A debug info location.
Definition: DebugLoc.h:33
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:185
Wrapper class representing physical registers. Should be passed by value.
Definition: MCRegister.h:33
MachineInstrBundleIterator< MachineInstr > iterator
Representation of each machine instruction.
Definition: MachineInstr.h:70
Flags
Flags values. These may be or'd together.
This class contains meta information specific to a module.
MachineOperand class - Representation of each machine instruction operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:573
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1196
StackOffset holds a fixed and a scalable offset in bytes.
Definition: TypeSize.h:33
virtual MachineInstr * foldMemoryOperandImpl(MachineFunction &MF, MachineInstr &MI, ArrayRef< unsigned > Ops, MachineBasicBlock::iterator InsertPt, int FrameIndex, LiveIntervals *LIS=nullptr, VirtRegMap *VRM=nullptr) const
Target-dependent implementation for foldMemoryOperand.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
int getSVERevInstr(uint16_t Opcode)
int getSMEPseudoMap(uint16_t Opcode)
static const uint64_t InstrFlagIsWhile
static const uint64_t InstrFlagIsPTestLike
int getSVEPseudoMap(uint16_t Opcode)
int getSVENonRevInstr(uint16_t Opcode)
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
InstrType
Represents how an instruction should be mapped by the outliner.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:480
static bool isCondBranchOpcode(int Opc)
MCCFIInstruction createDefCFA(const TargetRegisterInfo &TRI, unsigned FrameReg, unsigned Reg, const StackOffset &Offset, bool LastAdjustmentWasScalable=true)
static bool isPTrueOpcode(unsigned Opc)
int isAArch64FrameOffsetLegal(const MachineInstr &MI, StackOffset &Offset, bool *OutUseUnscaledOp=nullptr, unsigned *OutUnscaledOp=nullptr, int64_t *EmittableOffset=nullptr)
Check if the Offset is a valid frame offset for MI.
static bool isIndirectBranchOpcode(int Opc)
static unsigned getXPACOpcodeForKey(AArch64PACKey::ID K)
Return XPAC opcode to be used for a ptrauth strip using the given key.
MCCFIInstruction createCFAOffset(const TargetRegisterInfo &MRI, unsigned Reg, const StackOffset &OffsetFromDefCFA)
unsigned getBLRCallOpcode(const MachineFunction &MF)
Return opcode to be used for indirect calls.
AArch64FrameOffsetStatus
Use to report the frame offset status in isAArch64FrameOffsetLegal.
@ AArch64FrameOffsetIsLegal
Offset is legal.
@ AArch64FrameOffsetCanUpdate
Offset can apply, at least partly.
@ AArch64FrameOffsetCannotUpdate
Offset cannot apply.
AArch64MachineCombinerPattern
@ MULSUBv8i16_OP2
@ FMULv4i16_indexed_OP1
@ FMLSv1i32_indexed_OP2
@ MULSUBv2i32_indexed_OP1
@ MULADDXI_OP1
@ FMLAv2i32_indexed_OP2
@ MULADDv4i16_indexed_OP2
@ FMLAv1i64_indexed_OP1
@ MULSUBv16i8_OP1
@ FMLAv8i16_indexed_OP2
@ FMULv2i32_indexed_OP1
@ MULSUBv8i16_indexed_OP2
@ FMLAv1i64_indexed_OP2
@ MULSUBv4i16_indexed_OP2
@ FMLAv1i32_indexed_OP1
@ FMLAv2i64_indexed_OP2
@ FMLSv8i16_indexed_OP1
@ MULSUBv2i32_OP1
@ FMULv4i16_indexed_OP2
@ MULSUBv4i32_indexed_OP2
@ FMULv2i64_indexed_OP2
@ MULSUBXI_OP1
@ FMLAv4i32_indexed_OP1
@ MULADDWI_OP1
@ MULADDv4i16_OP2
@ FMULv8i16_indexed_OP2
@ MULSUBv4i16_OP1
@ MULADDv4i32_OP2
@ MULADDv8i8_OP1
@ MULADDv2i32_OP2
@ MULADDv16i8_OP2
@ MULADDv8i8_OP2
@ FMLSv4i16_indexed_OP1
@ MULADDv16i8_OP1
@ FMLAv2i64_indexed_OP1
@ FMLAv1i32_indexed_OP2
@ FMLSv2i64_indexed_OP2
@ MULADDv2i32_OP1
@ MULADDv4i32_OP1
@ MULADDv2i32_indexed_OP1
@ MULSUBv16i8_OP2
@ MULADDv4i32_indexed_OP1
@ MULADDv2i32_indexed_OP2
@ FMLAv4i16_indexed_OP2
@ MULSUBv8i16_OP1
@ FMULv2i32_indexed_OP2
@ FMLSv2i32_indexed_OP2
@ FMLSv4i32_indexed_OP1
@ FMULv2i64_indexed_OP1
@ MULSUBv4i16_OP2
@ FMLSv4i16_indexed_OP2
@ FMLAv2i32_indexed_OP1
@ FMLSv2i32_indexed_OP1
@ FMLAv8i16_indexed_OP1
@ MULSUBv4i16_indexed_OP1
@ FMLSv4i32_indexed_OP2
@ MULADDv4i32_indexed_OP2
@ MULSUBv4i32_OP2
@ MULSUBv8i16_indexed_OP1
@ MULADDv8i16_OP2
@ MULSUBv2i32_indexed_OP2
@ FMULv4i32_indexed_OP2
@ FMLSv2i64_indexed_OP1
@ MULADDv4i16_OP1
@ FMLAv4i32_indexed_OP2
@ MULADDv8i16_indexed_OP1
@ FMULv4i32_indexed_OP1
@ FMLAv4i16_indexed_OP1
@ FMULv8i16_indexed_OP1
@ MULSUBv8i8_OP1
@ MULADDv8i16_OP1
@ MULSUBv4i32_indexed_OP1
@ MULSUBv4i32_OP1
@ FMLSv8i16_indexed_OP2
@ MULADDv8i16_indexed_OP2
@ MULSUBWI_OP1
@ MULSUBv2i32_OP2
@ FMLSv1i64_indexed_OP2
@ MULADDv4i16_indexed_OP1
@ MULSUBv8i8_OP2
void emitFrameOffset(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, StackOffset Offset, const TargetInstrInfo *TII, MachineInstr::MIFlag=MachineInstr::NoFlags, bool SetNZCV=false, bool NeedsWinCFI=false, bool *HasWinCFI=nullptr, bool EmitCFAOffset=false, StackOffset InitialOffset={}, unsigned FrameReg=AArch64::SP)
emitFrameOffset - Emit instructions as needed to set DestReg to SrcReg plus Offset.
CombinerObjective
The combiner's goal may differ based on which pattern it is attempting to optimize.
std::optional< UsedNZCV > examineCFlagsUse(MachineInstr &MI, MachineInstr &CmpInstr, const TargetRegisterInfo &TRI, SmallVectorImpl< MachineInstr * > *CCUseInstrs=nullptr)
CodeGenOptLevel
Code generation optimization level.
Definition: CodeGen.h:54
static bool isUncondBranchOpcode(int Opc)
static unsigned getPACOpcodeForKey(AArch64PACKey::ID K, bool Zero)
Return PAC opcode to be used for a ptrauth sign using the given key, or its PAC*Z variant that doesn'...
bool rewriteAArch64FrameIndex(MachineInstr &MI, unsigned FrameRegIdx, unsigned FrameReg, StackOffset &Offset, const AArch64InstrInfo *TII)
rewriteAArch64FrameIndex - Rewrite MI to access 'Offset' bytes from the FP.
static const MachineMemOperand::Flags MOSuppressPair
bool isNZCVTouchedInInstructionRange(const MachineInstr &DefMI, const MachineInstr &UseMI, const TargetRegisterInfo *TRI)
Return true if there is an instruction /after/ DefMI and before UseMI which either reads or clobbers ...
static const MachineMemOperand::Flags MOStridedAccess
static unsigned getAUTOpcodeForKey(AArch64PACKey::ID K, bool Zero)
Return AUT opcode to be used for a ptrauth auth using the given key, or its AUT*Z variant that doesn'...
Used to describe addressing mode similar to ExtAddrMode in CodeGenPrepare.
UsedNZCV & operator|=(const UsedNZCV &UsedFlags)
UsedNZCV()=default
An individual sequence of instructions to be replaced with a call to an outlined function.
The information necessary to create an outlined function for some class of candidate.