LLVM 24.0.0git
RISCVInstrInfo.h
Go to the documentation of this file.
1//===-- RISCVInstrInfo.h - RISC-V 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 RISC-V implementation of the TargetInstrInfo class.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_RISCV_RISCVINSTRINFO_H
14#define LLVM_LIB_TARGET_RISCV_RISCVINSTRINFO_H
15
16#include "RISCV.h"
17#include "RISCVRegisterInfo.h"
20
21#define GET_INSTRINFO_HEADER
22#include "RISCVGenInstrInfo.inc"
23#include "RISCVGenRegisterInfo.inc"
24
25namespace llvm {
26
27// If Value is of the form C1<<C2, where C1 = 3, 5 or 9,
28// returns log2(C1 - 1) and assigns Shift = C2.
29// Otherwise, returns 0.
30template <typename T> int isShifted359(T Value, int &Shift) {
31 if (Value == 0)
32 return 0;
33 Shift = llvm::countr_zero(Value);
34 switch (Value >> Shift) {
35 case 3:
36 return 1;
37 case 5:
38 return 2;
39 case 9:
40 return 3;
41 default:
42 return 0;
43 }
44}
45
46class RISCVSubtarget;
47
52
53namespace RISCVCC {
54
64
65CondCode getInverseBranchCondition(CondCode);
66unsigned getInverseBranchOpcode(unsigned BCC);
67unsigned getBrCond(CondCode CC, unsigned SelectOpc = 0);
68
69} // end of namespace RISCVCC
70
71// RISCV MachineCombiner patterns
80
82 const RISCVRegisterInfo RegInfo;
83
84public:
85 explicit RISCVInstrInfo(const RISCVSubtarget &STI);
86
87 const RISCVRegisterInfo &getRegisterInfo() const { return RegInfo; }
88
90 InlineAsm::ConstraintCode C) const override {
91 return &RISCV::GPRRegClass;
92 }
93
94 MCInst getNop() const override;
95
97 int &FrameIndex) const override;
98 Register isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex,
99 TypeSize &MemBytes) const override;
101 int &FrameIndex) const override;
102 Register isStoreToStackSlot(const MachineInstr &MI, int &FrameIndex,
103 TypeSize &MemBytes) const override;
104
105 bool isReMaterializableImpl(const MachineInstr &MI) const override;
106
108 return MI.getOpcode() == RISCV::ADDI && MI.getOperand(1).isReg() &&
109 MI.getOperand(1).getReg() == RISCV::X0;
110 }
111
114 MCRegister DstReg, MCRegister SrcReg, bool KillSrc,
115 const TargetRegisterClass *RegClass) const;
117 const DebugLoc &DL, Register DstReg, Register SrcReg,
118 bool KillSrc, bool RenamableDest = false,
119 bool RenamableSrc = false) const override;
120
123 bool IsKill, int FrameIndex, const TargetRegisterClass *RC,
124
125 Register VReg,
126 MachineInstr::MIFlag Flags = MachineInstr::NoFlags) const override;
127
130 int FrameIndex, const TargetRegisterClass *RC, Register VReg,
131 unsigned SubReg = 0,
132 MachineInstr::MIFlag Flags = MachineInstr::NoFlags) const override;
133
136 ArrayRef<unsigned> Ops, int FrameIndex,
137 MachineInstr *&CopyMI,
138 LiveIntervals *LIS = nullptr,
139 VirtRegMap *VRM = nullptr) const override;
140
143 MachineInstr &LoadMI,
144 MachineInstr *&CopyMI,
145 LiveIntervals *LIS = nullptr,
146 VirtRegMap *VRM = nullptr) const override;
147
148 // Materializes the given integer Val into DstReg.
150 const DebugLoc &DL, Register DstReg, uint64_t Val,
152 bool DstRenamable = false, bool DstIsDead = false) const;
153
154 unsigned getInstSizeInBytes(const MachineInstr &MI) const override;
155
157 MachineBasicBlock *&FBB,
159 bool AllowModify) const override;
160
163 const DebugLoc &dl,
164 int *BytesAdded = nullptr) const override;
165
167 MachineBasicBlock &NewDestBB,
168 MachineBasicBlock &RestoreBB, const DebugLoc &DL,
169 int64_t BrOffset, RegScavenger *RS) const override;
170
172 int *BytesRemoved = nullptr) const override;
173
174 bool
176
177 bool optimizeCondBranch(MachineInstr &MI) const override;
178
179 MachineBasicBlock *getBranchDestBlock(const MachineInstr &MI) const override;
180
181 bool isBranchOffsetInRange(unsigned BranchOpc,
182 int64_t BrOffset) const override;
183
184 int getJumpTableIndex(const MachineInstr &MI) const override;
185
188 bool) const override;
189
190 bool isAsCheapAsAMove(const MachineInstr &MI) const override;
191
192 std::optional<DestSourcePair>
193 isCopyInstrImpl(const MachineInstr &MI) const override;
194
196 StringRef &ErrInfo) const override;
197
199 const MachineInstr &AddrI,
200 ExtAddrMode &AM) const override;
201
203 const ExtAddrMode &AM) const override;
204
207 int64_t &Offset, bool &OffsetIsScalable, LocationSize &Width,
208 const TargetRegisterInfo *TRI) const override;
209
211 int64_t Offset1, bool OffsetIsScalable1,
213 int64_t Offset2, bool OffsetIsScalable2,
214 unsigned ClusterSize,
215 unsigned NumBytes) const override;
216
218 const MachineOperand *&BaseOp,
219 int64_t &Offset, LocationSize &Width,
220 const TargetRegisterInfo *TRI) const;
221
223 const MachineInstr &MIb) const override;
224
225
226 std::pair<unsigned, unsigned>
227 decomposeMachineOperandsTargetFlags(unsigned TF) const override;
228
231
232 // Return true if the function can safely be outlined from.
234 bool OutlineFromLinkOnceODRs) const override;
235
236 // Return true if MBB is safe to outline from, and return any target-specific
237 // information in Flags.
239 unsigned &Flags) const override;
240
242
243 // Return true if the candidate should be discarded from outlining.
245 // Calculate target-specific information for a set of outlining candidates.
246 std::optional<std::unique_ptr<outliner::OutlinedFunction>>
248 const MachineModuleInfo &MMI,
249 std::vector<outliner::Candidate> &RepeatedSequenceLocs,
250 unsigned MinRepeats) const override;
251
252 // Return if/how a given MachineInstr should be outlined.
255 unsigned Flags) const override;
256
257 // Insert a custom frame for outlined functions.
259 const outliner::OutlinedFunction &OF) const override;
260
261 // Insert a call to an outlined function into a given basic block.
265 outliner::Candidate &C) const override;
266
269 bool AllowSideEffects = true) const override;
270
271 std::optional<RegImmPair> isAddImmediate(const MachineInstr &MI,
272 Register Reg) const override;
273
274 bool findCommutedOpIndices(const MachineInstr &MI, unsigned &SrcOpIdx1,
275 unsigned &SrcOpIdx2) const override;
277 unsigned OpIdx1,
278 unsigned OpIdx2) const override;
279
280 bool simplifyInstruction(MachineInstr &MI) const override;
281
283 LiveIntervals *LIS) const override;
284
285 // MIR printer helper function to annotate Operands with a comment.
286 std::string
288 unsigned OpIdx,
289 const TargetRegisterInfo *TRI) const override;
290
291 /// Generate code to multiply the value in DestReg by Amt - handles all
292 /// the common optimizations for this idiom, and supports fallback for
293 /// subtargets which don't support multiply instructions.
296 Register DestReg, uint32_t Amt, MachineInstr::MIFlag Flag) const;
297
298 bool useMachineCombiner() const override { return true; }
299
301
302 CombinerObjective getCombinerObjective(unsigned Pattern) const override;
303
306 bool DoRegPressureReduce) const override;
307
308 void
309 finalizeInsInstrs(MachineInstr &Root, unsigned &Pattern,
310 SmallVectorImpl<MachineInstr *> &InsInstrs) const override;
311
313 MachineInstr &Root, unsigned Pattern,
316 DenseMap<Register, unsigned> &InstrIdxForVirtReg) const override;
317
318 bool hasReassociableOperands(const MachineInstr &Inst,
319 const MachineBasicBlock *MBB) const override;
320
321 bool hasReassociableSibling(const MachineInstr &Inst,
322 bool &Commuted) const override;
323
325 bool Invert) const override;
326
327 std::optional<unsigned> getInverseOpcode(unsigned Opcode) const override;
328
330 const MachineInstr &Root, unsigned Pattern,
331 std::array<unsigned, 5> &OperandIndices) const override;
332
335
336 unsigned getTailDuplicateSize(CodeGenOptLevel OptLevel) const override;
337
338 std::unique_ptr<TargetInstrInfo::PipelinerLoopInfo>
339 analyzeLoopForPipelining(MachineBasicBlock *LoopBB) const override;
340
341 bool isHighLatencyDef(int Opc) const override;
342
343 /// Return true if \p MI is a COPY to a vector register of a specific \p LMul,
344 /// or any kind of vector registers when \p LMul is zero.
345 bool isVRegCopy(const MachineInstr *MI, unsigned LMul = 0) const;
346
347 /// Return true if the instruction requires an NTL hint to be emitted.
348 bool requiresNTLHint(const MachineInstr &MI) const;
349
350 /// Return true if moving \p From down to \p To won't cause any physical
351 /// register reads or writes to be clobbered and no visible side effects are
352 /// affected. From and To must be in the same block.
353 static bool isSafeToMove(const MachineInstr &From,
355
356 /// Return true if pairing the given load or store may be paired with another.
357 static bool isPairableLdStInstOpc(unsigned Opc);
358
359 static bool isLdStSafeToPair(const MachineInstr &LdSt,
360 const TargetRegisterInfo *TRI);
361#define GET_INSTRINFO_HELPER_DECLS
362#include "RISCVGenInstrInfo.inc"
363
365
366 /// Return the result of the evaluation of C0 CC C1, where CC is a
367 /// RISCVCC::CondCode.
368 static bool evaluateCondBranch(RISCVCC::CondCode CC, int64_t C0, int64_t C1);
369
370 /// Return true if the operand is a load immediate instruction and
371 /// sets Imm to the immediate value.
372 static bool isFromLoadImm(const MachineRegisterInfo &MRI,
373 const MachineOperand &Op, int64_t &Imm);
374
375protected:
377
378private:
379 bool isVectorAssociativeAndCommutative(const MachineInstr &MI,
380 bool Invert = false) const;
381 bool areRVVInstsReassociable(const MachineInstr &MI1,
382 const MachineInstr &MI2) const;
383 bool hasReassociableVectorSibling(const MachineInstr &Inst,
384 bool &Commuted) const;
385};
386
387namespace RISCV {
388
389// Returns true if the given MI is an RVV instruction opcode for which we may
390// expect to see a FrameIndex operand.
391bool isRVVSpill(const MachineInstr &MI);
392
393/// Return true if \p MI is a copy that will be lowered to one or more vmvNr.vs.
395
396std::optional<std::pair<unsigned, unsigned>>
397isRVVSpillForZvlsseg(unsigned Opcode);
398
399// Return true if both input instructions have equal rounding mode. If at least
400// one of the instructions does not have rounding mode, false will be returned.
401bool hasEqualFRM(const MachineInstr &MI1, const MachineInstr &MI2);
402
403// If \p Opcode is a .vx vector instruction, returns the lower number of bits
404// that are used from the scalar .x operand for a given \p Log2SEW. Otherwise
405// returns null.
406std::optional<unsigned> getVectorLowDemandedScalarBits(unsigned Opcode,
407 unsigned Log2SEW);
408
409// Returns the MC opcode of RVV pseudo instruction.
410unsigned getRVVMCOpcode(unsigned RVVPseudoOpcode);
411
412// For a (non-pseudo) RVV instruction \p Desc and the given \p Log2SEW, returns
413// the log2 EEW of the destination operand.
414unsigned getDestLog2EEW(const MCInstrDesc &Desc, unsigned Log2SEW);
415
416// Special immediate for AVL operand of V pseudo instructions to indicate VLMax.
417static constexpr int64_t VLMaxSentinel = -1LL;
418
419/// Given two VL operands, do we know that LHS <= RHS?
420bool isVLKnownLE(const MachineRegisterInfo &MRI, const MachineOperand &LHS,
421 const MachineOperand &RHS);
422
423// Mask assignments for floating-point
424static constexpr unsigned FPMASK_Negative_Infinity = 0x001;
425static constexpr unsigned FPMASK_Negative_Normal = 0x002;
426static constexpr unsigned FPMASK_Negative_Subnormal = 0x004;
427static constexpr unsigned FPMASK_Negative_Zero = 0x008;
428static constexpr unsigned FPMASK_Positive_Zero = 0x010;
429static constexpr unsigned FPMASK_Positive_Subnormal = 0x020;
430static constexpr unsigned FPMASK_Positive_Normal = 0x040;
431static constexpr unsigned FPMASK_Positive_Infinity = 0x080;
432static constexpr unsigned FPMASK_Signaling_NaN = 0x100;
433static constexpr unsigned FPMASK_Quiet_NaN = 0x200;
434} // namespace RISCV
435
436namespace RISCVVPseudosTable {
437
445
446#define GET_RISCVVPseudosTable_DECL
447#include "RISCVGenSearchableTables.inc"
448
449} // end namespace RISCVVPseudosTable
450
451namespace RISCV {
452
458#define GET_RISCVMaskedPseudosTable_DECL
459#include "RISCVGenSearchableTables.inc"
460} // end namespace RISCV
461
462} // end namespace llvm
463#endif
SmallVector< int16_t, MAX_SRC_OPERANDS_NUM > OperandIndices
unsigned Imm
unsigned uint64_t
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
IRTranslator LLVM IR MI
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
Register Reg
Register const TargetRegisterInfo * TRI
#define T
uint64_t IntrinsicInst * II
const SmallVectorImpl< MachineOperand > MachineBasicBlock * TBB
const SmallVectorImpl< MachineOperand > & Cond
Value * RHS
Value * LHS
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:188
Describe properties that are true of each instruction in the target description file.
Wrapper class representing physical registers. Should be passed by value.
Definition MCRegister.h:41
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
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 isSafeToMove(const MachineInstr &From, const MachineBasicBlock::iterator &To)
Return true if moving From down to To won't cause any physical register reads or writes to be clobber...
MachineInstr * convertToThreeAddress(MachineInstr &MI, LiveVariables *LV, LiveIntervals *LIS) const override
const TargetRegisterClass * getInlineAsmMemoryOperandRegClass(InlineAsm::ConstraintCode C) const override
Register isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const override
std::optional< std::unique_ptr< outliner::OutlinedFunction > > getOutliningCandidateInfo(const MachineModuleInfo &MMI, std::vector< outliner::Candidate > &RepeatedSequenceLocs, unsigned MinRepeats) const override
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
void genAlternativeCodeSequence(MachineInstr &Root, unsigned Pattern, SmallVectorImpl< MachineInstr * > &InsInstrs, SmallVectorImpl< MachineInstr * > &DelInstrs, DenseMap< Register, unsigned > &InstrIdxForVirtReg) const override
void movImm(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &DL, Register DstReg, uint64_t Val, MachineInstr::MIFlag Flag=MachineInstr::NoFlags, bool DstRenamable=false, bool DstIsDead=false) const
MachineInstr * emitLdStWithAddr(MachineInstr &MemI, const ExtAddrMode &AM) const override
void mulImm(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator II, const DebugLoc &DL, Register DestReg, uint32_t Amt, MachineInstr::MIFlag Flag) const
Generate code to multiply the value in DestReg by Amt - handles all the common optimizations for this...
static bool isPairableLdStInstOpc(unsigned Opc)
Return true if pairing the given load or store may be paired with another.
RISCVInstrInfo(const RISCVSubtarget &STI)
void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, Register DstReg, int FrameIndex, const TargetRegisterClass *RC, Register VReg, unsigned SubReg=0, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
bool isFunctionSafeToOutlineFrom(MachineFunction &MF, bool OutlineFromLinkOnceODRs) const override
std::unique_ptr< TargetInstrInfo::PipelinerLoopInfo > analyzeLoopForPipelining(MachineBasicBlock *LoopBB) const override
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &dl, int *BytesAdded=nullptr) const override
bool hasReassociableSibling(const MachineInstr &Inst, bool &Commuted) const override
static bool isLdStSafeToPair(const MachineInstr &LdSt, const TargetRegisterInfo *TRI)
void copyPhysRegVector(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &DL, MCRegister DstReg, MCRegister SrcReg, bool KillSrc, const TargetRegisterClass *RegClass) const
bool isReMaterializableImpl(const MachineInstr &MI) const override
MachineInstr * optimizeSelect(MachineInstr &MI, SmallPtrSetImpl< MachineInstr * > &SeenMIs, bool) const override
bool isVRegCopy(const MachineInstr *MI, unsigned LMul=0) const
Return true if MI is a COPY to a vector register of a specific LMul, or any kind of vector registers ...
bool canFoldIntoAddrMode(const MachineInstr &MemI, Register Reg, const MachineInstr &AddrI, ExtAddrMode &AM) const override
void insertIndirectBranch(MachineBasicBlock &MBB, MachineBasicBlock &NewDestBB, MachineBasicBlock &RestoreBB, const DebugLoc &DL, int64_t BrOffset, RegScavenger *RS) const override
bool isAsCheapAsAMove(const MachineInstr &MI) const override
bool verifyInstruction(const MachineInstr &MI, StringRef &ErrInfo) const override
bool getMemOperandWithOffsetWidth(const MachineInstr &LdSt, const MachineOperand *&BaseOp, int64_t &Offset, LocationSize &Width, const TargetRegisterInfo *TRI) const
unsigned getTailDuplicateSize(CodeGenOptLevel OptLevel) const override
void getReassociateOperandIndices(const MachineInstr &Root, unsigned Pattern, std::array< unsigned, 5 > &OperandIndices) const override
const RISCVSubtarget & STI
bool useMachineCombiner() const override
Register isStoreToStackSlot(const MachineInstr &MI, int &FrameIndex) const override
std::optional< unsigned > getInverseOpcode(unsigned Opcode) const override
bool simplifyInstruction(MachineInstr &MI) const override
ArrayRef< std::pair< unsigned, const char * > > getSerializableDirectMachineOperandTargetFlags() const override
outliner::InstrType getOutliningTypeImpl(const MachineModuleInfo &MMI, MachineBasicBlock::iterator &MBBI, unsigned Flags) const override
MachineTraceStrategy getMachineCombinerTraceStrategy() const override
unsigned getInstSizeInBytes(const MachineInstr &MI) const override
std::optional< RegImmPair > isAddImmediate(const MachineInstr &MI, Register Reg) const override
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
ArrayRef< std::pair< MachineMemOperand::Flags, const char * > > getSerializableMachineMemOperandTargetFlags() const override
MCInst getNop() const override
bool analyzeCandidate(outliner::Candidate &C) const
bool isMBBSafeToOutlineFrom(MachineBasicBlock &MBB, unsigned &Flags) const override
bool getMemOperandsWithOffsetWidth(const MachineInstr &MI, SmallVectorImpl< const MachineOperand * > &BaseOps, int64_t &Offset, bool &OffsetIsScalable, LocationSize &Width, const TargetRegisterInfo *TRI) const override
void buildOutlinedFrame(MachineBasicBlock &MBB, MachineFunction &MF, const outliner::OutlinedFunction &OF) const override
bool requiresNTLHint(const MachineInstr &MI) const
Return true if the instruction requires an NTL hint to be emitted.
void finalizeInsInstrs(MachineInstr &Root, unsigned &Pattern, SmallVectorImpl< MachineInstr * > &InsInstrs) const override
std::pair< unsigned, unsigned > decomposeMachineOperandsTargetFlags(unsigned TF) const override
MachineInstr * commuteInstructionImpl(MachineInstr &MI, bool NewMI, unsigned OpIdx1, unsigned OpIdx2) const override
int getJumpTableIndex(const MachineInstr &MI) const override
bool shouldBreakCriticalEdgeToSink(MachineInstr &MI) const override
bool hasReassociableOperands(const MachineInstr &Inst, const MachineBasicBlock *MBB) const override
MachineBasicBlock * getBranchDestBlock(const MachineInstr &MI) const override
std::string createMIROperandComment(const MachineInstr &MI, const MachineOperand &Op, unsigned OpIdx, const TargetRegisterInfo *TRI) const override
bool shouldOutlineFromFunctionByDefault(MachineFunction &MF) const override
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &DL, Register DstReg, Register SrcReg, bool KillSrc, bool RenamableDest=false, bool RenamableSrc=false) const override
const RISCVRegisterInfo & getRegisterInfo() const
bool findCommutedOpIndices(const MachineInstr &MI, unsigned &SrcOpIdx1, unsigned &SrcOpIdx2) const override
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify) const override
MachineBasicBlock::iterator insertOutlinedCall(Module &M, MachineBasicBlock &MBB, MachineBasicBlock::iterator &It, MachineFunction &MF, outliner::Candidate &C) const override
MachineInstr * foldMemoryOperandImpl(MachineFunction &MF, MachineInstr &MI, ArrayRef< unsigned > Ops, int FrameIndex, MachineInstr *&CopyMI, LiveIntervals *LIS=nullptr, VirtRegMap *VRM=nullptr) const override
bool isBranchOffsetInRange(unsigned BranchOpc, int64_t BrOffset) const override
static RISCVCC::CondCode getCondFromBranchOpc(unsigned Opc)
void buildClearRegister(Register Reg, MachineBasicBlock &MBB, MachineBasicBlock::iterator Iter, DebugLoc &DL, bool AllowSideEffects=true) const override
bool isAssociativeAndCommutative(const MachineInstr &Inst, bool Invert) const override
CombinerObjective getCombinerObjective(unsigned Pattern) const override
bool isHighLatencyDef(int Opc) const override
static bool evaluateCondBranch(RISCVCC::CondCode CC, int64_t C0, int64_t C1)
Return the result of the evaluation of C0 CC C1, where CC is a RISCVCC::CondCode.
bool getMachineCombinerPatterns(MachineInstr &Root, SmallVectorImpl< unsigned > &Patterns, bool DoRegPressureReduce) const override
bool optimizeCondBranch(MachineInstr &MI) const override
std::optional< DestSourcePair > isCopyInstrImpl(const MachineInstr &MI) const override
static bool isFromLoadImm(const MachineRegisterInfo &MRI, const MachineOperand &Op, int64_t &Imm)
Return true if the operand is a load immediate instruction and sets Imm to the immediate value.
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
bool areMemAccessesTriviallyDisjoint(const MachineInstr &MIa, const MachineInstr &MIb) const override
Wrapper class representing virtual and physical registers.
Definition Register.h:20
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
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.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
LLVM Value Representation.
Definition Value.h:75
CondCode getInverseBranchCondition(CondCode)
unsigned getInverseBranchOpcode(unsigned BCC)
unsigned getBrCond(CondCode CC, unsigned SelectOpc=0)
static constexpr unsigned FPMASK_Negative_Zero
static constexpr unsigned FPMASK_Positive_Subnormal
bool hasEqualFRM(const MachineInstr &MI1, const MachineInstr &MI2)
static constexpr unsigned FPMASK_Positive_Normal
static constexpr unsigned FPMASK_Negative_Subnormal
static constexpr unsigned FPMASK_Negative_Normal
static constexpr unsigned FPMASK_Positive_Infinity
static constexpr unsigned FPMASK_Negative_Infinity
static constexpr unsigned FPMASK_Quiet_NaN
unsigned getRVVMCOpcode(unsigned RVVPseudoOpcode)
unsigned getDestLog2EEW(const MCInstrDesc &Desc, unsigned Log2SEW)
std::optional< unsigned > getVectorLowDemandedScalarBits(unsigned Opcode, unsigned Log2SEW)
std::optional< std::pair< unsigned, unsigned > > isRVVSpillForZvlsseg(unsigned Opcode)
static constexpr unsigned FPMASK_Signaling_NaN
static constexpr unsigned FPMASK_Positive_Zero
bool isRVVSpill(const MachineInstr &MI)
static constexpr int64_t VLMaxSentinel
bool isVLKnownLE(const MachineRegisterInfo &MRI, const MachineOperand &LHS, const MachineOperand &RHS)
Given two VL operands, do we know that LHS <= RHS?
bool isVectorCopy(const TargetRegisterInfo *TRI, const MachineInstr &MI)
Return true if MI is a copy that will be lowered to one or more vmvNr.vs.
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
RISCVMachineCombinerPattern
@ SHXADD_ADD_SLLI_OP2
@ SHXADD_ADD_SLLI_OP1
MachineTraceStrategy
Strategies for selecting traces.
static const MachineMemOperand::Flags MONontemporalBit1
static const MachineMemOperand::Flags MONontemporalBit0
Op::Description Desc
int countr_zero(T Val)
Count number of 0's from the least significant bit to the most stopping at the first 1.
Definition bit.h:204
CombinerObjective
The combiner's goal may differ based on which pattern it is attempting to optimize.
CodeGenOptLevel
Code generation optimization level.
Definition CodeGen.h:227
int isShifted359(T Value, int &Shift)
DWARFExpression::Operation Op
MCRegisterClass TargetRegisterClass
Definition FastISel.h:58
Used to describe addressing mode similar to ExtAddrMode in CodeGenPrepare.
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.