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