LLVM 24.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"
21#include <optional>
22
23#define GET_INSTRINFO_HEADER
24#include "AArch64GenInstrInfo.inc"
25
26namespace llvm {
27
28class AArch64Subtarget;
29
34
35#define FALKOR_STRIDED_ACCESS_MD "falkor.strided.access"
36
37// AArch64 MachineCombiner patterns
39 // These are patterns used to reduce the length of dependence chain.
42
43 // These are multiply-add patterns matched by the AArch64 machine combiner.
58 // NEON integers vectors
71
84
93
102
103 // Floating Point
165
176
178
182};
184 const AArch64RegisterInfo RI;
185 const AArch64Subtarget &Subtarget;
186
187public:
188 explicit AArch64InstrInfo(const AArch64Subtarget &STI);
189
190 /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As
191 /// such, whenever a client has an instance of instruction info, it should
192 /// always be able to get register info as well (through this method).
193 const AArch64RegisterInfo &getRegisterInfo() const { return RI; }
194
196 InlineAsm::ConstraintCode C) const override {
197 return &AArch64::GPR64spRegClass;
198 }
199
200 unsigned getInstSizeInBytes(const MachineInstr &MI) const override;
201
202 bool isAsCheapAsAMove(const MachineInstr &MI) const override;
203
204 bool isCoalescableExtInstr(const MachineInstr &MI, Register &SrcReg,
205 Register &DstReg, unsigned &SubIdx) const override;
206
207 bool
209 const MachineInstr &MIb) const override;
210
212 int &FrameIndex) const override;
214 int &FrameIndex) const override;
215
216 /// Check for post-frame ptr elimination stack locations as well. This uses a
217 /// heuristic so it isn't reliable for correctness.
219 int &FrameIndex) const override;
220 /// Check for post-frame ptr elimination stack locations as well. This uses a
221 /// heuristic so it isn't reliable for correctness.
223 int &FrameIndex) const override;
224
225 /// Does this instruction set its full destination register to zero?
226 static bool isGPRZero(const MachineInstr &MI);
227
228 /// Does this instruction rename a GPR without modifying bits?
229 static bool isGPRCopy(const MachineInstr &MI);
230
231 /// Does this instruction rename an FPR without modifying bits?
232 static bool isFPRCopy(const MachineInstr &MI);
233
234 /// Return true if pairing the given load or store is hinted to be
235 /// unprofitable.
236 static bool isLdStPairSuppressed(const MachineInstr &MI);
237
238 /// Return true if the given load or store is a strided memory access.
239 static bool isStridedAccess(const MachineInstr &MI);
240
241 /// Return true if it has an unscaled load/store offset.
242 static bool hasUnscaledLdStOffset(unsigned Opc);
244 return hasUnscaledLdStOffset(MI.getOpcode());
245 }
246
247 /// Returns the unscaled load/store for the scaled load/store opcode,
248 /// if there is a corresponding unscaled variant available.
249 static std::optional<unsigned> getUnscaledLdSt(unsigned Opc);
250
251 /// Scaling factor for (scaled or unscaled) load or store.
252 static int getMemScale(unsigned Opc);
253 static int getMemScale(const MachineInstr &MI) {
254 return getMemScale(MI.getOpcode());
255 }
256
257 /// Returns whether the instruction is a pre-indexed load.
258 static bool isPreLd(const MachineInstr &MI);
259
260 /// Returns whether the instruction is a pre-indexed store.
261 static bool isPreSt(const MachineInstr &MI);
262
263 /// Returns whether the instruction is a pre-indexed load/store.
264 static bool isPreLdSt(const MachineInstr &MI);
265
266 /// Returns whether the instruction is a zero-extending load.
267 static bool isZExtLoad(const MachineInstr &MI);
268
269 /// Returns whether the instruction is a sign-extending load.
270 static bool isSExtLoad(const MachineInstr &MI);
271
272 /// Returns whether the instruction is a paired load/store.
273 static bool isPairedLdSt(const MachineInstr &MI);
274
275 /// Returns the base register operator of a load/store.
276 static const MachineOperand &getLdStBaseOp(const MachineInstr &MI);
277
278 /// Returns the immediate offset operator of a load/store.
279 static const MachineOperand &getLdStOffsetOp(const MachineInstr &MI);
280
281 /// Returns whether the physical register is FP or NEON.
282 static bool isFpOrNEON(Register Reg);
283
284 /// Returns the shift amount operator of a load/store.
285 static const MachineOperand &getLdStAmountOp(const MachineInstr &MI);
286
287 /// Returns whether the instruction is FP or NEON.
288 static bool isFpOrNEON(const MachineInstr &MI);
289
290 /// Returns whether the instruction is in H form (16 bit operands)
291 static bool isHForm(const MachineInstr &MI);
292
293 /// Returns whether the instruction is in Q form (128 bit operands)
294 static bool isQForm(const MachineInstr &MI);
295
296 /// Returns whether the instruction can be compatible with non-zero BTYPE.
297 static bool hasBTISemantics(const MachineInstr &MI);
298
299 /// Returns the index for the immediate for a given instruction.
300 static unsigned getLoadStoreImmIdx(unsigned Opc);
301
302 /// Return true if pairing the given load or store may be paired with another.
303 static bool isPairableLdStInst(const MachineInstr &MI);
304
305 /// Returns true if MI is one of the TCRETURN* instructions.
306 static bool isTailCallReturnInst(const MachineInstr &MI);
307
308 /// Return the opcode that set flags when possible. The caller is
309 /// responsible for ensuring the opc has a flag setting equivalent.
310 static unsigned convertToFlagSettingOpc(unsigned Opc);
311
312 /// Return true if this is a load/store that can be potentially paired/merged.
313 bool isCandidateToMergeOrPair(const MachineInstr &MI) const;
314
315 /// Hint that pairing the given load or store is unprofitable.
316 static void suppressLdStPair(MachineInstr &MI);
317
318 std::optional<ExtAddrMode>
319 getAddrModeFromMemoryOp(const MachineInstr &MemI) const override;
320
322 const MachineInstr &AddrI,
323 ExtAddrMode &AM) const override;
324
326 const ExtAddrMode &AM) const override;
327
330 int64_t &Offset, bool &OffsetIsScalable,
331 LocationSize &Width) const override;
332
333 /// If \p OffsetIsScalable is set to 'true', the offset is scaled by `vscale`.
334 /// This is true for some SVE instructions like ldr/str that have a
335 /// 'reg + imm' addressing mode where the immediate is an index to the
336 /// scalable vector located at 'reg + imm * vscale x #bytes'.
338 const MachineOperand *&BaseOp,
339 int64_t &Offset, bool &OffsetIsScalable,
340 TypeSize &Width) const;
341
342 /// Return the immediate offset of the base register in a load/store \p LdSt.
344
345 /// Returns true if opcode \p Opc is a memory operation. If it is, set
346 /// \p Scale, \p Width, \p MinOffset, and \p MaxOffset accordingly.
347 ///
348 /// For unscaled instructions, \p Scale is set to 1. All values are in bytes.
349 /// MinOffset/MaxOffset are the un-scaled limits of the immediate in the
350 /// instruction, the actual offset limit is [MinOffset*Scale,
351 /// MaxOffset*Scale].
352 static bool getMemOpInfo(unsigned Opcode, TypeSize &Scale, TypeSize &Width,
353 int64_t &MinOffset, int64_t &MaxOffset);
354
356 int64_t Offset1, bool OffsetIsScalable1,
358 int64_t Offset2, bool OffsetIsScalable2,
359 unsigned ClusterSize,
360 unsigned NumBytes) const override;
361
363 const DebugLoc &DL, MCRegister DestReg,
364 MCRegister SrcReg, bool KillSrc,
365 llvm::ArrayRef<unsigned> Indices) const;
367 const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg,
368 bool KillSrc, unsigned Opcode, unsigned ZeroReg,
369 llvm::ArrayRef<unsigned> Indices) const;
371 const DebugLoc &DL, Register DestReg, Register SrcReg,
372 bool KillSrc, bool RenamableDest = false,
373 bool RenamableSrc = false) const;
375 const DebugLoc &DL, Register DestReg, Register SrcReg,
376 bool KillSrc, bool RenamableDest = false,
377 bool RenamableSrc = false) const override;
378
381 bool isKill, int FrameIndex, const TargetRegisterClass *RC, Register VReg,
382 MachineInstr::MIFlag Flags = MachineInstr::NoFlags) const override;
383
386 Register DestReg, int FrameIndex, const TargetRegisterClass *RC,
387 Register VReg, unsigned SubReg = 0,
388 MachineInstr::MIFlag Flags = MachineInstr::NoFlags) const override;
389
390 // This tells target independent code that it is okay to pass instructions
391 // with subreg operands to foldMemoryOperandImpl.
392 bool isSubregFoldable() const override { return true; }
393
396 ArrayRef<unsigned> Ops, int FrameIndex,
397 MachineInstr *&CopyMI,
398 LiveIntervals *LIS = nullptr,
399 VirtRegMap *VRM = nullptr) const override;
400
401 /// \returns true if a branch from an instruction with opcode \p BranchOpc
402 /// bytes is capable of jumping to a position \p BrOffset bytes away.
403 bool isBranchOffsetInRange(unsigned BranchOpc,
404 int64_t BrOffset) const override;
405
406 MachineBasicBlock *getBranchDestBlock(const MachineInstr &MI) const override;
407
409 MachineBasicBlock &NewDestBB,
410 MachineBasicBlock &RestoreBB, const DebugLoc &DL,
411 int64_t BrOffset, RegScavenger *RS) const override;
412
414 MachineBasicBlock *&FBB,
416 bool AllowModify = false) const override;
418 MachineBranchPredicate &MBP,
419 bool AllowModify) const override;
421 int *BytesRemoved = nullptr) const override;
424 const DebugLoc &DL,
425 int *BytesAdded = nullptr) const override;
426
427 /// Inserts the compare instruction needed to un-fuse a fused conditional
428 /// branch instruction and returns the condition code of the original fused
429 /// branch.
432 const DebugLoc &DL,
434
435 std::unique_ptr<TargetInstrInfo::PipelinerLoopInfo>
436 analyzeLoopForPipelining(MachineBasicBlock *LoopBB) const override;
437
438 bool
442 SelectExpansion &) const override;
444 const DebugLoc &DL, Register DstReg,
446 Register FalseReg) const override;
447
449 MachineBasicBlock::iterator MI) const override;
450
451 MCInst getNop() const override;
452
454 const MachineBasicBlock *MBB,
455 const MachineFunction &MF) const override;
456
457 /// analyzeCompare - For a comparison instruction, return the source registers
458 /// in SrcReg and SrcReg2, and the value it compares against in CmpValue.
459 /// Return true if the comparison instruction can be analyzed.
460 bool analyzeCompare(const MachineInstr &MI, Register &SrcReg,
461 Register &SrcReg2, int64_t &CmpMask,
462 int64_t &CmpValue) const override;
463 /// optimizeCompareInstr - Convert the instruction supplying the argument to
464 /// the comparison into one that sets the zero bit in the flags register.
465 bool optimizeCompareInstr(MachineInstr &CmpInstr, Register SrcReg,
466 Register SrcReg2, int64_t CmpMask, int64_t CmpValue,
467 const MachineRegisterInfo *MRI) const override;
468 bool optimizeCondBranch(MachineInstr &MI) const override;
469
470 CombinerObjective getCombinerObjective(unsigned Pattern) const override;
471 /// Return true when a code sequence can improve throughput. It
472 /// should be called only for instructions in loops.
473 /// \param Pattern - combiner pattern
474 bool isThroughputPattern(unsigned Pattern) const override;
475 /// Return true when there is potentially a faster code sequence
476 /// for an instruction chain ending in ``Root``. All potential patterns are
477 /// listed in the ``Patterns`` array.
478 bool getMachineCombinerPatterns(MachineInstr &Root,
480 bool DoRegPressureReduce) const override;
481 /// Return true when Inst is associative and commutative so that it can be
482 /// reassociated. If Invert is true, then the inverse of Inst operation must
483 /// be checked.
484 bool isAssociativeAndCommutative(const MachineInstr &Inst,
485 bool Invert) const override;
486
487 /// Returns true if \P Opcode is an instruction which performs accumulation
488 /// into a destination register.
489 bool isAccumulationOpcode(unsigned Opcode) const override;
490
491 std::optional<FMAChainLinkInfo>
492 getFMAChainLinkInfo(const MachineInstr &MI) const override;
493
494 /// Returns an opcode which defines the accumulator used by \P Opcode.
495 unsigned getAccumulationStartOpcode(unsigned Opcode) const override;
496
497 unsigned
498 getReduceOpcodeForAccumulator(unsigned int AccumulatorOpCode) const override;
499
500 /// When getMachineCombinerPatterns() finds patterns, this function
501 /// generates the instructions that could replace the original code
502 /// sequence
503 void genAlternativeCodeSequence(
504 MachineInstr &Root, unsigned Pattern,
507 DenseMap<Register, unsigned> &InstrIdxForVirtReg) const override;
508 /// AArch64 supports MachineCombiner.
509 bool useMachineCombiner() const override;
510
511 bool expandPostRAPseudo(MachineInstr &MI) const override;
512
513 std::pair<unsigned, unsigned>
514 decomposeMachineOperandsTargetFlags(unsigned TF) const override;
516 getSerializableDirectMachineOperandTargetFlags() const override;
518 getSerializableBitmaskMachineOperandTargetFlags() const override;
520 getSerializableMachineMemOperandTargetFlags() const override;
521
522 bool isFunctionSafeToOutlineFrom(MachineFunction &MF,
523 bool OutlineFromLinkOnceODRs) const override;
524 std::optional<std::unique_ptr<outliner::OutlinedFunction>>
525 getOutliningCandidateInfo(
526 const MachineModuleInfo &MMI,
527 std::vector<outliner::Candidate> &RepeatedSequenceLocs,
528 unsigned MinRepeats) const override;
529 void mergeOutliningCandidateAttributes(
530 Function &F, std::vector<outliner::Candidate> &Candidates) const override;
531 outliner::InstrType getOutliningTypeImpl(const MachineModuleInfo &MMI,
533 unsigned Flags) const override;
535 std::pair<MachineBasicBlock::iterator, MachineBasicBlock::iterator>>
536 getOutlinableRanges(MachineBasicBlock &MBB, unsigned &Flags) const override;
537 void buildOutlinedFrame(MachineBasicBlock &MBB, MachineFunction &MF,
538 const outliner::OutlinedFunction &OF) const override;
540 insertOutlinedCall(Module &M, MachineBasicBlock &MBB,
542 outliner::Candidate &C) const override;
543 bool shouldOutlineFromFunctionByDefault(MachineFunction &MF) const override;
544
545 void buildClearRegister(Register Reg, MachineBasicBlock &MBB,
547 bool AllowSideEffects = true) const override;
548
549 /// Returns the vector element size (B, H, S or D) of an SVE opcode.
550 uint64_t getElementSizeForOpcode(unsigned Opc) const;
551 /// Returns true if the opcode is for an SVE instruction that sets the
552 /// condition codes as if it's results had been fed to a PTEST instruction
553 /// along with the same general predicate.
554 bool isPTestLikeOpcode(unsigned Opc) const;
555 /// Returns true if the opcode is for an SVE WHILE## instruction.
556 bool isWhileOpcode(unsigned Opc) const;
557 /// Returns true if the instruction has a shift by immediate that can be
558 /// executed in one cycle less.
559 static bool isFalkorShiftExtFast(const MachineInstr &MI);
560 /// Return true if the instructions is a SEH instruction used for unwinding
561 /// on Windows.
562 static bool isSEHInstruction(const MachineInstr &MI);
563
564 std::optional<RegImmPair> isAddImmediate(const MachineInstr &MI,
565 Register Reg) const override;
566
567 bool isFunctionSafeToSplit(const MachineFunction &MF) const override;
568
569 bool isMBBSafeToSplitToCold(const MachineBasicBlock &MBB) const override;
570
571 std::optional<ParamLoadedValue>
572 describeLoadedValue(const MachineInstr &MI, Register Reg) const override;
573
574 unsigned int getTailDuplicateSize(CodeGenOptLevel OptLevel) const override;
575
576 bool isExtendLikelyToBeFolded(MachineInstr &ExtMI,
577 MachineRegisterInfo &MRI) const override;
578
579 static void decomposeStackOffsetForFrameOffsets(const StackOffset &Offset,
580 int64_t &NumBytes,
581 int64_t &NumPredicateVectors,
582 int64_t &NumDataVectors);
583 static void decomposeStackOffsetForDwarfOffsets(const StackOffset &Offset,
584 int64_t &ByteSized,
585 int64_t &VGSized);
586
587 // Return true if address of the form BaseReg + Scale * ScaledReg + Offset can
588 // be used for a load/store of NumBytes. BaseReg is always present and
589 // implicit.
590 bool isLegalAddressingMode(unsigned NumBytes, int64_t Offset,
591 unsigned Scale) const;
592
593 // Decrement the SP, issuing probes along the way. `TargetReg` is the new top
594 // of the stack. `FrameSetup` is passed as true, if the allocation is a part
595 // of constructing the activation frame of a function.
597 Register TargetReg,
598 bool FrameSetup) const;
599
600 static int
601 findCondCodeUseOperandIdxForBranchOrSelect(const MachineInstr &Instr);
602
603 /// Insert a `PAUTH_EPILOGUE` pseudo before the first terminator in \p MBB to
604 /// authenticate the return address. Adds an implicit def of X16 when the
605 /// branch protection uses PAuthLR but the subtarget lacks PAuthLR
606 /// instructions. If the epilogue has callee-popped argument stack to restore,
607 /// it additionally implicit defines X15 and X17 to cover clobbered registers
608 /// for the required sequence on subtargets both with and without PAuthLR
609 /// instructions.
611
612#define GET_INSTRINFO_HELPER_DECLS
613#include "AArch64GenInstrInfo.inc"
614
615protected:
616 /// If the specific machine instruction is an instruction that moves/copies
617 /// value from one register to another register return destination and source
618 /// registers as machine operands.
619 std::optional<DestSourcePair>
620 isCopyInstrImpl(const MachineInstr &MI) const override;
621 std::optional<DestSourcePair>
622 isCopyLikeInstrImpl(const MachineInstr &MI) const override;
623
624private:
625 /// Returns the size of \p MI, excluding the LFI deferred LR guard that may
626 /// be flushed before a control-flow instruction (added by
627 /// getInstSizeInBytes).
628 unsigned getInstSizeInBytesNoGuard(const MachineInstr &MI) const;
629
630 /// Sets the offsets on outlined instructions in \p MBB which use SP
631 /// so that they will be valid post-outlining.
632 ///
633 /// \param MBB A \p MachineBasicBlock in an outlined function.
634 void fixupPostOutline(MachineBasicBlock &MBB) const;
635
636 void instantiateCondBranch(MachineBasicBlock &MBB, const DebugLoc &DL,
637 MachineBasicBlock *TBB,
639 bool substituteCmpToZero(MachineInstr &CmpInstr, unsigned SrcReg,
640 const MachineRegisterInfo &MRI) const;
641 bool removeCmpToZeroOrOne(MachineInstr &CmpInstr, unsigned SrcReg,
642 int CmpValue, const MachineRegisterInfo &MRI) const;
643
644 /// Returns an unused general-purpose register which can be used for
645 /// constructing an outlined call if one exists. Returns 0 otherwise.
646 Register findRegisterToSaveLRTo(outliner::Candidate &C) const;
647
648 /// Remove a ptest of a predicate-generating operation that already sets, or
649 /// can be made to set, the condition codes in an identical manner
650 bool optimizePTestInstr(MachineInstr *PTest, unsigned MaskReg,
651 unsigned PredReg,
652 const MachineRegisterInfo *MRI) const;
653 std::optional<unsigned>
654 canRemovePTestInstr(MachineInstr *PTest, MachineInstr *Mask,
655 MachineInstr *Pred, const MachineRegisterInfo *MRI) const;
656
657 /// verifyInstruction - Perform target specific instruction verification.
658 bool verifyInstruction(const MachineInstr &MI,
659 StringRef &ErrInfo) const override;
660};
661
662struct UsedNZCV {
663 bool N = false;
664 bool Z = false;
665 bool C = false;
666 bool V = false;
667
668 UsedNZCV() = default;
669
670 UsedNZCV &operator|=(const UsedNZCV &UsedFlags) {
671 this->N |= UsedFlags.N;
672 this->Z |= UsedFlags.Z;
673 this->C |= UsedFlags.C;
674 this->V |= UsedFlags.V;
675 return *this;
676 }
677};
678
679/// \returns Conditions flags used after \p CmpInstr in its MachineBB if NZCV
680/// flags are not alive in successors of the same \p CmpInstr and \p MI parent.
681/// \returns std::nullopt otherwise.
682///
683/// Collect instructions using that flags in \p CCUseInstrs if provided.
684std::optional<UsedNZCV>
685examineCFlagsUse(MachineInstr &MI, MachineInstr &CmpInstr,
686 const TargetRegisterInfo &TRI,
687 SmallVectorImpl<MachineInstr *> *CCUseInstrs = nullptr);
688
689/// Return true if there is an instruction /after/ \p DefMI and before \p UseMI
690/// which either reads or clobbers NZCV.
691bool isNZCVTouchedInInstructionRange(const MachineInstr &DefMI,
692 const MachineInstr &UseMI,
693 const TargetRegisterInfo *TRI);
694
695MCCFIInstruction createDefCFA(const TargetRegisterInfo &TRI, unsigned FrameReg,
696 unsigned Reg, const StackOffset &Offset,
697 bool LastAdjustmentWasScalable = true);
698MCCFIInstruction
699createCFAOffset(const TargetRegisterInfo &MRI, unsigned Reg,
700 const StackOffset &OffsetFromDefCFA,
701 std::optional<int64_t> IncomingVGOffsetFromDefCFA);
702
703/// emitFrameOffset - Emit instructions as needed to set DestReg to SrcReg
704/// plus Offset. This is intended to be used from within the prolog/epilog
705/// insertion (PEI) pass, where a virtual scratch register may be allocated
706/// if necessary, to be replaced by the scavenger at the end of PEI.
707void emitFrameOffset(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
708 const DebugLoc &DL, unsigned DestReg, unsigned SrcReg,
709 StackOffset Offset, const TargetInstrInfo *TII,
711 bool SetNZCV = false, bool NeedsWinCFI = false,
712 bool *HasWinCFI = nullptr, bool EmitCFAOffset = false,
713 StackOffset InitialOffset = {},
714 unsigned FrameReg = AArch64::SP);
715
716/// rewriteAArch64FrameIndex - Rewrite MI to access 'Offset' bytes from the
717/// FP. Return false if the offset could not be handled directly in MI, and
718/// return the left-over portion by reference.
719bool rewriteAArch64FrameIndex(MachineInstr &MI, unsigned FrameRegIdx,
720 unsigned FrameReg, StackOffset &Offset,
721 const AArch64InstrInfo *TII);
722
723/// Use to report the frame offset status in isAArch64FrameOffsetLegal.
725 AArch64FrameOffsetCannotUpdate = 0x0, ///< Offset cannot apply.
726 AArch64FrameOffsetIsLegal = 0x1, ///< Offset is legal.
727 AArch64FrameOffsetCanUpdate = 0x2 ///< Offset can apply, at least partly.
728};
729
730/// Check if the @p Offset is a valid frame offset for @p MI.
731/// The returned value reports the validity of the frame offset for @p MI.
732/// It uses the values defined by AArch64FrameOffsetStatus for that.
733/// If result == AArch64FrameOffsetCannotUpdate, @p MI cannot be updated to
734/// use an offset.eq
735/// If result & AArch64FrameOffsetIsLegal, @p Offset can completely be
736/// rewritten in @p MI.
737/// If result & AArch64FrameOffsetCanUpdate, @p Offset contains the
738/// amount that is off the limit of the legal offset.
739/// If set, @p OutUseUnscaledOp will contain the whether @p MI should be
740/// turned into an unscaled operator, which opcode is in @p OutUnscaledOp.
741/// If set, @p EmittableOffset contains the amount that can be set in @p MI
742/// (possibly with @p OutUnscaledOp if OutUseUnscaledOp is true) and that
743/// is a legal offset.
744int isAArch64FrameOffsetLegal(const MachineInstr &MI, StackOffset &Offset,
745 bool *OutUseUnscaledOp = nullptr,
746 unsigned *OutUnscaledOp = nullptr,
747 int64_t *EmittableOffset = nullptr);
748
749bool optimizeTerminators(MachineBasicBlock *MBB, const TargetInstrInfo &TII);
750
751static inline bool isUncondBranchOpcode(int Opc) { return Opc == AArch64::B; }
752
753static inline bool isCondBranchOpcode(int Opc) {
754 switch (Opc) {
755 case AArch64::Bcc:
756 case AArch64::CBZW:
757 case AArch64::CBZX:
758 case AArch64::CBNZW:
759 case AArch64::CBNZX:
760 case AArch64::TBZW:
761 case AArch64::TBZX:
762 case AArch64::TBNZW:
763 case AArch64::TBNZX:
764 case AArch64::CBWPri:
765 case AArch64::CBXPri:
766 case AArch64::CBBAssertExt:
767 case AArch64::CBHAssertExt:
768 case AArch64::CBWPrr:
769 case AArch64::CBXPrr:
770 return true;
771 default:
772 return false;
773 }
774}
775
776static inline bool isIndirectBranchOpcode(int Opc) {
777 switch (Opc) {
778 case AArch64::BR:
779 case AArch64::BRAA:
780 case AArch64::BRAB:
781 case AArch64::BRAAZ:
782 case AArch64::BRABZ:
783 return true;
784 }
785 return false;
786}
787
788static inline bool isIndirectCallOpcode(unsigned Opc) {
789 switch (Opc) {
790 case AArch64::BLR:
791 case AArch64::BLRAA:
792 case AArch64::BLRAB:
793 case AArch64::BLRAAZ:
794 case AArch64::BLRABZ:
795 return true;
796 default:
797 return false;
798 }
799}
800
801static inline bool isPTrueOpcode(unsigned Opc) {
802 switch (Opc) {
803 case AArch64::PTRUE_B:
804 case AArch64::PTRUE_H:
805 case AArch64::PTRUE_S:
806 case AArch64::PTRUE_D:
807 return true;
808 default:
809 return false;
810 }
811}
812
813/// Return opcode to be used for indirect calls.
814unsigned getBLRCallOpcode(const MachineFunction &MF);
815
816/// Return XPAC opcode to be used for a ptrauth strip using the given key.
817static inline unsigned getXPACOpcodeForKey(AArch64PACKey::ID K) {
818 using namespace AArch64PACKey;
819 switch (K) {
820 case IA: case IB: return AArch64::XPACI;
821 case DA: case DB: return AArch64::XPACD;
822 }
823 llvm_unreachable("Unhandled AArch64PACKey::ID enum");
824}
825
826/// Return AUT opcode to be used for a ptrauth auth using the given key, or its
827/// AUT*Z variant that doesn't take a discriminator operand, using zero instead.
828static inline unsigned getAUTOpcodeForKey(AArch64PACKey::ID K, bool Zero) {
829 using namespace AArch64PACKey;
830 switch (K) {
831 case IA: return Zero ? AArch64::AUTIZA : AArch64::AUTIA;
832 case IB: return Zero ? AArch64::AUTIZB : AArch64::AUTIB;
833 case DA: return Zero ? AArch64::AUTDZA : AArch64::AUTDA;
834 case DB: return Zero ? AArch64::AUTDZB : AArch64::AUTDB;
835 }
836 llvm_unreachable("Unhandled AArch64PACKey::ID enum");
837}
838
839/// Return PAC opcode to be used for a ptrauth sign using the given key, or its
840/// PAC*Z variant that doesn't take a discriminator operand, using zero instead.
841static inline unsigned getPACOpcodeForKey(AArch64PACKey::ID K, bool Zero) {
842 using namespace AArch64PACKey;
843 switch (K) {
844 case IA: return Zero ? AArch64::PACIZA : AArch64::PACIA;
845 case IB: return Zero ? AArch64::PACIZB : AArch64::PACIB;
846 case DA: return Zero ? AArch64::PACDZA : AArch64::PACDA;
847 case DB: return Zero ? AArch64::PACDZB : AArch64::PACDB;
848 }
849 llvm_unreachable("Unhandled AArch64PACKey::ID enum");
850}
851
852/// Return B(L)RA opcode to be used for an authenticated branch or call using
853/// the given key, or its B(L)RA*Z variant that doesn't take a discriminator
854/// operand, using zero instead.
855static inline unsigned getBranchOpcodeForKey(bool IsCall, AArch64PACKey::ID K,
856 bool Zero) {
857 using namespace AArch64PACKey;
858 static const unsigned BranchOpcode[2][2] = {
859 {AArch64::BRAA, AArch64::BRAAZ},
860 {AArch64::BRAB, AArch64::BRABZ},
861 };
862 static const unsigned CallOpcode[2][2] = {
863 {AArch64::BLRAA, AArch64::BLRAAZ},
864 {AArch64::BLRAB, AArch64::BLRABZ},
865 };
866
867 assert((K == IA || K == IB) && "B(L)RA* instructions require IA or IB key");
868 if (IsCall)
869 return CallOpcode[K == IB][Zero];
870 return BranchOpcode[K == IB][Zero];
871}
872
873// struct TSFlags {
874#define TSFLAG_ELEMENT_SIZE_TYPE(X) (X) // 3-bits
875#define TSFLAG_DESTRUCTIVE_INST_TYPE(X) ((X) << 3) // 4-bits
876#define TSFLAG_FALSE_LANE_TYPE(X) ((X) << 7) // 2-bits
877#define TSFLAG_INSTR_FLAGS(X) ((X) << 9) // 2-bits
878#define TSFLAG_SME_MATRIX_TYPE(X) ((X) << 11) // 3-bits
879// }
880
881namespace AArch64 {
882
883// clang-format off
892
909
915
916// clang-format on
917
918// NOTE: This is a bit field.
921
932
933#undef TSFLAG_ELEMENT_SIZE_TYPE
934#undef TSFLAG_DESTRUCTIVE_INST_TYPE
935#undef TSFLAG_FALSE_LANE_TYPE
936#undef TSFLAG_INSTR_FLAGS
937#undef TSFLAG_SME_MATRIX_TYPE
938
939int32_t getSVEPseudoMap(uint32_t Opcode);
940int32_t getSVERevInstr(uint32_t Opcode);
942
943int32_t getSMEPseudoMap(uint32_t Opcode);
944}
945
946} // end namespace llvm
947
948#endif
MachineInstrBuilder & UseMI
MachineInstrBuilder MachineInstrBuilder & DefMI
SDValue Pred
#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)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
const AArch64InstrInfo & TII
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")
IRTranslator LLVM IR MI
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
SmallVector< MachineOperand, 4 > Cond
unsigned Opc
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
Register Reg
Register const TargetRegisterInfo * TRI
Promote Memory to Register
Definition Mem2Reg.cpp:110
MachineRegisterInfo & MRI
const SmallVectorImpl< MachineOperand > MachineBasicBlock * TBB
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 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
bool isSubregFoldable() const override
unsigned getInstSizeInBytes(const MachineInstr &MI) const override
GetInstSize - Return the number of bytes of code the specified instruction may be.
static bool isZExtLoad(const MachineInstr &MI)
Returns whether the instruction is a zero-extending load.
bool areMemAccessesTriviallyDisjoint(const MachineInstr &MIa, const MachineInstr &MIb) const override
void copyPhysRegImpl(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, Register DestReg, Register SrcReg, bool KillSrc, bool RenamableDest=false, bool RenamableSrc=false) 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
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.
void createPauthEpilogueInstr(MachineBasicBlock &MBB, DebugLoc DL) const
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
Register isLoadFromStackSlotPostFE(const MachineInstr &MI, int &FrameIndex) const override
Check for post-frame ptr elimination stack locations as well.
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
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.
bool analyzeBranchPredicate(MachineBasicBlock &MBB, MachineBranchPredicate &MBP, bool AllowModify) const override
void insertIndirectBranch(MachineBasicBlock &MBB, MachineBasicBlock &NewDestBB, MachineBasicBlock &RestoreBB, const DebugLoc &DL, int64_t BrOffset, RegScavenger *RS) const override
const TargetRegisterClass * getInlineAsmMemoryOperandRegClass(InlineAsm::ConstraintCode C) const override
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
static bool isPairableLdStInst(const MachineInstr &MI)
Return true if pairing the given load or store may be paired with another.
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
static bool isSExtLoad(const MachineInstr &MI)
Returns whether the instruction is a sign-extending load.
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.
void insertNoop(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const override
AArch64InstrInfo(const AArch64Subtarget &STI)
static bool isPairedLdSt(const MachineInstr &MI)
Returns whether the instruction is a paired load/store.
MachineInstr * foldMemoryOperandImpl(MachineFunction &MF, MachineInstr &MI, ArrayRef< unsigned > Ops, int FrameIndex, MachineInstr *&CopyMI, LiveIntervals *LIS=nullptr, VirtRegMap *VRM=nullptr) const override
Register isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const override
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
bool getMemOperandsWithOffsetWidth(const MachineInstr &MI, SmallVectorImpl< const MachineOperand * > &BaseOps, int64_t &Offset, bool &OffsetIsScalable, LocationSize &Width) 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.
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
bool isThroughputPattern(unsigned Pattern) const override
Return true when a code sequence can improve throughput.
bool canInsertSelect(const MachineBasicBlock &, ArrayRef< MachineOperand > Cond, Register, Register, Register, SelectExpansion &) const override
MachineOperand & getMemOpBaseRegImmOfsOffsetOperand(MachineInstr &LdSt) const
Return the immediate offset of the base register in a load/store LdSt.
std::optional< ExtAddrMode > getAddrModeFromMemoryOp(const MachineInstr &MemI) const override
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.
Register isStoreToStackSlotPostFE(const MachineInstr &MI, int &FrameIndex) const override
Check for post-frame ptr elimination stack locations as well.
std::unique_ptr< TargetInstrInfo::PipelinerLoopInfo > analyzeLoopForPipelining(MachineBasicBlock *LoopBB) const override
void copyPhysRegTuple(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg, bool KillSrc, llvm::ArrayRef< unsigned > Indices) const
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
AArch64CC::CondCode insertCmpForCondBr(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, ArrayRef< MachineOperand > Cond) const
Inserts the compare instruction needed to un-fuse a fused conditional branch instruction and returns ...
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?
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 getMemOperandWithOffsetWidth(const MachineInstr &MI, const MachineOperand *&BaseOp, int64_t &Offset, bool &OffsetIsScalable, TypeSize &Width) const
If OffsetIsScalable is set to 'true', the offset is scaled by vscale.
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 isAsCheapAsAMove(const MachineInstr &MI) 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.
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.
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
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:187
Wrapper class representing physical registers and target specific virtual registers.
Definition MCRegister.h:42
MachineInstrBundleIterator< MachineInstr > iterator
Representation of each machine instruction.
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:68
Wrapper class representing virtual and physical registers.
Definition Register.h:20
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.
StackOffset holds a fixed and a scalable offset in bytes.
Definition TypeSize.h:31
virtual MachineInstr * foldMemoryOperandImpl(MachineFunction &MF, MachineInstr &MI, ArrayRef< unsigned > Ops, int FrameIndex, MachineInstr *&CopyMI, LiveIntervals *LIS=nullptr, VirtRegMap *VRM=nullptr) const
Target-dependent implementation for foldMemoryOperand.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static const uint64_t InstrFlagIsWhile
static const uint64_t InstrFlagIsPTestLike
int32_t getSVERevInstr(uint32_t Opcode)
int32_t getSMEPseudoMap(uint32_t Opcode)
int32_t getSVENonRevInstr(uint32_t Opcode)
int32_t getSVEPseudoMap(uint32_t Opcode)
InstrType
Represents how an instruction should be mapped by the outliner.
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:577
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.
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.
static unsigned getBranchOpcodeForKey(bool IsCall, AArch64PACKey::ID K, bool Zero)
Return B(L)RA opcode to be used for an authenticated branch or call using the given key,...
static bool isSEHInstruction(const MachineInstr &MI)
static bool isIndirectCallOpcode(unsigned Opc)
AArch64MachineCombinerPattern
@ MULSUBv8i16_OP2
@ FMULv4i16_indexed_OP1
@ FMLSv1i32_indexed_OP2
@ MULSUBv2i32_indexed_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
@ FMLAv4i32_indexed_OP1
@ MULADDv4i16_OP2
@ FMULv8i16_indexed_OP2
@ MULSUBv4i16_OP1
@ MULADDv4i32_OP2
@ MULADDv2i32_OP2
@ MULADDv16i8_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
@ MULADDv8i16_OP1
@ MULSUBv4i32_indexed_OP1
@ MULSUBv4i32_OP1
@ FMLSv8i16_indexed_OP2
@ MULADDv8i16_indexed_OP2
@ MULSUBv2i32_OP2
@ FMLSv1i64_indexed_OP2
@ MULADDv4i16_indexed_OP1
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:280
MCCFIInstruction createCFAOffset(const TargetRegisterInfo &MRI, unsigned Reg, const StackOffset &OffsetFromDefCFA, std::optional< int64_t > IncomingVGOffsetFromDefCFA)
ArrayRef(const T &OneElt) -> ArrayRef< T >
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 optimizeTerminators(MachineBasicBlock *MBB, const TargetInstrInfo &TII)
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'...
MCRegisterClass TargetRegisterClass
Definition FastISel.h:58
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.