LLVM 24.0.0git
SIModeRegister.cpp
Go to the documentation of this file.
1//===-- SIModeRegister.cpp - Mode Register --------------------------------===//
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/// \file
9/// This pass inserts changes to the Mode register settings as required.
10/// Note that currently it only deals with the Double Precision Floating Point
11/// rounding mode setting, but is intended to be generic enough to be easily
12/// expanded.
13///
14//===----------------------------------------------------------------------===//
15//
16#include "AMDGPU.h"
17#include "GCNSubtarget.h"
18#include "llvm/ADT/Statistic.h"
20#include <queue>
21
22#define DEBUG_TYPE "si-mode-register"
23
24STATISTIC(NumSetregInserted, "Number of setreg of mode register inserted.");
25
26using namespace llvm;
27
28struct Status {
29 // Mask is a bitmask where a '1' indicates the corresponding Mode bit has a
30 // known value
31 unsigned Mask = 0;
32 unsigned Mode = 0;
33
34 Status() = default;
35
36 Status(unsigned NewMask, unsigned NewMode) : Mask(NewMask), Mode(NewMode) {
37 Mode &= Mask;
38 };
39
40 // merge two status values such that only values that don't conflict are
41 // preserved
42 Status merge(const Status &S) const {
43 return Status((Mask | S.Mask), ((Mode & ~S.Mask) | (S.Mode & S.Mask)));
44 }
45
46 // merge an unknown value by using the unknown value's mask to remove bits
47 // from the result
48 Status mergeUnknown(unsigned newMask) {
49 return Status(Mask & ~newMask, Mode & ~newMask);
50 }
51
52 // intersect two Status values to produce a mode and mask that is a subset
53 // of both values
54 Status intersect(const Status &S) const {
55 unsigned NewMask = (Mask & S.Mask) & (Mode ^ ~S.Mode);
56 unsigned NewMode = (Mode & NewMask);
57 return Status(NewMask, NewMode);
58 }
59
60 // produce the delta required to change the Mode to the required Mode
61 Status delta(const Status &S) const {
62 return Status((S.Mask & (Mode ^ S.Mode)) | (~Mask & S.Mask), S.Mode);
63 }
64
65 bool operator==(const Status &S) const {
66 return (Mask == S.Mask) && (Mode == S.Mode);
67 }
68
69 bool operator!=(const Status &S) const { return !(*this == S); }
70
72 return ((Mask & S.Mask) == S.Mask) && ((Mode & S.Mask) == S.Mode);
73 }
74
75 bool isCombinable(Status &S) { return !(Mask & S.Mask) || isCompatible(S); }
76};
77
78class BlockData {
79public:
80 // The Status that represents the mode register settings required by the
81 // FirstInsertionPoint (if any) in this block. Calculated in Phase 1.
83
84 // The Status that represents the net changes to the Mode register made by
85 // this block, Calculated in Phase 1.
87
88 // The Status that represents the mode register settings on exit from this
89 // block. Calculated in Phase 2.
91
92 // The Status that represents the intersection of exit Mode register settings
93 // from all predecessor blocks. Calculated in Phase 2, and used by Phase 3.
95
96 // In Phase 1 we record the first instruction that has a mode requirement,
97 // which is used in Phase 3 if we need to insert a mode change.
99
100 // A flag to indicate whether an Exit value has been set (we can't tell by
101 // examining the Exit value itself as all values may be valid results).
102 bool ExitSet = false;
103
104 BlockData() = default;
105};
106
107namespace {
108
109class SIModeRegister {
110public:
111 std::vector<std::unique_ptr<BlockData>> BlockInfo;
112 std::queue<MachineBasicBlock *> Phase2List;
113
114 // The default mode register setting currently only caters for the floating
115 // point double precision rounding mode.
116 // We currently assume the default rounding mode is Round to Nearest
117 // NOTE: this should come from a per function rounding mode setting once such
118 // a setting exists.
119 unsigned DefaultMode = FP_ROUND_ROUND_TO_NEAREST;
120 Status DefaultStatus =
121 Status(FP_ROUND_MODE_DP(0x3), FP_ROUND_MODE_DP(DefaultMode));
122
123 bool Changed = false;
124
125 bool run(MachineFunction &MF);
126
127 void processBlockPhase1(MachineBasicBlock &MBB, const SIInstrInfo *TII);
128
129 void processBlockPhase2(MachineBasicBlock &MBB, const SIInstrInfo *TII);
130
131 void processBlockPhase3(MachineBasicBlock &MBB, const SIInstrInfo *TII);
132
133 Status getInstructionMode(MachineInstr &MI, const SIInstrInfo *TII);
134
135 void insertSetreg(MachineBasicBlock &MBB, MachineInstr *I,
136 const SIInstrInfo *TII, Status InstrMode);
137};
138
139class SIModeRegisterLegacy : public MachineFunctionPass {
140public:
141 static char ID;
142
143 SIModeRegisterLegacy() : MachineFunctionPass(ID) {}
144
145 bool runOnMachineFunction(MachineFunction &MF) override;
146
147 void getAnalysisUsage(AnalysisUsage &AU) const override {
148 AU.setPreservesCFG();
150 }
151};
152} // End anonymous namespace.
153
154INITIALIZE_PASS(SIModeRegisterLegacy, DEBUG_TYPE,
155 "Insert required mode register values", false, false)
156
157char SIModeRegisterLegacy::ID = 0;
158
159char &llvm::SIModeRegisterID = SIModeRegisterLegacy::ID;
160
162 return new SIModeRegisterLegacy();
163}
164
165// Determine the Mode register setting required for this instruction.
166// Instructions which don't use the Mode register return a null Status.
167// Note this currently only deals with instructions that use the floating point
168// double precision setting.
169Status SIModeRegister::getInstructionMode(MachineInstr &MI,
170 const SIInstrInfo *TII) {
171 unsigned Opcode = MI.getOpcode();
172 if (TII->usesFPDPRounding(MI) ||
173 Opcode == AMDGPU::FPTRUNC_ROUND_F16_F32_PSEUDO ||
174 Opcode == AMDGPU::FPTRUNC_ROUND_F16_F32_PSEUDO_fake16_e32 ||
175 Opcode == AMDGPU::FPTRUNC_ROUND_F16_F32_PSEUDO_t16_e64 ||
176 Opcode == AMDGPU::FPTRUNC_ROUND_F32_F64_PSEUDO ||
177 Opcode == AMDGPU::FPTRUNC_ROUND_F16_F32_SALU_PSEUDO) {
178 switch (Opcode) {
179 case AMDGPU::V_INTERP_P1LL_F16:
180 case AMDGPU::V_INTERP_P1LV_F16:
181 case AMDGPU::V_INTERP_P2_F16:
182 // f16 interpolation instructions need double precision round to zero
183 return Status(FP_ROUND_MODE_DP(3),
185 case AMDGPU::FPTRUNC_ROUND_F16_F32_PSEUDO: {
186 unsigned Mode = MI.getOperand(2).getImm();
187 MI.removeOperand(2);
188 MI.setDesc(TII->get(AMDGPU::V_CVT_F16_F32_e32));
190 }
191 case AMDGPU::FPTRUNC_ROUND_F16_F32_PSEUDO_fake16_e32: {
192 unsigned Mode = MI.getOperand(2).getImm();
193 MI.removeOperand(2);
194 MI.setDesc(TII->get(AMDGPU::V_CVT_F16_F32_fake16_e32));
195 return Status(FP_ROUND_MODE_DP(3), FP_ROUND_MODE_DP(Mode));
196 }
197 case AMDGPU::FPTRUNC_ROUND_F16_F32_PSEUDO_t16_e64: {
198 unsigned Mode = MI.getOperand(6).getImm();
199 MI.removeOperand(6);
200 MI.setDesc(TII->get(AMDGPU::V_CVT_F16_F32_t16_e64));
201 return Status(FP_ROUND_MODE_DP(3), FP_ROUND_MODE_DP(Mode));
202 }
203 case AMDGPU::FPTRUNC_ROUND_F32_F64_PSEUDO: {
204 unsigned Mode = MI.getOperand(2).getImm();
205 MI.removeOperand(2);
206 MI.setDesc(TII->get(AMDGPU::V_CVT_F32_F64_e32));
207 return Status(FP_ROUND_MODE_DP(3), FP_ROUND_MODE_DP(Mode));
208 }
209 case AMDGPU::FPTRUNC_ROUND_F16_F32_SALU_PSEUDO: {
210 unsigned Mode = MI.getOperand(2).getImm();
211 MI.removeOperand(2);
212 MI.setDesc(TII->get(AMDGPU::S_CVT_F16_F32));
213 return Status(FP_ROUND_MODE_DP(3), FP_ROUND_MODE_DP(Mode));
214 }
215 default:
216 return DefaultStatus;
217 }
218 }
219 return Status();
220}
221
222// Insert a setreg instruction to update the Mode register.
223// It is possible (though unlikely) for an instruction to require a change to
224// the value of disjoint parts of the Mode register when we don't know the
225// value of the intervening bits. In that case we need to use more than one
226// setreg instruction.
227void SIModeRegister::insertSetreg(MachineBasicBlock &MBB, MachineInstr *MI,
228 const SIInstrInfo *TII, Status InstrMode) {
229 while (InstrMode.Mask) {
230 unsigned Offset = llvm::countr_zero<unsigned>(InstrMode.Mask);
231 unsigned Width = llvm::countr_one<unsigned>(InstrMode.Mask >> Offset);
232 unsigned Value = (InstrMode.Mode >> Offset) & ((1 << Width) - 1);
233 using namespace AMDGPU::Hwreg;
234 BuildMI(MBB, MI, nullptr, TII->get(AMDGPU::S_SETREG_IMM32_B32))
235 .addImm(Value)
236 .addImm(HwregEncoding::encode(ID_MODE, Offset, Width));
237 ++NumSetregInserted;
238 Changed = true;
239 InstrMode.Mask &= ~(((1 << Width) - 1) << Offset);
240 }
241}
242
243// In Phase 1 we iterate through the instructions of the block and for each
244// instruction we get its mode usage. If the instruction uses the Mode register
245// we:
246// - update the Change status, which tracks the changes to the Mode register
247// made by this block
248// - if this instruction's requirements are compatible with the current setting
249// of the Mode register we merge the modes
250// - if it isn't compatible and an InsertionPoint isn't set, then we set the
251// InsertionPoint to the current instruction, and we remember the current
252// mode
253// - if it isn't compatible and InsertionPoint is set we insert a seteg before
254// that instruction (unless this instruction forms part of the block's
255// entry requirements in which case the insertion is deferred until Phase 3
256// when predecessor exit values are known), and move the insertion point to
257// this instruction
258// - if this is a setreg instruction we treat it as an incompatible instruction.
259// This is sub-optimal but avoids some nasty corner cases, and is expected to
260// occur very rarely.
261// - on exit we have set the Require, Change, and initial Exit modes.
262void SIModeRegister::processBlockPhase1(MachineBasicBlock &MBB,
263 const SIInstrInfo *TII) {
264 auto NewInfo = std::make_unique<BlockData>();
265 MachineInstr *InsertionPoint = nullptr;
266 // RequirePending is used to indicate whether we are collecting the initial
267 // requirements for the block, and need to defer the first InsertionPoint to
268 // Phase 3. It is set to false once we have set FirstInsertionPoint, or when
269 // we discover an explicit setreg that means this block doesn't have any
270 // initial requirements.
271 bool RequirePending = true;
272 Status IPChange;
273 for (MachineInstr &MI : MBB) {
274 Status InstrMode = getInstructionMode(MI, TII);
275 if (MI.getOpcode() == AMDGPU::S_SETREG_B32 ||
276 MI.getOpcode() == AMDGPU::S_SETREG_B32_mode ||
277 MI.getOpcode() == AMDGPU::S_SETREG_IMM32_B32 ||
278 MI.getOpcode() == AMDGPU::S_SETREG_IMM32_B32_mode) {
279 // We preserve any explicit mode register setreg instruction we encounter,
280 // as we assume it has been inserted by a higher authority (this is
281 // likely to be a very rare occurrence).
282 unsigned Dst = TII->getNamedOperand(MI, AMDGPU::OpName::simm16)->getImm();
283 using namespace AMDGPU::Hwreg;
284 auto [Id, Offset, Width] = HwregEncoding::decode(Dst);
285 if (Id != ID_MODE)
286 continue;
287
288 unsigned Mask = maskTrailingOnes<unsigned>(Width) << Offset;
289
290 // If an InsertionPoint is set we will insert a setreg there.
291 if (InsertionPoint) {
292 insertSetreg(MBB, InsertionPoint, TII, IPChange.delta(NewInfo->Change));
293 InsertionPoint = nullptr;
294 }
295 // If this is an immediate then we know the value being set, but if it is
296 // not an immediate then we treat the modified bits of the mode register
297 // as unknown.
298 if (MI.getOpcode() == AMDGPU::S_SETREG_IMM32_B32 ||
299 MI.getOpcode() == AMDGPU::S_SETREG_IMM32_B32_mode) {
300 unsigned Val = TII->getNamedOperand(MI, AMDGPU::OpName::imm)->getImm();
301 unsigned Mode = (Val << Offset) & Mask;
302 Status Setreg = Status(Mask, Mode);
303 // If we haven't already set the initial requirements for the block we
304 // don't need to as the requirements start from this explicit setreg.
305 RequirePending = false;
306 NewInfo->Change = NewInfo->Change.merge(Setreg);
307 } else {
308 NewInfo->Change = NewInfo->Change.mergeUnknown(Mask);
309 }
310 } else if (!NewInfo->Change.isCompatible(InstrMode)) {
311 // This instruction uses the Mode register and its requirements aren't
312 // compatible with the current mode.
313 if (InsertionPoint) {
314 // If the required mode change cannot be included in the current
315 // InsertionPoint changes, we need a setreg and start a new
316 // InsertionPoint.
317 if (!IPChange.delta(NewInfo->Change).isCombinable(InstrMode)) {
318 if (RequirePending) {
319 // This is the first insertionPoint in the block so we will defer
320 // the insertion of the setreg to Phase 3 where we know whether or
321 // not it is actually needed.
322 NewInfo->FirstInsertionPoint = InsertionPoint;
323 NewInfo->Require = NewInfo->Change;
324 RequirePending = false;
325 } else {
326 insertSetreg(MBB, InsertionPoint, TII,
327 IPChange.delta(NewInfo->Change));
328 IPChange = NewInfo->Change;
329 }
330 // Set the new InsertionPoint
331 InsertionPoint = &MI;
332 }
333 NewInfo->Change = NewInfo->Change.merge(InstrMode);
334 } else {
335 // No InsertionPoint is currently set - this is either the first in
336 // the block or we have previously seen an explicit setreg.
337 InsertionPoint = &MI;
338 IPChange = NewInfo->Change;
339 NewInfo->Change = NewInfo->Change.merge(InstrMode);
340 }
341 }
342 }
343 if (RequirePending) {
344 // If we haven't yet set the initial requirements for the block we set them
345 // now.
346 NewInfo->FirstInsertionPoint = InsertionPoint;
347 NewInfo->Require = NewInfo->Change;
348 } else if (InsertionPoint) {
349 // We need to insert a setreg at the InsertionPoint
350 insertSetreg(MBB, InsertionPoint, TII, IPChange.delta(NewInfo->Change));
351 }
352 NewInfo->Exit = NewInfo->Change;
353 BlockInfo[MBB.getNumber()] = std::move(NewInfo);
354}
355
356// In Phase 2 we revisit each block and calculate the common Mode register
357// value provided by all predecessor blocks. If the Exit value for the block
358// is changed, then we add the successor blocks to the worklist so that the
359// exit value is propagated.
360void SIModeRegister::processBlockPhase2(MachineBasicBlock &MBB,
361 const SIInstrInfo *TII) {
362 bool RevisitRequired = false;
363 bool ExitSet = false;
364 unsigned ThisBlock = MBB.getNumber();
365 if (MBB.pred_empty()) {
366 // There are no predecessors, so use the default starting status.
367 BlockInfo[ThisBlock]->Pred = DefaultStatus;
368 ExitSet = true;
369 } else {
370 // Build a status that is common to all the predecessors by intersecting
371 // all the predecessor exit status values.
372 // Mask bits (which represent the Mode bits with a known value) can only be
373 // added by explicit SETREG instructions or the initial default value -
374 // the intersection process may remove Mask bits.
375 // If we find a predecessor that has not yet had an exit value determined
376 // (this can happen for example if a block is its own predecessor) we defer
377 // use of that value as the Mask will be all zero, and we will revisit this
378 // block again later (unless the only predecessor without an exit value is
379 // this block).
381 MachineBasicBlock &PB = *(*P);
382 unsigned PredBlock = PB.getNumber();
383 if ((ThisBlock == PredBlock) && (std::next(P) == E)) {
384 BlockInfo[ThisBlock]->Pred = DefaultStatus;
385 ExitSet = true;
386 } else if (BlockInfo[PredBlock]->ExitSet) {
387 BlockInfo[ThisBlock]->Pred = BlockInfo[PredBlock]->Exit;
388 ExitSet = true;
389 } else if (PredBlock != ThisBlock)
390 RevisitRequired = true;
391
392 for (P = std::next(P); P != E; P = std::next(P)) {
393 MachineBasicBlock *Pred = *P;
394 unsigned PredBlock = Pred->getNumber();
395 if (BlockInfo[PredBlock]->ExitSet) {
396 if (BlockInfo[ThisBlock]->ExitSet) {
397 BlockInfo[ThisBlock]->Pred =
398 BlockInfo[ThisBlock]->Pred.intersect(BlockInfo[PredBlock]->Exit);
399 } else {
400 BlockInfo[ThisBlock]->Pred = BlockInfo[PredBlock]->Exit;
401 }
402 ExitSet = true;
403 } else if (PredBlock != ThisBlock)
404 RevisitRequired = true;
405 }
406 }
407 Status TmpStatus =
408 BlockInfo[ThisBlock]->Pred.merge(BlockInfo[ThisBlock]->Change);
409 if (BlockInfo[ThisBlock]->Exit != TmpStatus) {
410 BlockInfo[ThisBlock]->Exit = TmpStatus;
411 // Add the successors to the work list so we can propagate the changed exit
412 // status.
413 for (MachineBasicBlock *Succ : MBB.successors())
414 Phase2List.push(Succ);
415 }
416 BlockInfo[ThisBlock]->ExitSet = ExitSet;
417 if (RevisitRequired)
418 Phase2List.push(&MBB);
419}
420
421// In Phase 3 we revisit each block and if it has an insertion point defined we
422// check whether the predecessor mode meets the block's entry requirements. If
423// not we insert an appropriate setreg instruction to modify the Mode register.
424void SIModeRegister::processBlockPhase3(MachineBasicBlock &MBB,
425 const SIInstrInfo *TII) {
426 unsigned ThisBlock = MBB.getNumber();
427 if (!BlockInfo[ThisBlock]->Pred.isCompatible(BlockInfo[ThisBlock]->Require)) {
428 Status Delta =
429 BlockInfo[ThisBlock]->Pred.delta(BlockInfo[ThisBlock]->Require);
430 if (BlockInfo[ThisBlock]->FirstInsertionPoint)
431 insertSetreg(MBB, BlockInfo[ThisBlock]->FirstInsertionPoint, TII, Delta);
432 else
433 insertSetreg(MBB, &MBB.instr_front(), TII, Delta);
434 }
435}
436
437bool SIModeRegisterLegacy::runOnMachineFunction(MachineFunction &MF) {
438 return SIModeRegister().run(MF);
439}
440
443 if (!SIModeRegister().run(MF))
444 return PreservedAnalyses::all();
446 PA.preserveSet<CFGAnalyses>();
447 return PA;
448}
449
450bool SIModeRegister::run(MachineFunction &MF) {
451 // Constrained FP intrinsics are used to support non-default rounding modes.
452 // strictfp attribute is required to mark functions with strict FP semantics
453 // having constrained FP intrinsics. This pass fixes up operations that uses
454 // a non-default rounding mode for non-strictfp functions. But it should not
455 // assume or modify any default rounding modes in case of strictfp functions.
456 const Function &F = MF.getFunction();
457 if (F.hasFnAttribute(llvm::Attribute::StrictFP))
458 return Changed;
459 BlockInfo.resize(MF.getNumBlockIDs());
460 const GCNSubtarget &ST = MF.getSubtarget<GCNSubtarget>();
461 const SIInstrInfo *TII = ST.getInstrInfo();
462
463 // Processing is performed in a number of phases
464
465 // Phase 1 - determine the initial mode required by each block, and add setreg
466 // instructions for intra block requirements.
467 for (MachineBasicBlock &BB : MF)
468 processBlockPhase1(BB, TII);
469
470 // Phase 2 - determine the exit mode from each block. We add all blocks to the
471 // list here, but will also add any that need to be revisited during Phase 2
472 // processing.
473 for (MachineBasicBlock &BB : MF)
474 Phase2List.push(&BB);
475 while (!Phase2List.empty()) {
476 processBlockPhase2(*Phase2List.front(), TII);
477 Phase2List.pop();
478 }
479
480 // Phase 3 - add an initial setreg to each block where the required entry mode
481 // is not satisfied by the exit mode of all its predecessors.
482 for (MachineBasicBlock &BB : MF)
483 processBlockPhase3(BB, TII);
484
485 BlockInfo.clear();
486
487 return Changed;
488}
MachineBasicBlock & MBB
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
AMD GCN specific subclass of TargetSubtarget.
#define DEBUG_TYPE
const HexagonInstrInfo * TII
IRTranslator LLVM IR MI
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
#define P(N)
PassBuilder PB(Machine, PassOpts->PTO, std::nullopt, &PIC)
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Definition PassSupport.h:56
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
#define FP_ROUND_MODE_DP(x)
Definition SIDefines.h:1498
#define FP_ROUND_ROUND_TO_NEAREST
Definition SIDefines.h:1490
#define FP_ROUND_ROUND_TO_ZERO
Definition SIDefines.h:1493
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
Definition Statistic.h:171
BlockData()=default
MachineInstr * FirstInsertionPoint
LLVM_ABI void setPreservesCFG()
This function should be called by the pass, iff they do not:
Definition Pass.cpp:275
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:314
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
SmallVectorImpl< MachineBasicBlock * >::iterator pred_iterator
iterator_range< succ_iterator > successors()
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.
unsigned getNumBlockIDs() const
getNumBlockIDs - Return the number of MBB ID's allocated.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
Representation of each machine instruction.
A set of analyses that are preserved following a run of a transformation pass.
Definition Analysis.h:112
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition Analysis.h:118
PreservedAnalyses run(MachineFunction &F, MachineFunctionAnalysisManager &AM)
Changed
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
This is an optimization pass for GlobalISel generic memory operations.
@ 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.
FunctionPass * createSIModeRegisterPass()
int countr_one(T Value)
Count the number of ones from the least significant bit to the first zero bit.
Definition bit.h:315
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
Definition InstrProf.h:143
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
LLVM_ABI PreservedAnalyses getMachineFunctionPassPreservedAnalyses()
Returns the minimum set of Analyses that all machine function passes must preserve.
char & SIModeRegisterID
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
Status delta(const Status &S) const
Status(unsigned NewMask, unsigned NewMode)
bool isCombinable(Status &S)
bool operator==(const Status &S) const
Status()=default
bool isCompatible(Status &S)
Status merge(const Status &S) const
Status intersect(const Status &S) const
bool operator!=(const Status &S) const
unsigned Mask
unsigned Mode
Status mergeUnknown(unsigned newMask)