LLVM 24.0.0git
RISCVMoveMerger.cpp
Go to the documentation of this file.
1//===-- RISCVMoveMerger.cpp - RISC-V move merge pass ----------------------===//
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 a pass that performs move related peephole optimizations
10// as Zcmp has specified. This pass should be run after register allocation.
11//
12// This pass also supports Xqccmp, which has identical instructions.
13//
14//===----------------------------------------------------------------------===//
15
16#include "RISCV.h"
17#include "RISCVInstrInfo.h"
18#include "RISCVSubtarget.h"
22#include "llvm/IR/Analysis.h"
23#include "llvm/Pass.h"
24
25using namespace llvm;
26
27#define RISCV_MOVE_MERGE_NAME "RISC-V Zcmp move merging pass"
28
29namespace {
30class RISCVMoveMergeLegacy : public MachineFunctionPass {
31public:
32 static char ID;
33
34 RISCVMoveMergeLegacy() : MachineFunctionPass(ID) {}
35 bool runOnMachineFunction(MachineFunction &Fn) override;
36
37 StringRef getPassName() const override { return RISCV_MOVE_MERGE_NAME; }
38
39 void getAnalysisUsage(AnalysisUsage &AU) const override {
40 AU.setPreservesCFG();
42 }
43};
44
45class RISCVMoveMergeImpl {
46 const RISCVSubtarget *ST;
47 const RISCVInstrInfo *TII;
49
50 // Track which register units have been modified and used.
51 LiveRegUnits ModifiedRegUnits, UsedRegUnits;
52
53 bool isGPRPairCopyCandidate(const DestSourcePair &RegPair, bool EvenRegPair);
54
55 bool isCandidateToMergeMVA01S(const DestSourcePair &RegPair);
56 bool isCandidateToMergeMVSA01(const DestSourcePair &RegPair);
57
58 bool isPLIPairCandidate(const MachineInstr &MI, bool EvenRegPair);
59
60 // Merge the two instructions indicated into a single pair instruction.
62 mergeGPRPairInsns(MachineBasicBlock::iterator I,
63 MachineBasicBlock::iterator Paired, bool RegPairIsEven);
65 mergePairedInsns(MachineBasicBlock::iterator I,
69 bool RegPairIsEven);
70
72 findMatchingGPRPairCopy(MachineBasicBlock::iterator &MBBI, bool EvenRegPair,
73 const DestSourcePair &RegPair);
74 // Look for C.MV instruction that can be combined with
75 // the given instruction into CM.MVA01S or CM.MVSA01. Return the matching
76 // instruction if one exists.
78 findMatchingSACopy(MachineBasicBlock::iterator &MBBI, bool MoveFromSToA,
79 const DestSourcePair &RegPair);
81 bool EvenRegPair);
82 bool mergeMovePairs(MachineBasicBlock &MBB);
83
84public:
85 bool runOnMachineFunction(MachineFunction &MF);
86};
87
88char RISCVMoveMergeLegacy::ID = 0;
89
90} // end of anonymous namespace
91
92INITIALIZE_PASS(RISCVMoveMergeLegacy, "riscv-move-merge", RISCV_MOVE_MERGE_NAME,
93 false, false)
94
95static unsigned getCM_MVOpcode(const RISCVSubtarget &ST, bool MoveFromSToA) {
96 if (ST.hasStdExtZcmp())
97 return MoveFromSToA ? RISCV::CM_MVA01S : RISCV::CM_MVSA01;
98
99 if (ST.hasVendorXqccmp())
100 return MoveFromSToA ? RISCV::QC_CM_MVA01S : RISCV::QC_CM_MVSA01;
101
102 llvm_unreachable("Unhandled subtarget with paired move.");
103}
104
105// Returns 0 if Opc has no paired form.
106static unsigned getPairedPLIOpcode(unsigned Opc) {
107 switch (Opc) {
108 case RISCV::PLI_B:
109 return RISCV::PLI_DB;
110 case RISCV::PLI_H:
111 return RISCV::PLI_DH;
112 case RISCV::PLUI_H:
113 return RISCV::PLUI_DH;
114 default:
115 return 0;
116 }
117}
118
119bool RISCVMoveMergeImpl::isGPRPairCopyCandidate(const DestSourcePair &RegPair,
120 bool EvenRegPair) {
121 Register Destination = RegPair.Destination->getReg();
122 Register Source = RegPair.Source->getReg();
123
124 if (Source == Destination)
125 return false;
126
127 if ((!ST->hasStdExtZdinx() && !ST->hasStdExtP()) || ST->is64Bit())
128 return false;
129
130 unsigned SubIdx = EvenRegPair ? RISCV::sub_gpr_even : RISCV::sub_gpr_odd;
131
132 Register SrcPair =
133 TRI->getMatchingSuperReg(Source, SubIdx, &RISCV::GPRPairRegClass);
134 Register DestPair =
135 TRI->getMatchingSuperReg(Destination, SubIdx, &RISCV::GPRPairRegClass);
136
137 return SrcPair.isValid() && DestPair.isValid();
138}
139
140// Check if registers meet CM.MVA01S constraints.
141bool RISCVMoveMergeImpl::isCandidateToMergeMVA01S(
142 const DestSourcePair &RegPair) {
143 Register Destination = RegPair.Destination->getReg();
144 Register Source = RegPair.Source->getReg();
145 // If destination is not a0 or a1.
146 if ((ST->hasStdExtZcmp() || ST->hasVendorXqccmp()) &&
147 (Destination == RISCV::X10 || Destination == RISCV::X11) &&
148 RISCV::GPRS07RegClass.contains(Source))
149 return true;
150 return false;
151}
152
153// Check if registers meet CM.MVSA01 constraints.
154bool RISCVMoveMergeImpl::isCandidateToMergeMVSA01(
155 const DestSourcePair &RegPair) {
156 Register Destination = RegPair.Destination->getReg();
157 Register Source = RegPair.Source->getReg();
158 // If Source is s0 - s7.
159 if ((ST->hasStdExtZcmp() || ST->hasVendorXqccmp()) &&
160 (Source == RISCV::X10 || Source == RISCV::X11) &&
161 RISCV::GPRS07RegClass.contains(Destination))
162 return true;
163 return false;
164}
165
166// Check if MI is a single-reg pli/plui whose destination is a half of a
167// GPRPair.
168bool RISCVMoveMergeImpl::isPLIPairCandidate(const MachineInstr &MI,
169 bool EvenRegPair) {
170 if (!ST->hasStdExtP() || ST->is64Bit())
171 return false;
172 if (!getPairedPLIOpcode(MI.getOpcode()))
173 return false;
174 unsigned SubIdx = EvenRegPair ? RISCV::sub_gpr_even : RISCV::sub_gpr_odd;
175 return TRI
176 ->getMatchingSuperReg(MI.getOperand(0).getReg(), SubIdx,
177 &RISCV::GPRPairRegClass)
178 .isValid();
179}
180
182RISCVMoveMergeImpl::mergeGPRPairInsns(MachineBasicBlock::iterator I,
184 bool RegPairIsEven) {
185 MachineBasicBlock::iterator E = I->getParent()->end();
187 DestSourcePair FirstPair = *TII->isCopyInstrImpl(*I);
188 DestSourcePair SecondPair = *TII->isCopyInstrImpl(*Paired);
189
190 if (NextI == Paired)
191 NextI = next_nodbg(NextI, E);
192 DebugLoc DL = I->getDebugLoc();
193
194 // Make a copy of the second instruction to update the kill
195 // flag.
196 MachineOperand PairedSource = *SecondPair.Source;
197
198 for (auto It = std::next(I); It != Paired && PairedSource.isKill(); ++It)
199 if (It->readsRegister(PairedSource.getReg(), TRI))
200 PairedSource.setIsKill(false);
201
202 unsigned GPRPairIdx =
203 RegPairIsEven ? RISCV::sub_gpr_even : RISCV::sub_gpr_odd;
204 MCRegister SrcReg = TRI->getMatchingSuperReg(
205 FirstPair.Source->getReg(), GPRPairIdx, &RISCV::GPRPairRegClass);
206 MCRegister DestReg = TRI->getMatchingSuperReg(
207 FirstPair.Destination->getReg(), GPRPairIdx, &RISCV::GPRPairRegClass);
208 bool KillSrc = PairedSource.isKill() && FirstPair.Source->isKill();
209
210 TII->copyPhysReg(*I->getParent(), I, DL, DestReg, SrcReg, KillSrc);
211
212 I->eraseFromParent();
213 Paired->eraseFromParent();
214 return NextI;
215}
216
218RISCVMoveMergeImpl::mergePairedInsns(MachineBasicBlock::iterator I,
220 bool MoveFromSToA) {
221 const MachineOperand *Sreg1, *Sreg2;
222 MachineBasicBlock::iterator E = I->getParent()->end();
224 DestSourcePair FirstPair = *TII->isCopyInstrImpl(*I);
225 DestSourcePair PairedRegs = *TII->isCopyInstrImpl(*Paired);
226
227 if (NextI == Paired)
228 NextI = next_nodbg(NextI, E);
229 DebugLoc DL = I->getDebugLoc();
230
231 // Make a copy so we can update the kill flag in the MoveFromSToA case. The
232 // copied operand needs to be scoped outside the if since we make a pointer
233 // to it.
234 MachineOperand PairedSource = *PairedRegs.Source;
235
236 // The order of S-reg depends on which instruction holds A0, instead of
237 // the order of register pair.
238 // e,g.
239 // mv a1, s1
240 // mv a0, s2 => cm.mva01s s2,s1
241 //
242 // mv a0, s2
243 // mv a1, s1 => cm.mva01s s2,s1
244 unsigned Opcode = getCM_MVOpcode(*ST, MoveFromSToA);
245 if (MoveFromSToA) {
246 // We are moving one of the copies earlier so its kill flag may become
247 // invalid. Clear the copied kill flag if there are any reads of the
248 // register between the new location and the old location.
249 for (auto It = std::next(I); It != Paired && PairedSource.isKill(); ++It)
250 if (It->readsRegister(PairedSource.getReg(), TRI))
251 PairedSource.setIsKill(false);
252
253 Sreg1 = FirstPair.Source;
254 Sreg2 = &PairedSource;
255 if (FirstPair.Destination->getReg() != RISCV::X10)
256 std::swap(Sreg1, Sreg2);
257 } else {
258 Sreg1 = FirstPair.Destination;
259 Sreg2 = PairedRegs.Destination;
260 if (FirstPair.Source->getReg() != RISCV::X10)
261 std::swap(Sreg1, Sreg2);
262 }
263
264 BuildMI(*I->getParent(), I, DL, TII->get(Opcode)).add(*Sreg1).add(*Sreg2);
265
267 Paired->eraseFromParent();
268 return NextI;
269}
270
272RISCVMoveMergeImpl::mergePLIPair(MachineBasicBlock::iterator I,
274 bool RegPairIsEven) {
275 MachineBasicBlock::iterator E = I->getParent()->end();
277
278 if (NextI == Paired)
279 NextI = next_nodbg(NextI, E);
280 DebugLoc DL = I->getDebugLoc();
281
282 unsigned Opcode = getPairedPLIOpcode(I->getOpcode());
283 unsigned GPRPairIdx =
284 RegPairIsEven ? RISCV::sub_gpr_even : RISCV::sub_gpr_odd;
285 Register DestReg = TRI->getMatchingSuperReg(
286 I->getOperand(0).getReg(), GPRPairIdx, &RISCV::GPRPairRegClass);
287
288 BuildMI(*I->getParent(), I, DL, TII->get(Opcode), DestReg)
289 .addImm(I->getOperand(1).getImm());
290
292 Paired->eraseFromParent();
293 return NextI;
294}
295
297RISCVMoveMergeImpl::findMatchingGPRPairCopy(MachineBasicBlock::iterator &MBBI,
298 bool EvenRegPair,
299 const DestSourcePair &RegPair) {
301 ModifiedRegUnits.clear();
302 UsedRegUnits.clear();
303 unsigned RegPairIdx = EvenRegPair ? RISCV::sub_gpr_even : RISCV::sub_gpr_odd;
304 unsigned SecondPairIdx =
305 !EvenRegPair ? RISCV::sub_gpr_even : RISCV::sub_gpr_odd;
306
307 // Get the expected source/destination registers of the matching lane.
308 Register SrcGPRPair = TRI->getMatchingSuperReg(
309 RegPair.Source->getReg(), RegPairIdx, &RISCV::GPRPairRegClass);
310 Register DestGPRPair = TRI->getMatchingSuperReg(
311 RegPair.Destination->getReg(), RegPairIdx, &RISCV::GPRPairRegClass);
312
313 if (!SrcGPRPair.isValid() || !DestGPRPair.isValid())
314 return E;
315
316 Register ExpectedSourceReg = TRI->getSubReg(SrcGPRPair, SecondPairIdx);
317 Register ExpectedDestReg = TRI->getSubReg(DestGPRPair, SecondPairIdx);
318
319 if (!ExpectedSourceReg.isValid() || !ExpectedDestReg.isValid())
320 return E;
321
323 I = next_nodbg(I, E)) {
324
325 MachineInstr &MI = *I;
326
327 if (auto SecondPair = TII->isCopyInstrImpl(MI)) {
328 Register SourceReg = SecondPair->Source->getReg();
329 Register DestReg = SecondPair->Destination->getReg();
330
331 if (RegPair.Destination->getReg() == DestReg ||
332 RegPair.Source->getReg() == SourceReg)
333 return E;
334
335 // Check if the second pair's registers match the other lane of the
336 // GPRPairs.
337 if (SourceReg == ExpectedSourceReg && DestReg == ExpectedDestReg)
338 return I;
339 }
340 // Update modified / used register units.
341 LiveRegUnits::accumulateUsedDefed(MI, ModifiedRegUnits, UsedRegUnits, TRI);
342 // Once expected lane registers are clobbered/read in-between, we can stop
343 // scanning since the pair cannot be legally merged anymore.
344 if (!ModifiedRegUnits.available(ExpectedDestReg) ||
345 !UsedRegUnits.available(ExpectedDestReg) ||
346 !ModifiedRegUnits.available(ExpectedSourceReg))
347 return E;
348 }
349 return E;
350}
351
353RISCVMoveMergeImpl::findMatchingSACopy(MachineBasicBlock::iterator &MBBI,
354 bool MoveFromSToA,
355 const DestSourcePair &RegPair) {
357
358 // Track which register units have been modified and used between the first
359 // insn and the second insn.
360 ModifiedRegUnits.clear();
361 UsedRegUnits.clear();
362
364 I = next_nodbg(I, E)) {
365
366 MachineInstr &MI = *I;
367
368 if (auto SecondPair = TII->isCopyInstrImpl(MI)) {
369 Register SourceReg = SecondPair->Source->getReg();
370 Register DestReg = SecondPair->Destination->getReg();
371
372 bool IsCandidate = MoveFromSToA ? isCandidateToMergeMVA01S(*SecondPair)
373 : isCandidateToMergeMVSA01(*SecondPair);
374 if (IsCandidate) {
375 // Second destination must be different.
376 if (RegPair.Destination->getReg() == DestReg)
377 return E;
378
379 // For AtoS the source must also be different.
380 if (!MoveFromSToA && RegPair.Source->getReg() == SourceReg)
381 return E;
382
383 // If paired destination register was modified or used, the source reg
384 // was modified, there is no possibility of finding matching
385 // instruction so exit early.
386 if (!ModifiedRegUnits.available(DestReg) ||
387 !UsedRegUnits.available(DestReg) ||
388 !ModifiedRegUnits.available(SourceReg))
389 return E;
390
391 return I;
392 }
393 }
394 // Update modified / used register units.
395 LiveRegUnits::accumulateUsedDefed(MI, ModifiedRegUnits, UsedRegUnits, TRI);
396 }
397 return E;
398}
399
400// Look for a same-opcode pli/plui writing the other lane of the same GPRPair
401// with the same immediate. Return the matching instruction if one exists.
403RISCVMoveMergeImpl::findMatchingPLI(MachineBasicBlock::iterator &MBBI,
404 bool EvenRegPair) {
406 ModifiedRegUnits.clear();
407 UsedRegUnits.clear();
408 unsigned Opc = MBBI->getOpcode();
409 Register FirstDestReg = MBBI->getOperand(0).getReg();
410 int64_t FirstImm = MBBI->getOperand(1).getImm();
411 unsigned RegPairIdx = EvenRegPair ? RISCV::sub_gpr_even : RISCV::sub_gpr_odd;
412 unsigned SecondPairIdx =
413 !EvenRegPair ? RISCV::sub_gpr_even : RISCV::sub_gpr_odd;
414
415 // Get the expected destination register of the matching lane.
416 Register DestGPRPair = TRI->getMatchingSuperReg(FirstDestReg, RegPairIdx,
417 &RISCV::GPRPairRegClass);
418 assert(DestGPRPair.isValid());
419 Register ExpectedDestReg = TRI->getSubReg(DestGPRPair, SecondPairIdx);
420 assert(ExpectedDestReg.isValid());
421
423 I = next_nodbg(I, E)) {
424
425 MachineInstr &MI = *I;
426
427 if (MI.getOpcode() == Opc) {
428 Register DestReg = MI.getOperand(0).getReg();
429 int64_t Imm = MI.getOperand(1).getImm();
430
431 if (FirstDestReg == DestReg)
432 return E;
433
434 // Check if the second PLI matches the other lane and immediate.
435 if (DestReg == ExpectedDestReg && Imm == FirstImm)
436 return I;
437 }
438 // Update modified / used register units.
439 LiveRegUnits::accumulateUsedDefed(MI, ModifiedRegUnits, UsedRegUnits, TRI);
440 // Once the expected lane register is clobbered/read in-between, we can
441 // stop scanning since the pair cannot be legally merged anymore.
442 if (!ModifiedRegUnits.available(ExpectedDestReg) ||
443 !UsedRegUnits.available(ExpectedDestReg))
444 return E;
445 }
446 return E;
447}
448
449// Finds instructions, which could be represented as C.MV instructions and
450// merged into CM.MVA01S or CM.MVSA01.
451bool RISCVMoveMergeImpl::mergeMovePairs(MachineBasicBlock &MBB) {
452 bool Modified = false;
453
455 MBBI != E;) {
456 // Try merging a pair of single-reg PLI/PLUI into a paired form.
457 bool IsPLIEven = isPLIPairCandidate(*MBBI, /*EvenRegPair=*/true);
458 bool IsPLIOdd = isPLIPairCandidate(*MBBI, /*EvenRegPair=*/false);
459 if (IsPLIEven != IsPLIOdd) {
460 MachineBasicBlock::iterator Paired = findMatchingPLI(MBBI, IsPLIEven);
461 if (Paired != E) {
462 MBBI = mergePLIPair(MBBI, Paired, IsPLIEven);
463 Modified = true;
464 continue;
465 }
466 }
467
468 // Check if the instruction can be compressed to C.MV instruction. If it
469 // can, return Dest/Src register pair.
470 auto RegPair = TII->isCopyInstrImpl(*MBBI);
471 if (RegPair.has_value()) {
472 bool MoveFromSToA = isCandidateToMergeMVA01S(*RegPair);
473 bool MoveFromAToS = isCandidateToMergeMVSA01(*RegPair);
474 bool IsEven = isGPRPairCopyCandidate(*RegPair, /*EvenRegPair=*/true);
475 bool IsOdd = isGPRPairCopyCandidate(*RegPair, /*EvenRegPair=*/false);
476 if (!MoveFromSToA && !MoveFromAToS && !IsEven && !IsOdd) {
477 ++MBBI;
478 continue;
479 }
480
482 if (MoveFromSToA || MoveFromAToS) {
483 Paired = findMatchingSACopy(MBBI, MoveFromSToA, *RegPair);
484 if (Paired != E) {
485 MBBI = mergePairedInsns(MBBI, Paired, MoveFromSToA);
486 Modified = true;
487 continue;
488 }
489 }
490 if (IsEven != IsOdd) {
491 Paired = findMatchingGPRPairCopy(MBBI, IsEven, *RegPair);
492 if (Paired != E) {
493 MBBI = mergeGPRPairInsns(MBBI, Paired, IsEven);
494 Modified = true;
495 continue;
496 }
497 }
498 }
499 ++MBBI;
500 }
501 return Modified;
502}
503
504bool RISCVMoveMergeImpl::runOnMachineFunction(MachineFunction &MF) {
505 ST = &MF.getSubtarget<RISCVSubtarget>();
506 bool HasGPRPairCopy =
507 !ST->is64Bit() && (ST->hasStdExtZdinx() || ST->hasStdExtP());
508 if (!ST->hasStdExtZcmp() && !ST->hasVendorXqccmp() && !HasGPRPairCopy)
509 return false;
510
511 TII = ST->getInstrInfo();
512 TRI = ST->getRegisterInfo();
513 // Resize the modified and used register unit trackers. We do this once
514 // per function and then clear the register units each time we optimize a
515 // move.
516 ModifiedRegUnits.init(*TRI);
517 UsedRegUnits.init(*TRI);
518 bool Modified = false;
519 for (auto &MBB : MF)
520 Modified |= mergeMovePairs(MBB);
521 return Modified;
522}
523
524/// Returns an instance of the move merge pass.
526 return new RISCVMoveMergeLegacy();
527}
528
529bool RISCVMoveMergeLegacy::runOnMachineFunction(MachineFunction &MF) {
530 if (skipFunction(MF.getFunction()))
531 return false;
532 RISCVMoveMergeImpl Impl;
533 return Impl.runOnMachineFunction(MF);
534}
535
536PreservedAnalyses
539 RISCVMoveMergeImpl Impl;
540 return Impl.runOnMachineFunction(MF)
544}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
aarch64 promote const
uint64_t Imm
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
const HexagonInstrInfo * TII
IRTranslator LLVM IR MI
#define I(x, y, z)
Definition MD5.cpp:57
Register const TargetRegisterInfo * TRI
Promote Memory to Register
Definition Mem2Reg.cpp:110
if(PassOpts->AAPipeline)
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Definition PassSupport.h:56
bool MoveFromSToA
#define RISCV_MOVE_MERGE_NAME
static unsigned getPairedPLIOpcode(unsigned Opc)
Represent the analysis usage information of a pass.
LLVM_ABI void setPreservesCFG()
This function should be called by the pass, iff they do not:
Definition Pass.cpp:280
Represents analyses that only rely on functions' control flow.
Definition Analysis.h:73
FunctionPass class - This class is used to implement most global optimizations.
Definition Pass.h:312
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, Register DestReg, Register SrcReg, bool KillSrc, bool RenamableDest=false, bool RenamableSrc=false) const override
Emit instructions to copy a pair of physical registers.
A set of register units used to track register liveness.
static void accumulateUsedDefed(const MachineInstr &MI, LiveRegUnits &ModifiedRegUnits, LiveRegUnits &UsedRegUnits, const TargetRegisterInfo *TRI)
For a machine instruction MI, adds all register units used in UsedRegUnits and defined or clobbered i...
bool available(MCRegister Reg) const
Returns true if no part of physical register Reg is live.
void init(const TargetRegisterInfo &TRI)
Initialize and clear the set.
void clear()
Clears the set.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
MachineInstrBundleIterator< MachineInstr > iterator
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Function & getFunction()
Return the LLVM function that this machine code represents.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MachineInstrBuilder & add(const MachineOperand &MO) const
Representation of each machine instruction.
LLVM_ABI MachineInstrBundleIterator< MachineInstr > eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
void setIsKill(bool Val=true)
Register getReg() const
getReg - Returns the register number.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition Analysis.h:118
PreservedAnalyses & preserveSet()
Mark an analysis set as preserved.
Definition Analysis.h:151
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
constexpr bool isValid() const
Definition Register.h:112
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Pass manager infrastructure for declaring and invalidating analyses.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
IterT next_nodbg(IterT It, IterT End, bool SkipPseudoOp=true)
Increment It, then continue incrementing it while it points to a debug instruction.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
FunctionPass * createRISCVMoveMergeLegacyPass()
Returns an instance of the move merge pass.
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
LLVM_ABI PreservedAnalyses getMachineFunctionPassPreservedAnalyses()
Returns the minimum set of Analyses that all machine function passes must preserve.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition BitVector.h:880
const MachineOperand * Source
const MachineOperand * Destination