LLVM 24.0.0git
StackSlotColoring.cpp
Go to the documentation of this file.
1//===- StackSlotColoring.cpp - Stack slot coloring 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 implements the stack slot coloring pass.
10//
11//===----------------------------------------------------------------------===//
12
14#include "CodeGenOptions.h"
15#include "llvm/ADT/BitVector.h"
17#include "llvm/ADT/Statistic.h"
32#include "llvm/CodeGen/Passes.h"
39#include "llvm/Pass.h"
41#include "llvm/Support/Debug.h"
43#include <cassert>
44#include <cstdint>
45#include <iterator>
46#include <vector>
47
48using namespace llvm;
49
50#define DEBUG_TYPE "stack-slot-coloring"
51
52STATISTIC(NumEliminated, "Number of stack slots eliminated due to coloring");
53STATISTIC(NumDead, "Number of trivially dead stack accesses eliminated");
54
55namespace {
56
57class StackSlotColoring {
58 const CodeGenOptions &Opts;
59 MachineFrameInfo *MFI = nullptr;
60 const TargetInstrInfo *TII = nullptr;
61 LiveStacks *LS = nullptr;
62 const MachineBlockFrequencyInfo *MBFI = nullptr;
63 SlotIndexes *Indexes = nullptr;
64
65 // SSIntervals - Spill slot intervals.
66 std::vector<LiveInterval *> SSIntervals;
67
68 // SSRefs - Keep a list of MachineMemOperands for each spill slot.
69 // MachineMemOperands can be shared between instructions, so we need
70 // to be careful that renames like [FI0, FI1] -> [FI1, FI2] do not
71 // become FI0 -> FI1 -> FI2.
73
74 // OrigAlignments - Alignments of stack objects before coloring.
75 SmallVector<Align, 16> OrigAlignments;
76
77 // OrigSizes - Sizes of stack objects before coloring.
79
80 // AllColors - If index is set, it's a spill slot, i.e. color.
81 // FIXME: This assumes PEI locate spill slot with smaller indices
82 // closest to stack pointer / frame pointer. Therefore, smaller
83 // index == better color. This is per stack ID.
85
86 // NextColor - Next "color" that's not yet used. This is per stack ID.
87 SmallVector<int, 2> NextColors = {-1};
88
89 // UsedColors - "Colors" that have been assigned. This is per stack ID
91
92 // Join all intervals sharing one color into a single LiveIntervalUnion to
93 // speedup range overlap test.
94 class ColorAssignmentInfo {
95 // Single liverange (used to avoid creation of LiveIntervalUnion).
96 LiveInterval *SingleLI = nullptr;
97 // LiveIntervalUnion to perform overlap test.
98 LiveIntervalUnion *LIU = nullptr;
99 // LiveIntervalUnion has a parameter in its constructor so doing this
100 // dirty magic.
101 uint8_t LIUPad[sizeof(LiveIntervalUnion)];
102
103 public:
104 ~ColorAssignmentInfo() {
105 if (LIU)
106 LIU->~LiveIntervalUnion(); // Dirty magic again.
107 }
108
109 // Return true if LiveInterval overlaps with any
110 // intervals that have already been assigned to this color.
111 bool overlaps(LiveInterval *LI) const {
112 if (LIU)
113 return LiveIntervalUnion::Query(*LI, *LIU).checkInterference();
114 return SingleLI ? SingleLI->overlaps(*LI) : false;
115 }
116
117 // Add new LiveInterval to this color.
118 void add(LiveInterval *LI, LiveIntervalUnion::Allocator &Alloc) {
119 assert(!overlaps(LI));
120 if (LIU) {
121 LIU->unify(*LI, *LI);
122 } else if (SingleLI) {
123 LIU = new (LIUPad) LiveIntervalUnion(Alloc);
124 LIU->unify(*SingleLI, *SingleLI);
125 LIU->unify(*LI, *LI);
126 SingleLI = nullptr;
127 } else
128 SingleLI = LI;
129 }
130 };
131
133
134 // Assignments - Color to intervals mapping.
136
137public:
138 StackSlotColoring(MachineFunction &MF, LiveStacks *LS,
139 MachineBlockFrequencyInfo *MBFI, SlotIndexes *Indexes)
140 : Opts(getCodeGenOptions(MF)), MFI(&MF.getFrameInfo()),
141 TII(MF.getSubtarget().getInstrInfo()), LS(LS), MBFI(MBFI),
142 Indexes(Indexes) {}
143 bool run(MachineFunction &MF);
144
145private:
146 void InitializeSlots();
147 void ScanForSpillSlotRefs(MachineFunction &MF);
148 int ColorSlot(LiveInterval *li);
149 bool ColorSlots(MachineFunction &MF);
150 void RewriteInstruction(MachineInstr &MI, SmallVectorImpl<int> &SlotMapping,
151 MachineFunction &MF);
152 bool RemoveDeadStores(MachineBasicBlock *MBB);
153};
154
155class StackSlotColoringLegacy : public MachineFunctionPass {
156public:
157 static char ID; // Pass identification
158
159 StackSlotColoringLegacy() : MachineFunctionPass(ID) {}
160
161 void getAnalysisUsage(AnalysisUsage &AU) const override {
162 AU.setPreservesCFG();
163 AU.addRequired<SlotIndexesWrapperPass>();
164 AU.addPreserved<SlotIndexesWrapperPass>();
165 AU.addRequired<LiveStacksWrapperLegacy>();
166 AU.addRequired<MachineBlockFrequencyInfoWrapperPass>();
167
168 // In some Target's pipeline, register allocation (RA) might be
169 // split into multiple phases based on register class. So, this pass
170 // may be invoked multiple times requiring it to save these analyses to be
171 // used by RA later.
172 AU.addPreserved<LiveIntervalsWrapperPass>();
173 AU.addPreserved<LiveDebugVariablesWrapperLegacy>();
174
176 }
177
178 bool runOnMachineFunction(MachineFunction &MF) override;
179};
180
181} // end anonymous namespace
182
183char StackSlotColoringLegacy::ID = 0;
184
185char &llvm::StackSlotColoringID = StackSlotColoringLegacy::ID;
186
187INITIALIZE_PASS_BEGIN(StackSlotColoringLegacy, DEBUG_TYPE,
188 "Stack Slot Coloring", false, false)
192INITIALIZE_PASS_END(StackSlotColoringLegacy, DEBUG_TYPE, "Stack Slot Coloring",
194
195namespace {
196
197// IntervalSorter - Comparison predicate that sort live intervals by
198// their weight.
200 bool operator()(LiveInterval* LHS, LiveInterval* RHS) const {
201 return LHS->weight() > RHS->weight();
202 }
203};
204
205} // end anonymous namespace
206
207/// ScanForSpillSlotRefs - Scan all the machine instructions for spill slot
208/// references and update spill slot weights.
209void StackSlotColoring::ScanForSpillSlotRefs(MachineFunction &MF) {
210 SSRefs.resize(MFI->getObjectIndexEnd());
211
212 // FIXME: Need the equivalent of MachineRegisterInfo for frameindex operands.
213 for (MachineBasicBlock &MBB : MF) {
214 for (MachineInstr &MI : MBB) {
215 for (const MachineOperand &MO : MI.operands()) {
216 if (!MO.isFI())
217 continue;
218 int FI = MO.getIndex();
219 if (FI < 0)
220 continue;
221 if (!LS->hasInterval(FI))
222 continue;
223 LiveInterval &li = LS->getInterval(FI);
224 if (!MI.isDebugInstr())
226 LiveIntervals::getSpillWeight(false, true, MBFI, MI));
227 }
228 for (MachineMemOperand *MMO : MI.memoperands()) {
229 if (const FixedStackPseudoSourceValue *FSV =
231 MMO->getPseudoValue())) {
232 int FI = FSV->getFrameIndex();
233 if (FI >= 0)
234 SSRefs[FI].push_back(MMO);
235 }
236 }
237 }
238 }
239}
240
241/// InitializeSlots - Process all spill stack slot liveintervals and add them
242/// to a sorted (by weight) list.
243void StackSlotColoring::InitializeSlots() {
244 int LastFI = MFI->getObjectIndexEnd();
245
246 // There is always at least one stack ID.
247 AllColors.resize(1);
248 UsedColors.resize(1);
249
250 OrigAlignments.resize(LastFI);
251 OrigSizes.resize(LastFI);
252 AllColors[0].resize(LastFI);
253 UsedColors[0].resize(LastFI);
254 Assignments.resize(LastFI);
255
256 using Pair = std::iterator_traits<LiveStacks::iterator>::value_type;
257
258 SmallVector<Pair *, 16> Intervals;
259
260 Intervals.reserve(LS->getNumIntervals());
261 for (auto &I : *LS)
262 Intervals.push_back(&I);
263 llvm::sort(Intervals,
264 [](Pair *LHS, Pair *RHS) { return LHS->first < RHS->first; });
265
266 // Gather all spill slots into a list.
267 LLVM_DEBUG(dbgs() << "Spill slot intervals:\n");
268 for (auto *I : Intervals) {
269 LiveInterval &li = I->second;
270 LLVM_DEBUG(li.dump());
271 int FI = li.reg().stackSlotIndex();
272 if (MFI->isDeadObjectIndex(FI))
273 continue;
274
275 SSIntervals.push_back(&li);
276 OrigAlignments[FI] = MFI->getObjectAlign(FI);
277 OrigSizes[FI] = MFI->getObjectSize(FI);
278
279 auto StackID = MFI->getStackID(FI);
280 if (StackID != 0) {
281 if (StackID >= AllColors.size()) {
282 AllColors.resize(StackID + 1);
283 UsedColors.resize(StackID + 1);
284 }
285 AllColors[StackID].resize(LastFI);
286 UsedColors[StackID].resize(LastFI);
287 }
288
289 AllColors[StackID].set(FI);
290 }
291 LLVM_DEBUG(dbgs() << '\n');
292
293 // Sort them by weight.
294 llvm::stable_sort(SSIntervals, IntervalSorter());
295
296 NextColors.resize(AllColors.size());
297
298 // Get first "color".
299 for (unsigned I = 0, E = AllColors.size(); I != E; ++I)
300 NextColors[I] = AllColors[I].find_first();
301}
302
303/// ColorSlot - Assign a "color" (stack slot) to the specified stack slot.
304int StackSlotColoring::ColorSlot(LiveInterval *li) {
305 int Color = -1;
306 bool Share = false;
307 int FI = li->reg().stackSlotIndex();
308 uint8_t StackID = MFI->getStackID(FI);
309
310 if (Opts.stack_slot_sharing) {
311
312 // Check if it's possible to reuse any of the used colors.
313 Color = UsedColors[StackID].find_first();
314 while (Color != -1) {
315 if (!Assignments[Color].overlaps(li)) {
316 Share = true;
317 ++NumEliminated;
318 break;
319 }
320 Color = UsedColors[StackID].find_next(Color);
321 }
322 }
323
324 if (Color != -1 && MFI->getStackID(Color) != MFI->getStackID(FI)) {
325 LLVM_DEBUG(dbgs() << "cannot share FIs with different stack IDs\n");
326 Share = false;
327 }
328
329 // Assign it to the first available color (assumed to be the best) if it's
330 // not possible to share a used color with other objects.
331 if (!Share) {
332 assert(NextColors[StackID] != -1 && "No more spill slots?");
333 Color = NextColors[StackID];
334 UsedColors[StackID].set(Color);
335 NextColors[StackID] = AllColors[StackID].find_next(NextColors[StackID]);
336 }
337
338 assert(MFI->getStackID(Color) == MFI->getStackID(FI));
339
340 // Record the assignment.
341 Assignments[Color].add(li, LIUAlloc);
342 LLVM_DEBUG(dbgs() << "Assigning fi#" << FI << " to fi#" << Color << "\n");
343
344 // Change size and alignment of the allocated slot. If there are multiple
345 // objects sharing the same slot, then make sure the size and alignment
346 // are large enough for all.
347 Align Alignment = OrigAlignments[FI];
348 if (!Share || Alignment > MFI->getObjectAlign(Color))
349 MFI->setObjectAlignment(Color, Alignment);
350 int64_t Size = OrigSizes[FI];
351 if (!Share || Size > MFI->getObjectSize(Color))
352 MFI->setObjectSize(Color, Size);
353 return Color;
354}
355
356/// Colorslots - Color all spill stack slots and rewrite all frameindex machine
357/// operands in the function.
358bool StackSlotColoring::ColorSlots(MachineFunction &MF) {
359 unsigned NumObjs = MFI->getObjectIndexEnd();
360 SmallVector<int, 16> SlotMapping(NumObjs, -1);
361 SmallVector<float, 16> SlotWeights(NumObjs, 0.0);
362 SmallVector<SmallVector<int, 4>, 16> RevMap(NumObjs);
363 BitVector UsedColors(NumObjs);
364
365 LLVM_DEBUG(dbgs() << "Color spill slot intervals:\n");
366 bool Changed = false;
367 for (LiveInterval *li : SSIntervals) {
368 int SS = li->reg().stackSlotIndex();
369 int NewSS = ColorSlot(li);
370 assert(NewSS >= 0 && "Stack coloring failed?");
371 SlotMapping[SS] = NewSS;
372 RevMap[NewSS].push_back(SS);
373 SlotWeights[NewSS] += li->weight();
374 UsedColors.set(NewSS);
375 Changed |= (SS != NewSS);
376 }
377
378 LLVM_DEBUG(dbgs() << "\nSpill slots after coloring:\n");
379 for (LiveInterval *li : SSIntervals) {
380 int SS = li->reg().stackSlotIndex();
381 li->setWeight(SlotWeights[SS]);
382 }
383 // Sort them by new weight.
384 llvm::stable_sort(SSIntervals, IntervalSorter());
385
386#ifndef NDEBUG
387 for (LiveInterval *li : SSIntervals)
388 LLVM_DEBUG(li->dump());
389 LLVM_DEBUG(dbgs() << '\n');
390#endif
391
392 if (!Changed)
393 return false;
394
395 // Rewrite all MachineMemOperands.
396 for (unsigned SS = 0, SE = SSRefs.size(); SS != SE; ++SS) {
397 int NewFI = SlotMapping[SS];
398 if (NewFI == -1 || (NewFI == (int)SS))
399 continue;
400
401 const PseudoSourceValue *NewSV = MF.getPSVManager().getFixedStack(NewFI);
402 SmallVectorImpl<MachineMemOperand *> &RefMMOs = SSRefs[SS];
403 for (MachineMemOperand *MMO : RefMMOs)
404 MMO->setValue(NewSV);
405 }
406
407 // Rewrite all MO_FrameIndex operands. Look for dead stores.
408 for (MachineBasicBlock &MBB : MF) {
409 for (MachineInstr &MI : MBB)
410 RewriteInstruction(MI, SlotMapping, MF);
411 RemoveDeadStores(&MBB);
412 }
413
414 // Delete unused stack slots.
415 for (int StackID = 0, E = AllColors.size(); StackID != E; ++StackID) {
416 int NextColor = NextColors[StackID];
417 while (NextColor != -1) {
418 LLVM_DEBUG(dbgs() << "Removing unused stack object fi#" << NextColor << "\n");
419 MFI->RemoveStackObject(NextColor);
420 NextColor = AllColors[StackID].find_next(NextColor);
421 }
422 }
423
424 return true;
425}
426
427/// RewriteInstruction - Rewrite specified instruction by replacing references
428/// to old frame index with new one.
429void StackSlotColoring::RewriteInstruction(MachineInstr &MI,
430 SmallVectorImpl<int> &SlotMapping,
431 MachineFunction &MF) {
432 // Update the operands.
433 for (MachineOperand &MO : MI.operands()) {
434 if (!MO.isFI())
435 continue;
436 int OldFI = MO.getIndex();
437 if (OldFI < 0)
438 continue;
439 int NewFI = SlotMapping[OldFI];
440 if (NewFI == -1 || NewFI == OldFI)
441 continue;
442
443 assert(MFI->getStackID(OldFI) == MFI->getStackID(NewFI));
444 MO.setIndex(NewFI);
445 }
446
447 // The MachineMemOperands have already been updated.
448}
449
450/// RemoveDeadStores - Scan through a basic block and look for loads followed
451/// by stores. If they're both using the same stack slot, then the store is
452/// definitely dead. This could obviously be much more aggressive (consider
453/// pairs with instructions between them), but such extensions might have a
454/// considerable compile time impact.
455bool StackSlotColoring::RemoveDeadStores(MachineBasicBlock* MBB) {
456 // FIXME: This could be much more aggressive, but we need to investigate
457 // the compile time impact of doing so.
458 bool changed = false;
459
460 SmallVector<MachineInstr*, 4> toErase;
461
463 I != E; ++I) {
464 if (Opts.ssc_dce_limit != -1 && (int)NumDead >= Opts.ssc_dce_limit)
465 break;
466 int FirstSS, SecondSS;
467 if (TII->isStackSlotCopy(*I, FirstSS, SecondSS) && FirstSS == SecondSS &&
468 FirstSS != -1) {
469 ++NumDead;
470 changed = true;
471 toErase.push_back(&*I);
472 continue;
473 }
474
475 MachineBasicBlock::iterator NextMI = std::next(I);
476 MachineBasicBlock::iterator ProbableLoadMI = I;
477
478 Register LoadReg;
479 Register StoreReg;
480 TypeSize LoadSize = TypeSize::getZero();
481 TypeSize StoreSize = TypeSize::getZero();
482 if (!(LoadReg = TII->isLoadFromStackSlot(*I, FirstSS, LoadSize)))
483 continue;
484 // Skip the ...pseudo debugging... instructions between a load and store.
485 while ((NextMI != E) && NextMI->isDebugInstr()) {
486 ++NextMI;
487 ++I;
488 }
489 if (NextMI == E) continue;
490 if (!(StoreReg = TII->isStoreToStackSlot(*NextMI, SecondSS, StoreSize)))
491 continue;
492 // Skip if the stack size is unknown.
493 if (!LoadSize || !StoreSize)
494 continue;
495 if (FirstSS != SecondSS || LoadReg != StoreReg || FirstSS == -1 ||
496 LoadSize != StoreSize || !MFI->isSpillSlotObjectIndex(FirstSS))
497 continue;
498
499 ++NumDead;
500 changed = true;
501
502 if (NextMI->findRegisterUseOperandIdx(LoadReg, /*TRI=*/nullptr, true) !=
503 -1) {
504 ++NumDead;
505 toErase.push_back(&*ProbableLoadMI);
506 }
507
508 toErase.push_back(&*NextMI);
509 ++I;
510 }
511
512 for (MachineInstr *MI : toErase) {
513 if (Indexes)
515 MI->eraseFromParent();
516 }
517
518 return changed;
519}
520
521bool StackSlotColoring::run(MachineFunction &MF) {
522 LLVM_DEBUG({
523 dbgs() << "********** Stack Slot Coloring **********\n"
524 << "********** Function: " << MF.getName() << '\n';
525 });
526
527 bool Changed = false;
528
529 unsigned NumSlots = LS->getNumIntervals();
530 if (NumSlots == 0)
531 // Nothing to do!
532 return false;
533
534 // If there are calls to setjmp or sigsetjmp, don't perform stack slot
535 // coloring. The stack could be modified before the longjmp is executed,
536 // resulting in the wrong value being used afterwards.
537 if (MF.exposesReturnsTwice())
538 return false;
539
540 // Gather spill slot references
541 ScanForSpillSlotRefs(MF);
542 InitializeSlots();
543 Changed = ColorSlots(MF);
544
545 for (int &Next : NextColors)
546 Next = -1;
547
548 SSIntervals.clear();
549 for (auto &RefMMOs : SSRefs)
550 RefMMOs.clear();
551 SSRefs.clear();
552 OrigAlignments.clear();
553 OrigSizes.clear();
554 AllColors.clear();
555 UsedColors.clear();
556 Assignments.clear();
557
558 return Changed;
559}
560
561bool StackSlotColoringLegacy::runOnMachineFunction(MachineFunction &MF) {
562 if (skipFunction(MF.getFunction()))
563 return false;
564
565 LiveStacks *LS = &getAnalysis<LiveStacksWrapperLegacy>().getLS();
566 MachineBlockFrequencyInfo *MBFI =
567 &getAnalysis<MachineBlockFrequencyInfoWrapperPass>().getMBFI();
568 SlotIndexes *Indexes = &getAnalysis<SlotIndexesWrapperPass>().getSI();
569 StackSlotColoring Impl(MF, LS, MBFI, Indexes);
570 return Impl.run(MF);
571}
572
573PreservedAnalyses
576 LiveStacks *LS = &MFAM.getResult<LiveStacksAnalysis>(MF);
579 SlotIndexes *Indexes = &MFAM.getResult<SlotIndexesAnalysis>(MF);
580 StackSlotColoring Impl(MF, LS, MBFI, Indexes);
581 bool Changed = Impl.run(MF);
582 if (!Changed)
583 return PreservedAnalyses::all();
584
586 PA.preserveSet<CFGAnalyses>();
587 PA.preserve<SlotIndexesAnalysis>();
588 PA.preserve<LiveIntervalsAnalysis>();
589 PA.preserve<LiveDebugVariablesAnalysis>();
590 return PA;
591}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
const AArch64InstrInfo & TII
MachineBasicBlock & MBB
This file implements the BitVector class.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define DEBUG_TYPE
IRTranslator LLVM IR MI
#define I(x, y, z)
Definition MD5.cpp:57
Promote Memory to Register
Definition Mem2Reg.cpp:110
#define INITIALIZE_PASS_DEPENDENCY(depName)
Definition PassSupport.h:42
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
Definition PassSupport.h:44
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
Definition PassSupport.h:39
This file defines the SmallVector class.
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
#define LLVM_DEBUG(...)
Definition Debug.h:119
Value * RHS
Value * LHS
Register isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const override
Register isStoreToStackSlot(const MachineInstr &MI, int &FrameIndex) const override
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
AnalysisUsage & addRequired()
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this 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
LiveSegments::Allocator Allocator
LiveInterval - This class represents the liveness of a register, or stack slot.
float weight() const
Register reg() const
LLVM_ABI void dump() const
void incrementWeight(float Inc)
void setWeight(float Value)
static LLVM_ABI float getSpillWeight(bool isDef, bool isUse, const MachineBlockFrequencyInfo *MBFI, const MachineInstr &MI, ProfileSummaryInfo *PSI=nullptr)
Calculate the spill weight to assign to a single instruction.
MachineInstrBundleIterator< MachineInstr > iterator
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
void setObjectSize(int ObjectIdx, int64_t Size)
Change the size of the specified stack object.
Align getObjectAlign(int ObjectIdx) const
Return the alignment of the specified stack object.
bool isSpillSlotObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a spill slot.
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
void RemoveStackObject(int ObjectIdx)
Remove or mark dead a statically sized stack object.
int getObjectIndexEnd() const
Return one past the maximum frame object index.
uint8_t getStackID(int ObjectIdx) const
void setObjectAlignment(int ObjectIdx, Align Alignment)
setObjectAlignment - Change the alignment of the specified stack object.
bool isDeadObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a dead object.
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.
PseudoSourceValueManager & getPSVManager() const
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
bool exposesReturnsTwice() const
exposesReturnsTwice - Returns true if the function calls setjmp or any other similar functions with a...
Function & getFunction()
Return the LLVM function that this machine code represents.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition Analysis.h:118
LLVM_ABI const PseudoSourceValue * getFixedStack(int FI)
Return a pseudo source value referencing a fixed stack frame entry, e.g., a spill slot.
int stackSlotIndex() const
Compute the frame index from a register value representing a stack slot.
Definition Register.h:93
SlotIndexes pass.
LLVM_ABI void removeMachineInstrFromMaps(MachineInstr &MI, bool AllowBundled=false)
Removes machine instruction (bundle) MI from the mapping.
void reserve(size_type N)
void resize(size_type N)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
LLVM_ABI PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
TargetInstrInfo - Interface to description of machine instruction set.
static constexpr TypeSize getZero()
Definition TypeSize.h:358
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
PointerTypeMap run(const Module &M)
Compute the PointerTypeMap for the module M.
This is an optimization pass for GlobalISel generic memory operations.
void stable_sort(R &&Range)
Definition STLExtras.h:2132
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
LLVM_ABI PreservedAnalyses getMachineFunctionPassPreservedAnalyses()
Returns the minimum set of Analyses that all machine function passes must preserve.
auto dyn_cast_or_null(const Y &Val)
Definition Casting.h:753
void sort(IteratorTy Start, IteratorTy End)
Definition STLExtras.h:1652
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition Debug.cpp:209
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
LLVM_ABI char & StackSlotColoringID
StackSlotColoring - This pass performs stack slot coloring.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Next
Definition InstrProf.h:147
const CodeGenOptions & getCodeGenOptions(const LLVMContext &C)
bool operator()(LiveInterval *LHS, LiveInterval *RHS) const