LLVM 20.0.0git
RISCVVectorPeephole.cpp
Go to the documentation of this file.
1//===- RISCVVectorPeephole.cpp - MI Vector Pseudo Peepholes ---------------===//
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 pass performs various vector pseudo peephole optimisations after
10// instruction selection.
11//
12// Currently it converts vmerge.vvm to vmv.v.v
13// PseudoVMERGE_VVM %false, %false, %true, %allonesmask, %vl, %sew
14// ->
15// PseudoVMV_V_V %false, %true, %vl, %sew
16//
17// And masked pseudos to unmasked pseudos
18// PseudoVADD_V_V_MASK %passthru, %a, %b, %allonesmask, %vl, sew, policy
19// ->
20// PseudoVADD_V_V %passthru %a, %b, %vl, sew, policy
21//
22// It also converts AVLs to VLMAX where possible
23// %vl = VLENB * something
24// PseudoVADD_V_V %passthru, %a, %b, %vl, sew, policy
25// ->
26// PseudoVADD_V_V %passthru, %a, %b, -1, sew, policy
27//
28//===----------------------------------------------------------------------===//
29
30#include "RISCV.h"
31#include "RISCVISelDAGToDAG.h"
32#include "RISCVSubtarget.h"
37
38using namespace llvm;
39
40#define DEBUG_TYPE "riscv-vector-peephole"
41
42namespace {
43
44class RISCVVectorPeephole : public MachineFunctionPass {
45public:
46 static char ID;
47 const TargetInstrInfo *TII;
50 const RISCVSubtarget *ST;
51 RISCVVectorPeephole() : MachineFunctionPass(ID) {}
52
53 bool runOnMachineFunction(MachineFunction &MF) override;
56 MachineFunctionProperties::Property::IsSSA);
57 }
58
59 StringRef getPassName() const override {
60 return "RISC-V Vector Peephole Optimization";
61 }
62
63private:
64 bool convertToVLMAX(MachineInstr &MI) const;
65 bool convertToWholeRegister(MachineInstr &MI) const;
66 bool convertToUnmasked(MachineInstr &MI) const;
67 bool convertVMergeToVMv(MachineInstr &MI) const;
68 bool foldVMV_V_V(MachineInstr &MI);
69
70 bool isAllOnesMask(const MachineInstr *MaskDef) const;
71 std::optional<unsigned> getConstant(const MachineOperand &VL) const;
72
73 /// Maps uses of V0 to the corresponding def of V0.
75};
76
77} // namespace
78
79char RISCVVectorPeephole::ID = 0;
80
81INITIALIZE_PASS(RISCVVectorPeephole, DEBUG_TYPE, "RISC-V Fold Masks", false,
82 false)
83
84/// Check if an operand is an immediate or a materialized ADDI $x0, imm.
85std::optional<unsigned>
86RISCVVectorPeephole::getConstant(const MachineOperand &VL) const {
87 if (VL.isImm())
88 return VL.getImm();
89
90 MachineInstr *Def = MRI->getVRegDef(VL.getReg());
91 if (!Def || Def->getOpcode() != RISCV::ADDI ||
92 Def->getOperand(1).getReg() != RISCV::X0)
93 return std::nullopt;
94 return Def->getOperand(2).getImm();
95}
96
97/// Convert AVLs that are known to be VLMAX to the VLMAX sentinel.
98bool RISCVVectorPeephole::convertToVLMAX(MachineInstr &MI) const {
99 if (!RISCVII::hasVLOp(MI.getDesc().TSFlags) ||
100 !RISCVII::hasSEWOp(MI.getDesc().TSFlags))
101 return false;
102
103 auto LMUL = RISCVVType::decodeVLMUL(RISCVII::getLMul(MI.getDesc().TSFlags));
104 // Fixed-point value, denominator=8
105 unsigned LMULFixed = LMUL.second ? (8 / LMUL.first) : 8 * LMUL.first;
106 unsigned Log2SEW = MI.getOperand(RISCVII::getSEWOpNum(MI.getDesc())).getImm();
107 // A Log2SEW of 0 is an operation on mask registers only
108 unsigned SEW = Log2SEW ? 1 << Log2SEW : 8;
109 assert(RISCVVType::isValidSEW(SEW) && "Unexpected SEW");
110 assert(8 * LMULFixed / SEW > 0);
111
112 // If the exact VLEN is known then we know VLMAX, check if the AVL == VLMAX.
113 MachineOperand &VL = MI.getOperand(RISCVII::getVLOpNum(MI.getDesc()));
114 if (auto VLen = ST->getRealVLen(), AVL = getConstant(VL);
115 VLen && AVL && (*VLen * LMULFixed) / SEW == *AVL * 8) {
117 return true;
118 }
119
120 // If an AVL is a VLENB that's possibly scaled to be equal to VLMAX, convert
121 // it to the VLMAX sentinel value.
122 if (!VL.isReg())
123 return false;
124 MachineInstr *Def = MRI->getVRegDef(VL.getReg());
125 if (!Def)
126 return false;
127
128 // Fixed-point value, denominator=8
129 uint64_t ScaleFixed = 8;
130 // Check if the VLENB was potentially scaled with slli/srli
131 if (Def->getOpcode() == RISCV::SLLI) {
132 assert(Def->getOperand(2).getImm() < 64);
133 ScaleFixed <<= Def->getOperand(2).getImm();
134 Def = MRI->getVRegDef(Def->getOperand(1).getReg());
135 } else if (Def->getOpcode() == RISCV::SRLI) {
136 assert(Def->getOperand(2).getImm() < 64);
137 ScaleFixed >>= Def->getOperand(2).getImm();
138 Def = MRI->getVRegDef(Def->getOperand(1).getReg());
139 }
140
141 if (!Def || Def->getOpcode() != RISCV::PseudoReadVLENB)
142 return false;
143
144 // AVL = (VLENB * Scale)
145 //
146 // VLMAX = (VLENB * 8 * LMUL) / SEW
147 //
148 // AVL == VLMAX
149 // -> VLENB * Scale == (VLENB * 8 * LMUL) / SEW
150 // -> Scale == (8 * LMUL) / SEW
151 if (ScaleFixed != 8 * LMULFixed / SEW)
152 return false;
153
155
156 return true;
157}
158
159bool RISCVVectorPeephole::isAllOnesMask(const MachineInstr *MaskDef) const {
160 assert(MaskDef && MaskDef->isCopy() &&
161 MaskDef->getOperand(0).getReg() == RISCV::V0);
162 Register SrcReg = TRI->lookThruCopyLike(MaskDef->getOperand(1).getReg(), MRI);
163 if (!SrcReg.isVirtual())
164 return false;
165 MaskDef = MRI->getVRegDef(SrcReg);
166 if (!MaskDef)
167 return false;
168
169 // TODO: Check that the VMSET is the expected bitwidth? The pseudo has
170 // undefined behaviour if it's the wrong bitwidth, so we could choose to
171 // assume that it's all-ones? Same applies to its VL.
172 switch (MaskDef->getOpcode()) {
173 case RISCV::PseudoVMSET_M_B1:
174 case RISCV::PseudoVMSET_M_B2:
175 case RISCV::PseudoVMSET_M_B4:
176 case RISCV::PseudoVMSET_M_B8:
177 case RISCV::PseudoVMSET_M_B16:
178 case RISCV::PseudoVMSET_M_B32:
179 case RISCV::PseudoVMSET_M_B64:
180 return true;
181 default:
182 return false;
183 }
184}
185
186/// Convert unit strided unmasked loads and stores to whole-register equivalents
187/// to avoid the dependency on $vl and $vtype.
188///
189/// %x = PseudoVLE8_V_M1 %passthru, %ptr, %vlmax, policy
190/// PseudoVSE8_V_M1 %v, %ptr, %vlmax
191///
192/// ->
193///
194/// %x = VL1RE8_V %ptr
195/// VS1R_V %v, %ptr
196bool RISCVVectorPeephole::convertToWholeRegister(MachineInstr &MI) const {
197#define CASE_WHOLE_REGISTER_LMUL_SEW(lmul, sew) \
198 case RISCV::PseudoVLE##sew##_V_M##lmul: \
199 NewOpc = RISCV::VL##lmul##RE##sew##_V; \
200 break; \
201 case RISCV::PseudoVSE##sew##_V_M##lmul: \
202 NewOpc = RISCV::VS##lmul##R_V; \
203 break;
204#define CASE_WHOLE_REGISTER_LMUL(lmul) \
205 CASE_WHOLE_REGISTER_LMUL_SEW(lmul, 8) \
206 CASE_WHOLE_REGISTER_LMUL_SEW(lmul, 16) \
207 CASE_WHOLE_REGISTER_LMUL_SEW(lmul, 32) \
208 CASE_WHOLE_REGISTER_LMUL_SEW(lmul, 64)
209
210 unsigned NewOpc;
211 switch (MI.getOpcode()) {
216 default:
217 return false;
218 }
219
220 MachineOperand &VLOp = MI.getOperand(RISCVII::getVLOpNum(MI.getDesc()));
221 if (!VLOp.isImm() || VLOp.getImm() != RISCV::VLMaxSentinel)
222 return false;
223
224 // Whole register instructions aren't pseudos so they don't have
225 // policy/SEW/AVL ops, and they don't have passthrus.
226 if (RISCVII::hasVecPolicyOp(MI.getDesc().TSFlags))
227 MI.removeOperand(RISCVII::getVecPolicyOpNum(MI.getDesc()));
228 MI.removeOperand(RISCVII::getSEWOpNum(MI.getDesc()));
229 MI.removeOperand(RISCVII::getVLOpNum(MI.getDesc()));
230 if (RISCVII::isFirstDefTiedToFirstUse(MI.getDesc()))
231 MI.removeOperand(1);
232
233 MI.setDesc(TII->get(NewOpc));
234
235 return true;
236}
237
238// Transform (VMERGE_VVM_<LMUL> false, false, true, allones, vl, sew) to
239// (VMV_V_V_<LMUL> false, true, vl, sew). It may decrease uses of VMSET.
240bool RISCVVectorPeephole::convertVMergeToVMv(MachineInstr &MI) const {
241#define CASE_VMERGE_TO_VMV(lmul) \
242 case RISCV::PseudoVMERGE_VVM_##lmul: \
243 NewOpc = RISCV::PseudoVMV_V_V_##lmul; \
244 break;
245 unsigned NewOpc;
246 switch (MI.getOpcode()) {
247 default:
248 return false;
256 }
257
258 Register PassthruReg = MI.getOperand(1).getReg();
259 Register FalseReg = MI.getOperand(2).getReg();
260 // Check passthru == false (or passthru == undef)
261 if (PassthruReg != RISCV::NoRegister &&
262 TRI->lookThruCopyLike(PassthruReg, MRI) !=
263 TRI->lookThruCopyLike(FalseReg, MRI))
264 return false;
265
266 assert(MI.getOperand(4).isReg() && MI.getOperand(4).getReg() == RISCV::V0);
267 if (!isAllOnesMask(V0Defs.lookup(&MI)))
268 return false;
269
270 MI.setDesc(TII->get(NewOpc));
271 MI.removeOperand(1); // Passthru operand
272 MI.tieOperands(0, 1); // Tie false to dest
273 MI.removeOperand(3); // Mask operand
274 MI.addOperand(
276
277 // vmv.v.v doesn't have a mask operand, so we may be able to inflate the
278 // register class for the destination and passthru operands e.g. VRNoV0 -> VR
279 MRI->recomputeRegClass(MI.getOperand(0).getReg());
280 MRI->recomputeRegClass(MI.getOperand(1).getReg());
281 return true;
282}
283
284bool RISCVVectorPeephole::convertToUnmasked(MachineInstr &MI) const {
286 RISCV::getMaskedPseudoInfo(MI.getOpcode());
287 if (!I)
288 return false;
289
290 if (!isAllOnesMask(V0Defs.lookup(&MI)))
291 return false;
292
293 // There are two classes of pseudos in the table - compares and
294 // everything else. See the comment on RISCVMaskedPseudo for details.
295 const unsigned Opc = I->UnmaskedPseudo;
296 const MCInstrDesc &MCID = TII->get(Opc);
297 [[maybe_unused]] const bool HasPolicyOp =
299 const bool HasPassthru = RISCVII::isFirstDefTiedToFirstUse(MCID);
300#ifndef NDEBUG
301 const MCInstrDesc &MaskedMCID = TII->get(MI.getOpcode());
304 "Masked and unmasked pseudos are inconsistent");
305 assert(HasPolicyOp == HasPassthru && "Unexpected pseudo structure");
306#endif
307 (void)HasPolicyOp;
308
309 MI.setDesc(MCID);
310
311 // TODO: Increment all MaskOpIdxs in tablegen by num of explicit defs?
312 unsigned MaskOpIdx = I->MaskOpIdx + MI.getNumExplicitDefs();
313 MI.removeOperand(MaskOpIdx);
314
315 // The unmasked pseudo will no longer be constrained to the vrnov0 reg class,
316 // so try and relax it to vr.
317 MRI->recomputeRegClass(MI.getOperand(0).getReg());
318 unsigned PassthruOpIdx = MI.getNumExplicitDefs();
319 if (HasPassthru) {
320 if (MI.getOperand(PassthruOpIdx).getReg() != RISCV::NoRegister)
321 MRI->recomputeRegClass(MI.getOperand(PassthruOpIdx).getReg());
322 } else
323 MI.removeOperand(PassthruOpIdx);
324
325 return true;
326}
327
328/// Given two VL operands, returns the one known to be the smallest or nullptr
329/// if unknown.
330static const MachineOperand *getKnownMinVL(const MachineOperand *LHS,
331 const MachineOperand *RHS) {
332 if (LHS->isReg() && RHS->isReg() && LHS->getReg().isVirtual() &&
333 LHS->getReg() == RHS->getReg())
334 return LHS;
335 if (LHS->isImm() && LHS->getImm() == RISCV::VLMaxSentinel)
336 return RHS;
337 if (RHS->isImm() && RHS->getImm() == RISCV::VLMaxSentinel)
338 return LHS;
339 if (!LHS->isImm() || !RHS->isImm())
340 return nullptr;
341 return LHS->getImm() <= RHS->getImm() ? LHS : RHS;
342}
343
344/// Check if it's safe to move From down to To, checking that no physical
345/// registers are clobbered.
346static bool isSafeToMove(const MachineInstr &From, const MachineInstr &To) {
347 assert(From.getParent() == To.getParent() && !From.hasImplicitDef());
348 SmallVector<Register> PhysUses;
349 for (const MachineOperand &MO : From.all_uses())
350 if (MO.getReg().isPhysical())
351 PhysUses.push_back(MO.getReg());
352 bool SawStore = false;
353 for (auto II = From.getIterator(); II != To.getIterator(); II++) {
354 for (Register PhysReg : PhysUses)
355 if (II->definesRegister(PhysReg, nullptr))
356 return false;
357 if (II->mayStore()) {
358 SawStore = true;
359 break;
360 }
361 }
362 return From.isSafeToMove(SawStore);
363}
364
365static unsigned getSEWLMULRatio(const MachineInstr &MI) {
366 RISCVII::VLMUL LMUL = RISCVII::getLMul(MI.getDesc().TSFlags);
367 unsigned Log2SEW = MI.getOperand(RISCVII::getSEWOpNum(MI.getDesc())).getImm();
368 return RISCVVType::getSEWLMULRatio(1 << Log2SEW, LMUL);
369}
370
371/// If a PseudoVMV_V_V is the only user of its input, fold its passthru and VL
372/// into it.
373///
374/// %x = PseudoVADD_V_V_M1 %passthru, %a, %b, %vl1, sew, policy
375/// %y = PseudoVMV_V_V_M1 %passthru, %x, %vl2, sew, policy
376///
377/// ->
378///
379/// %y = PseudoVADD_V_V_M1 %passthru, %a, %b, min(vl1, vl2), sew, policy
380bool RISCVVectorPeephole::foldVMV_V_V(MachineInstr &MI) {
381 if (RISCV::getRVVMCOpcode(MI.getOpcode()) != RISCV::VMV_V_V)
382 return false;
383
384 MachineOperand &Passthru = MI.getOperand(1);
385
386 if (!MRI->hasOneUse(MI.getOperand(2).getReg()))
387 return false;
388
389 MachineInstr *Src = MRI->getVRegDef(MI.getOperand(2).getReg());
390 if (!Src || Src->hasUnmodeledSideEffects() ||
391 Src->getParent() != MI.getParent() || Src->getNumDefs() != 1 ||
392 !RISCVII::isFirstDefTiedToFirstUse(Src->getDesc()) ||
393 !RISCVII::hasVLOp(Src->getDesc().TSFlags) ||
394 !RISCVII::hasVecPolicyOp(Src->getDesc().TSFlags))
395 return false;
396
397 // Src needs to have the same VLMAX as MI
398 if (getSEWLMULRatio(MI) != getSEWLMULRatio(*Src))
399 return false;
400
401 // Src needs to have the same passthru as VMV_V_V
402 MachineOperand &SrcPassthru = Src->getOperand(1);
403 if (SrcPassthru.getReg() != RISCV::NoRegister &&
404 SrcPassthru.getReg() != Passthru.getReg())
405 return false;
406
407 // Because Src and MI have the same passthru, we can use either AVL as long as
408 // it's the smaller of the two.
409 //
410 // (src pt, ..., vl=5) x x x x x|. . .
411 // (vmv.v.v pt, src, vl=3) x x x|. . . . .
412 // ->
413 // (src pt, ..., vl=3) x x x|. . . . .
414 //
415 // (src pt, ..., vl=3) x x x|. . . . .
416 // (vmv.v.v pt, src, vl=6) x x x . . .|. .
417 // ->
418 // (src pt, ..., vl=3) x x x|. . . . .
419 MachineOperand &SrcVL = Src->getOperand(RISCVII::getVLOpNum(Src->getDesc()));
420 const MachineOperand *MinVL = getKnownMinVL(&MI.getOperand(3), &SrcVL);
421 if (!MinVL)
422 return false;
423
424 bool VLChanged = !MinVL->isIdenticalTo(SrcVL);
425 bool ActiveElementsAffectResult = RISCVII::activeElementsAffectResult(
426 TII->get(RISCV::getRVVMCOpcode(Src->getOpcode())).TSFlags);
427
428 if (VLChanged && (ActiveElementsAffectResult || Src->mayRaiseFPException()))
429 return false;
430
431 // If Src ends up using MI's passthru/VL, move it so it can access it.
432 // TODO: We don't need to do this if they already dominate Src.
433 if (!SrcVL.isIdenticalTo(*MinVL) || !SrcPassthru.isIdenticalTo(Passthru)) {
434 if (!isSafeToMove(*Src, MI))
435 return false;
436 Src->moveBefore(&MI);
437 }
438
439 if (SrcPassthru.getReg() != Passthru.getReg()) {
440 SrcPassthru.setReg(Passthru.getReg());
441 // If Src is masked then its passthru needs to be in VRNoV0.
442 if (Passthru.getReg() != RISCV::NoRegister)
443 MRI->constrainRegClass(Passthru.getReg(),
444 TII->getRegClass(Src->getDesc(), 1, TRI,
445 *Src->getParent()->getParent()));
446 }
447
448 if (MinVL->isImm())
449 SrcVL.ChangeToImmediate(MinVL->getImm());
450 else if (MinVL->isReg())
451 SrcVL.ChangeToRegister(MinVL->getReg(), false);
452
453 // Use a conservative tu,mu policy, RISCVInsertVSETVLI will relax it if
454 // passthru is undef.
455 Src->getOperand(RISCVII::getVecPolicyOpNum(Src->getDesc()))
457
458 MRI->replaceRegWith(MI.getOperand(0).getReg(), Src->getOperand(0).getReg());
459 MI.eraseFromParent();
460 V0Defs.erase(&MI);
461
462 return true;
463}
464
465bool RISCVVectorPeephole::runOnMachineFunction(MachineFunction &MF) {
466 if (skipFunction(MF.getFunction()))
467 return false;
468
469 // Skip if the vector extension is not enabled.
471 if (!ST->hasVInstructions())
472 return false;
473
474 TII = ST->getInstrInfo();
475 MRI = &MF.getRegInfo();
476 TRI = MRI->getTargetRegisterInfo();
477
478 bool Changed = false;
479
480 // Masked pseudos coming out of isel will have their mask operand in the form:
481 //
482 // $v0:vr = COPY %mask:vr
483 // %x:vr = Pseudo_MASK %a:vr, %b:br, $v0:vr
484 //
485 // Because $v0 isn't in SSA, keep track of its definition at each use so we
486 // can check mask operands.
487 for (const MachineBasicBlock &MBB : MF) {
488 const MachineInstr *CurrentV0Def = nullptr;
489 for (const MachineInstr &MI : MBB) {
490 if (MI.readsRegister(RISCV::V0, TRI))
491 V0Defs[&MI] = CurrentV0Def;
492
493 if (MI.definesRegister(RISCV::V0, TRI))
494 CurrentV0Def = &MI;
495 }
496 }
497
498 for (MachineBasicBlock &MBB : MF) {
500 Changed |= convertToVLMAX(MI);
501 Changed |= convertToUnmasked(MI);
502 Changed |= convertToWholeRegister(MI);
503 Changed |= convertVMergeToVMv(MI);
504 Changed |= foldVMV_V_V(MI);
505 }
506 }
507
508 return Changed;
509}
510
512 return new RISCVVectorPeephole();
513}
unsigned const MachineRegisterInfo * MRI
aarch64 promote const
MachineBasicBlock & MBB
static uint64_t getConstant(const Value *IndexValue)
basic Basic Alias true
BlockVerifier::State From
const HexagonInstrInfo * TII
IRTranslator LLVM IR MI
#define I(x, y, z)
Definition: MD5.cpp:58
unsigned const TargetRegisterInfo * TRI
uint64_t IntrinsicInst * II
if(PassOpts->AAPipeline)
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:38
static unsigned getSEWLMULRatio(const MachineInstr &MI)
#define CASE_WHOLE_REGISTER_LMUL(lmul)
#define CASE_VMERGE_TO_VMV(lmul)
static bool isSafeToMove(const MachineInstr &From, const MachineInstr &To)
Check if it's safe to move From down to To, checking that no physical registers are clobbered.
#define DEBUG_TYPE
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static bool isImm(const MachineOperand &MO, MachineRegisterInfo *MRI)
Value * RHS
Value * LHS
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:310
Describe properties that are true of each instruction in the target description file.
Definition: MCInstrDesc.h:198
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
virtual bool runOnMachineFunction(MachineFunction &MF)=0
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
virtual MachineFunctionProperties getRequiredProperties() const
Properties which a MachineFunction may have at a given point in time.
MachineFunctionProperties & set(Property P)
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Function & getFunction()
Return the LLVM function that this machine code represents.
Representation of each machine instruction.
Definition: MachineInstr.h:69
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
Definition: MachineInstr.h:569
bool isCopy() const
const MachineBasicBlock * getParent() const
Definition: MachineInstr.h:346
const MachineOperand & getOperand(unsigned i) const
Definition: MachineInstr.h:579
MachineOperand class - Representation of each machine instruction operand.
int64_t getImm() const
bool isReg() const
isReg - Tests if this is a MO_Register operand.
void setReg(Register Reg)
Change the register this operand corresponds to.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
void ChangeToImmediate(int64_t ImmVal, unsigned TargetFlags=0)
ChangeToImmediate - Replace this operand with a new immediate operand of the specified value.
void ChangeToRegister(Register Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isDebug=false)
ChangeToRegister - Replace this operand with a new register operand of the specified value.
static MachineOperand CreateImm(int64_t Val)
Register getReg() const
getReg - Returns the register number.
bool isIdenticalTo(const MachineOperand &Other) const
Returns true if this operand is identical to the specified operand except for liveness related flags ...
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
Definition: Pass.cpp:81
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
constexpr bool isVirtual() const
Return true if the specified register number is in the virtual register namespace.
Definition: Register.h:91
void push_back(const T &Elt)
Definition: SmallVector.h:426
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1209
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
TargetInstrInfo - Interface to description of machine instruction set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
self_iterator getIterator()
Definition: ilist_node.h:132
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
static unsigned getVecPolicyOpNum(const MCInstrDesc &Desc)
@ TAIL_UNDISTURBED_MASK_UNDISTURBED
static unsigned getVLOpNum(const MCInstrDesc &Desc)
static VLMUL getLMul(uint64_t TSFlags)
static bool hasVLOp(uint64_t TSFlags)
static bool hasVecPolicyOp(uint64_t TSFlags)
static bool activeElementsAffectResult(uint64_t TSFlags)
static unsigned getSEWOpNum(const MCInstrDesc &Desc)
static bool hasSEWOp(uint64_t TSFlags)
static bool isFirstDefTiedToFirstUse(const MCInstrDesc &Desc)
std::pair< unsigned, bool > decodeVLMUL(RISCVII::VLMUL VLMUL)
unsigned getSEWLMULRatio(unsigned SEW, RISCVII::VLMUL VLMul)
static bool isValidSEW(unsigned SEW)
unsigned getRVVMCOpcode(unsigned RVVPseudoOpcode)
static constexpr int64_t VLMaxSentinel
NodeAddr< DefNode * > Def
Definition: RDFGraph.h:384
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
Definition: STLExtras.h:656
unsigned M1(unsigned Val)
Definition: VE.h:376
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
FunctionPass * createRISCVVectorPeepholePass()
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:858