LLVM 24.0.0git
RISCVMakeCompressible.cpp
Go to the documentation of this file.
1//===-- RISCVMakeCompressible.cpp - Make more instructions compressible ---===//
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 searches for instructions that are prevented from being compressed
10// by one of the following:
11//
12// 1. The use of a single uncompressed register.
13// 2. A base register + offset where the offset is too large to be compressed
14// and the base register may or may not be compressed.
15//
16//
17// For case 1, if a compressed register is available, then the uncompressed
18// register is copied to the compressed register and its uses are replaced.
19//
20// For example, storing zero uses the incompressible zero register:
21// sw zero, 0(a0) # if zero
22// sw zero, 8(a0) # if zero
23// sw zero, 4(a0) # if zero
24// sw zero, 24(a0) # if zero
25//
26// If a compressed register (e.g. a1) is available, the above can be transformed
27// to the following to improve code size:
28// li a1, 0
29// c.sw a1, 0(a0)
30// c.sw a1, 8(a0)
31// c.sw a1, 4(a0)
32// c.sw a1, 24(a0)
33//
34//
35// For case 2, if a compressed register is available, then the original base
36// is copied and adjusted such that:
37//
38// new_base_register = base_register + adjustment
39// base_register + large_offset = new_base_register + small_offset
40//
41// For example, the following offsets are too large for c.sw:
42// lui a2, 983065
43// sw a1, -236(a2)
44// sw a1, -240(a2)
45// sw a1, -244(a2)
46// sw a1, -248(a2)
47// sw a1, -252(a2)
48// sw a0, -256(a2)
49//
50// If a compressed register is available (e.g. a3), a new base could be created
51// such that the addresses can accessed with a compressible offset, thus
52// improving code size:
53// lui a2, 983065
54// addi a3, a2, -256
55// c.sw a1, 20(a3)
56// c.sw a1, 16(a3)
57// c.sw a1, 12(a3)
58// c.sw a1, 8(a3)
59// c.sw a1, 4(a3)
60// c.sw a0, 0(a3)
61//
62//
63// This optimization is only applied if there are enough uses of the copied
64// register for code size to be reduced.
65//
66//===----------------------------------------------------------------------===//
67
68#include "RISCV.h"
69#include "RISCVSubtarget.h"
73#include "llvm/CodeGen/Passes.h"
75#include "llvm/IR/Analysis.h"
77#include "llvm/Pass.h"
78#include "llvm/Support/Debug.h"
79
80using namespace llvm;
81
82#define DEBUG_TYPE "riscv-make-compressible"
83#define RISCV_COMPRESS_INSTRS_NAME "RISC-V Make Compressible"
84
85namespace {
86
87struct RISCVMakeCompressibleLegacy : public MachineFunctionPass {
88 static char ID;
89
90 bool runOnMachineFunction(MachineFunction &Fn) override;
91
92 RISCVMakeCompressibleLegacy() : MachineFunctionPass(ID) {}
93
94 StringRef getPassName() const override { return RISCV_COMPRESS_INSTRS_NAME; }
95
96 void getAnalysisUsage(AnalysisUsage &AU) const override {
97 AU.setPreservesCFG();
99 }
100};
101} // namespace
102
103char RISCVMakeCompressibleLegacy::ID = 0;
104INITIALIZE_PASS(RISCVMakeCompressibleLegacy, "riscv-make-compressible",
105 RISCV_COMPRESS_INSTRS_NAME, false, false)
106
107// Return log2(widthInBytes) of load/store done by Opcode.
108static unsigned log2LdstWidth(unsigned Opcode) {
109 switch (Opcode) {
110 default:
111 llvm_unreachable("Unexpected opcode");
112 case RISCV::LBU:
113 case RISCV::SB:
114 case RISCV::QC_E_LBU:
115 case RISCV::QC_E_SB:
116 return 0;
117 case RISCV::LH:
118 case RISCV::LH_INX:
119 case RISCV::LHU:
120 case RISCV::SH:
121 case RISCV::SH_INX:
122 case RISCV::QC_E_LH:
123 case RISCV::QC_E_LHU:
124 case RISCV::QC_E_SH:
125 return 1;
126 case RISCV::LW:
127 case RISCV::LW_INX:
128 case RISCV::SW:
129 case RISCV::SW_INX:
130 case RISCV::FLW:
131 case RISCV::FSW:
132 case RISCV::QC_E_LW:
133 case RISCV::QC_E_SW:
134 return 2;
135 case RISCV::LD:
136 case RISCV::LD_RV32:
137 case RISCV::SD:
138 case RISCV::SD_RV32:
139 case RISCV::FLD:
140 case RISCV::FSD:
141 return 3;
142 }
143}
144
145// Return bit field size of immediate operand of Opcode.
146static unsigned offsetMask(unsigned Opcode) {
147 switch (Opcode) {
148 default:
149 llvm_unreachable("Unexpected opcode");
150 case RISCV::LBU:
151 case RISCV::SB:
152 case RISCV::QC_E_LBU:
153 case RISCV::QC_E_SB:
155 case RISCV::LH:
156 case RISCV::LH_INX:
157 case RISCV::LHU:
158 case RISCV::SH:
159 case RISCV::SH_INX:
160 case RISCV::QC_E_LH:
161 case RISCV::QC_E_LHU:
162 case RISCV::QC_E_SH:
164 case RISCV::LW:
165 case RISCV::LW_INX:
166 case RISCV::SW:
167 case RISCV::SW_INX:
168 case RISCV::FLW:
169 case RISCV::FSW:
170 case RISCV::LD:
171 case RISCV::LD_RV32:
172 case RISCV::SD:
173 case RISCV::SD_RV32:
174 case RISCV::FLD:
175 case RISCV::FSD:
176 case RISCV::QC_E_LW:
177 case RISCV::QC_E_SW:
179 }
180}
181
182// Return a mask for the offset bits of a non-stack-pointer based compressed
183// load/store.
184static uint8_t compressedLDSTOffsetMask(unsigned Opcode) {
185 return offsetMask(Opcode) << log2LdstWidth(Opcode);
186}
187
188// Return true if Offset fits within a compressed stack-pointer based
189// load/store.
190static bool compressibleSPOffset(int64_t Offset, unsigned Opcode) {
191 // Compressed sp-based loads and stores only work for 32/64 bits.
192 switch (log2LdstWidth(Opcode)) {
193 case 2:
195 case 3:
197 }
198 return false;
199}
200
201// Given an offset for a load/store, return the adjustment required to the base
202// register such that the address can be accessed with a compressible offset.
203// This will return 0 if the offset is already compressible.
204static int64_t getBaseAdjustForCompression(int64_t Offset, unsigned Opcode) {
205 // Return the excess bits that do not fit in a compressible offset.
206 return Offset & ~compressedLDSTOffsetMask(Opcode);
207}
208
209// Return true if Reg is in a compressed register class.
211 return RISCV::GPRCRegClass.contains(Reg) ||
212 RISCV::GPRF16CRegClass.contains(Reg) ||
213 RISCV::GPRF32CRegClass.contains(Reg) ||
214 RISCV::FPR32CRegClass.contains(Reg) ||
215 RISCV::FPR64CRegClass.contains(Reg) ||
216 RISCV::GPRPairCRegClass.contains(Reg);
217}
218
219// Return true if MI is a load for which there exists a compressed version.
220static bool isCompressibleLoad(const MachineInstr &MI) {
221 const RISCVSubtarget &STI = MI.getMF()->getSubtarget<RISCVSubtarget>();
222
223 switch (MI.getOpcode()) {
224 default:
225 return false;
226 case RISCV::LBU:
227 case RISCV::LH:
228 case RISCV::LH_INX:
229 case RISCV::LHU:
230 return STI.hasStdExtZcb();
231 case RISCV::LW:
232 case RISCV::LW_INX:
233 case RISCV::LD:
234 return STI.hasStdExtZca();
235 case RISCV::LD_RV32:
236 return STI.hasStdExtZclsd();
237 case RISCV::FLW:
238 return !STI.is64Bit() && STI.hasStdExtZcf();
239 case RISCV::FLD:
240 return STI.hasStdExtZcd();
241 // For the Xqcilo loads we mark it as compressible only if Xqcilia is also
242 // enabled so that QC_E_ADDI can be used to create the new base.
243 case RISCV::QC_E_LBU:
244 case RISCV::QC_E_LH:
245 case RISCV::QC_E_LHU:
246 return !STI.is64Bit() && STI.hasVendorXqcilo() && STI.hasVendorXqcilia() &&
247 STI.hasStdExtZcb();
248 case RISCV::QC_E_LW:
249 return !STI.is64Bit() && STI.hasVendorXqcilo() && STI.hasVendorXqcilia();
250 }
251}
252
253// Return true if MI is a store for which there exists a compressed version.
255 const RISCVSubtarget &STI = MI.getMF()->getSubtarget<RISCVSubtarget>();
256
257 switch (MI.getOpcode()) {
258 default:
259 return false;
260 case RISCV::SB:
261 case RISCV::SH:
262 case RISCV::SH_INX:
263 return STI.hasStdExtZcb();
264 case RISCV::SW:
265 case RISCV::SW_INX:
266 case RISCV::SD:
267 return STI.hasStdExtZca();
268 case RISCV::SD_RV32:
269 return STI.hasStdExtZclsd();
270 case RISCV::FSW:
271 return !STI.is64Bit() && STI.hasStdExtZcf();
272 case RISCV::FSD:
273 return STI.hasStdExtZcd();
274 // For the Xqcilo stores we mark it as compressible only if Xqcilia is also
275 // enabled so that QC_E_ADDI can be used to create the new base.
276 case RISCV::QC_E_SB:
277 case RISCV::QC_E_SH:
278 return !STI.is64Bit() && STI.hasVendorXqcilo() && STI.hasVendorXqcilia() &&
279 STI.hasStdExtZcb();
280 case RISCV::QC_E_SW:
281 return !STI.is64Bit() && STI.hasVendorXqcilo() && STI.hasVendorXqcilia();
282 }
283}
284
285// Find a single register and/or large offset which, if compressible, would
286// allow the given instruction to be compressed.
287//
288// Possible return values:
289//
290// {Reg, 0} - Uncompressed Reg needs replacing with a compressed
291// register.
292// {Reg, N} - Reg needs replacing with a compressed register and
293// N needs adding to the new register. (Reg may be
294// compressed or uncompressed).
295// {RISCV::NoRegister, 0} - No suitable optimization found for this
296// instruction.
298 const unsigned Opcode = MI.getOpcode();
299
301 const MachineOperand &MOImm = MI.getOperand(2);
302 if (!MOImm.isImm())
303 return RegImmPair(Register(), 0);
304
305 int64_t Offset = MOImm.getImm();
306 int64_t NewBaseAdjust = getBaseAdjustForCompression(Offset, Opcode);
307 Register Base = MI.getOperand(1).getReg();
308
309 // Memory accesses via the stack pointer do not have a requirement for
310 // either of the registers to be compressible and can take a larger offset.
311 if (RISCV::SPRegClass.contains(Base)) {
312 if (!compressibleSPOffset(Offset, Opcode) && NewBaseAdjust)
313 return RegImmPair(Base, NewBaseAdjust);
314 } else {
315 Register SrcDest = MI.getOperand(0).getReg();
316 bool SrcDestCompressed = isCompressedReg(SrcDest);
317 bool BaseCompressed = isCompressedReg(Base);
318
319 // If only Base and/or offset prevent compression, then return Base and
320 // any adjustment required to make the offset compressible.
321 if ((!BaseCompressed || NewBaseAdjust) && SrcDestCompressed)
322 return RegImmPair(Base, NewBaseAdjust);
323
324 // For loads, we can only change the base register since dest is defined
325 // rather than used.
326 //
327 // For stores, we can change SrcDest (and Base if SrcDest == Base) but
328 // cannot resolve an incompressible offset in this case.
329 if (isCompressibleStore(MI)) {
330 if (!SrcDestCompressed && (BaseCompressed || SrcDest == Base) &&
331 !NewBaseAdjust)
332 return RegImmPair(SrcDest, NewBaseAdjust);
333 }
334 }
335 }
336 return RegImmPair(Register(), 0);
337}
338
339static bool isXqciloLdSt(const MachineInstr &MI) {
340 switch (MI.getOpcode()) {
341 default:
342 return false;
343 case RISCV::QC_E_SB:
344 case RISCV::QC_E_SH:
345 case RISCV::QC_E_SW:
346 case RISCV::QC_E_LBU:
347 case RISCV::QC_E_LH:
348 case RISCV::QC_E_LHU:
349 case RISCV::QC_E_LW:
350 return true;
351 }
352}
353
354// Check all uses after FirstMI of the given register, keeping a vector of
355// instructions that would be compressible if the given register (and offset if
356// applicable) were compressible.
357//
358// If there are enough uses for this optimization to improve code size and a
359// compressed register is available, return that compressed register.
361 RegImmPair RegImm,
363 MachineBasicBlock &MBB = *FirstMI.getParent();
364 const TargetRegisterInfo *TRI =
365 MBB.getParent()->getSubtarget().getRegisterInfo();
366 bool XqciloLdSt = false;
367
369 E = MBB.instr_end();
370 I != E; ++I) {
371 MachineInstr &MI = *I;
372
373 // Determine if this is an instruction which would benefit from using the
374 // new register.
376 if (CandidateRegImm.Reg == RegImm.Reg &&
377 CandidateRegImm.Imm == RegImm.Imm) {
378 XqciloLdSt |= isXqciloLdSt(MI);
379 MIs.push_back(&MI);
380 }
381
382 // If RegImm.Reg is modified by this instruction, then we cannot optimize
383 // past this instruction. If the register is already compressed, then it may
384 // possible to optimize a large offset in the current instruction - this
385 // will have been detected by the preceding call to
386 // getRegImmPairPreventingCompression.
387 if (MI.modifiesRegister(RegImm.Reg, TRI))
388 break;
389 }
390
391 // Adjusting the base costs:
392 // a. --> addi (uncompressed 4 bytes)
393 // lw/sw (4 bytes) --> compressed to 2 bytes
394 // lw/sw (4 bytes) --> compressed to 2 bytes
395 // lw/sw (4 bytes) --> compressed to 2 bytes
396 // at least three lw/sw instructions for code size reduction.
397 //
398 // b. --> qc.e.addi (uncompressed 6 bytes)
399 // qc.e.lw/sw (6 bytes) --> compressed to 2 bytes
400 // qc.e.lw/sw (6 bytes) --> compressed to 2 bytes
401 // at least two qc.e.lw/sw instructions for code size reduction.
402 //
403 // If no base adjustment is required, then copying the register costs one new
404 // c.mv (or c.li Rd, 0 for "copying" the zero register) and therefore two uses
405 // are required for a code size reduction. For GPR pairs, we need 2 ADDIs to
406 // copy so we need three users.
407 unsigned BaseCost = XqciloLdSt ? 2 : 3;
408 unsigned CopyCost = RISCV::GPRPairRegClass.contains(RegImm.Reg) ? 2 : 1;
409 assert((RegImm.Imm == 0 || CopyCost == 1) && "GPRPair should have zero imm");
410 if (MIs.size() <= CopyCost || (RegImm.Imm != 0 && MIs.size() < BaseCost))
411 return Register();
412
413 // Find a compressible register which will be available from the first
414 // instruction we care about to the last.
415 const TargetRegisterClass *RCToScavenge;
416
417 // Work out the compressed register class from which to scavenge.
418 if (RISCV::GPRRegClass.contains(RegImm.Reg))
419 RCToScavenge = &RISCV::GPRCRegClass;
420 else if (RISCV::GPRF16RegClass.contains(RegImm.Reg))
421 RCToScavenge = &RISCV::GPRF16CRegClass;
422 else if (RISCV::GPRF32RegClass.contains(RegImm.Reg))
423 RCToScavenge = &RISCV::GPRF32CRegClass;
424 else if (RISCV::FPR32RegClass.contains(RegImm.Reg))
425 RCToScavenge = &RISCV::FPR32CRegClass;
426 else if (RISCV::FPR64RegClass.contains(RegImm.Reg))
427 RCToScavenge = &RISCV::FPR64CRegClass;
428 else if (RISCV::GPRPairRegClass.contains(RegImm.Reg))
429 RCToScavenge = &RISCV::GPRPairCRegClass;
430 else
431 return Register();
432
433 RegScavenger RS;
434 RS.enterBasicBlockEnd(MBB);
435 RS.backward(std::next(MIs.back()->getIterator()));
436 return RS.scavengeRegisterBackwards(*RCToScavenge, FirstMI.getIterator(),
437 /*RestoreAfter=*/false, /*SPAdj=*/0,
438 /*AllowSpill=*/false);
439}
440
441// Update uses of the old register in the given instruction to the new register.
442static void updateOperands(MachineInstr &MI, RegImmPair OldRegImm,
443 Register NewReg) {
444 unsigned Opcode = MI.getOpcode();
445
446 // If this pass is extended to support more instructions, the check for
447 // definedness may need to be strengthened.
449 "Unsupported instruction for this optimization.");
450
451 int SkipN = 0;
452
453 // Skip the first (value) operand to a store instruction (except if the store
454 // offset is zero) in order to avoid an incorrect transformation.
455 // e.g. sd a0, 808(a0) to addi a2, a0, 768; sd a2, 40(a2)
456 if (isCompressibleStore(MI) && OldRegImm.Imm != 0)
457 SkipN = 1;
458
459 // Update registers
460 for (MachineOperand &MO : drop_begin(MI.operands(), SkipN))
461 if (MO.isReg() && MO.getReg() == OldRegImm.Reg) {
462 // Do not update operands that define the old register.
463 //
464 // The new register was scavenged for the range of instructions that are
465 // being updated, therefore it should not be defined within this range
466 // except possibly in the final instruction.
467 if (MO.isDef()) {
469 continue;
470 }
471 // Update reg
472 MO.setReg(NewReg);
473 }
474
475 // Update offset
476 MachineOperand &MOImm = MI.getOperand(2);
477 int64_t NewOffset = MOImm.getImm() & compressedLDSTOffsetMask(Opcode);
478 MOImm.setImm(NewOffset);
479}
480
482 // This is a size optimization.
483 if (!Fn.getFunction().hasOptSize())
484 return false;
485
486 const RISCVSubtarget &STI = Fn.getSubtarget<RISCVSubtarget>();
487 const RISCVInstrInfo &TII = *STI.getInstrInfo();
488
489 // This optimization only makes sense if compressed instructions are emitted.
490 if (!STI.hasStdExtZca())
491 return false;
492
493 for (MachineBasicBlock &MBB : Fn) {
494 LLVM_DEBUG(dbgs() << "MBB: " << MBB.getName() << "\n");
495 for (MachineInstr &MI : MBB) {
496 // Determine if this instruction would otherwise be compressed if not for
497 // an incompressible register or offset.
499 if (!RegImm.Reg && RegImm.Imm == 0)
500 continue;
501
502 // Determine if there is a set of instructions for which replacing this
503 // register with a compressed register (and compressible offset if
504 // applicable) is possible and will allow compression.
506 Register NewReg = analyzeCompressibleUses(MI, RegImm, MIs);
507 if (!NewReg)
508 continue;
509
510 // Create the appropriate copy and/or offset.
511 if (RISCV::GPRRegClass.contains(RegImm.Reg)) {
512 if (isInt<12>(RegImm.Imm)) {
513 BuildMI(MBB, MI, MI.getDebugLoc(), TII.get(RISCV::ADDI), NewReg)
514 .addReg(RegImm.Reg)
515 .addImm(RegImm.Imm);
516 } else {
517 assert(STI.hasVendorXqcilia() && isInt<26>(RegImm.Imm));
518 BuildMI(MBB, MI, MI.getDebugLoc(), TII.get(RISCV::QC_E_ADDI), NewReg)
519 .addReg(RegImm.Reg)
520 .addImm(RegImm.Imm);
521 }
522 } else {
523 assert(RegImm.Imm == 0);
524 TII.copyPhysReg(MBB, MI, MI.getDebugLoc(), NewReg, RegImm.Reg,
525 /*KillSrc*/ false);
526 }
527
528 // Update the set of instructions to use the compressed register and
529 // compressible offset instead. These instructions should now be
530 // compressible.
531 // TODO: Update all uses if RegImm.Imm == 0? Not just those that are
532 // expected to become compressible.
533 for (MachineInstr *UpdateMI : MIs)
534 updateOperands(*UpdateMI, RegImm, NewReg);
535 }
536 }
537 return true;
538}
539
540/// Returns an instance of the Make Compressible Optimization pass.
542 return new RISCVMakeCompressibleLegacy();
543}
544
545bool RISCVMakeCompressibleLegacy::runOnMachineFunction(MachineFunction &MF) {
546 if (skipFunction(MF.getFunction()))
547 return false;
548 return runMakeCompressibleOpt(MF);
549}
550
551PreservedAnalyses
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock & MBB
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 Reg
Register const TargetRegisterInfo * TRI
Promote Memory to Register
Definition Mem2Reg.cpp:110
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Definition PassSupport.h:56
static bool isXqciloLdSt(const MachineInstr &MI)
static bool isCompressibleLoad(const MachineInstr &MI)
#define RISCV_COMPRESS_INSTRS_NAME
static unsigned offsetMask(unsigned Opcode)
static bool isCompressibleStore(const MachineInstr &MI)
static uint8_t compressedLDSTOffsetMask(unsigned Opcode)
static bool isCompressedReg(Register Reg)
static Register analyzeCompressibleUses(MachineInstr &FirstMI, RegImmPair RegImm, SmallVectorImpl< MachineInstr * > &MIs)
static int64_t getBaseAdjustForCompression(int64_t Offset, unsigned Opcode)
static void updateOperands(MachineInstr &MI, RegImmPair OldRegImm, Register NewReg)
static bool compressibleSPOffset(int64_t Offset, unsigned Opcode)
static RegImmPair getRegImmPairPreventingCompression(const MachineInstr &MI)
static bool runMakeCompressibleOpt(MachineFunction &Fn)
This file declares the machine register scavenger class.
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
Definition Value.cpp:480
#define LLVM_DEBUG(...)
Definition Debug.h:119
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
bool hasOptSize() const
Optimize this function for size (-Os) or minimum size (-Oz).
Definition Function.h:699
Instructions::iterator instr_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 & addReg(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
Representation of each machine instruction.
const MachineBasicBlock * getParent() const
MachineOperand class - Representation of each machine instruction operand.
void setImm(int64_t immVal)
int64_t getImm() const
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
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)
const RISCVInstrInfo * getInstrInfo() const override
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...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
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...
self_iterator getIterator()
Definition ilist_node.h:123
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.
auto drop_begin(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the first N elements excluded.
Definition STLExtras.h:316
@ Offset
Definition DWP.cpp:577
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
Definition MathExtras.h:166
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
LLVM_ABI PreservedAnalyses getMachineFunctionPassPreservedAnalyses()
Returns the minimum set of Analyses that all machine function passes must preserve.
FunctionPass * createRISCVMakeCompressibleLegacyPass()
Returns an instance of the Make Compressible Optimization pass.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition Debug.cpp:209
constexpr T maskTrailingOnes(unsigned N)
Create a bitmask with the N right-most bits set to 1, and all other bits set to 0.
Definition MathExtras.h:78
constexpr bool isShiftedUInt(uint64_t x)
Checks if a unsigned integer is an N bit number shifted left by S.
Definition MathExtras.h:199
MCRegisterClass TargetRegisterClass
Definition FastISel.h:58
Used to describe a register and immediate addition.