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