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"
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
173 // In some Target's pipeline, register allocation (RA) might be
174 // split into multiple phases based on register class. So, this pass
175 // may be invoked multiple times requiring it to save these analyses to be
176 // used by RA later.
177 AU.addPreserved<LiveIntervalsWrapperPass>();
178 AU.addPreserved<LiveDebugVariablesWrapperLegacy>();
179
181 }
182
183 bool runOnMachineFunction(MachineFunction &MF) override;
184};
185
186} // end anonymous namespace
187
188char StackSlotColoringLegacy::ID = 0;
189
190char &llvm::StackSlotColoringID = StackSlotColoringLegacy::ID;
191
192INITIALIZE_PASS_BEGIN(StackSlotColoringLegacy, DEBUG_TYPE,
193 "Stack Slot Coloring", false, false)
197INITIALIZE_PASS_END(StackSlotColoringLegacy, DEBUG_TYPE, "Stack Slot Coloring",
199
200namespace {
201
202// IntervalSorter - Comparison predicate that sort live intervals by
203// their weight.
205 bool operator()(LiveInterval* LHS, LiveInterval* RHS) const {
206 return LHS->weight() > RHS->weight();
207 }
208};
209
210} // end anonymous namespace
211
212/// ScanForSpillSlotRefs - Scan all the machine instructions for spill slot
213/// references and update spill slot weights.
214void StackSlotColoring::ScanForSpillSlotRefs(MachineFunction &MF) {
215 SSRefs.resize(MFI->getObjectIndexEnd());
216
217 // FIXME: Need the equivalent of MachineRegisterInfo for frameindex operands.
218 for (MachineBasicBlock &MBB : MF) {
219 for (MachineInstr &MI : MBB) {
220 for (const MachineOperand &MO : MI.operands()) {
221 if (!MO.isFI())
222 continue;
223 int FI = MO.getIndex();
224 if (FI < 0)
225 continue;
226 if (!LS->hasInterval(FI))
227 continue;
228 LiveInterval &li = LS->getInterval(FI);
229 if (!MI.isDebugInstr())
231 LiveIntervals::getSpillWeight(false, true, MBFI, MI));
232 }
233 for (MachineMemOperand *MMO : MI.memoperands()) {
234 if (const FixedStackPseudoSourceValue *FSV =
236 MMO->getPseudoValue())) {
237 int FI = FSV->getFrameIndex();
238 if (FI >= 0)
239 SSRefs[FI].push_back(MMO);
240 }
241 }
242 }
243 }
244}
245
246/// InitializeSlots - Process all spill stack slot liveintervals and add them
247/// to a sorted (by weight) list.
248void StackSlotColoring::InitializeSlots() {
249 int LastFI = MFI->getObjectIndexEnd();
250
251 // There is always at least one stack ID.
252 AllColors.resize(1);
253 UsedColors.resize(1);
254
255 OrigAlignments.resize(LastFI);
256 OrigSizes.resize(LastFI);
257 AllColors[0].resize(LastFI);
258 UsedColors[0].resize(LastFI);
259 Assignments.resize(LastFI);
260
261 using Pair = std::iterator_traits<LiveStacks::iterator>::value_type;
262
263 SmallVector<Pair *, 16> Intervals;
264
265 Intervals.reserve(LS->getNumIntervals());
266 for (auto &I : *LS)
267 Intervals.push_back(&I);
268 llvm::sort(Intervals,
269 [](Pair *LHS, Pair *RHS) { return LHS->first < RHS->first; });
270
271 // Gather all spill slots into a list.
272 LLVM_DEBUG(dbgs() << "Spill slot intervals:\n");
273 for (auto *I : Intervals) {
274 LiveInterval &li = I->second;
275 LLVM_DEBUG(li.dump());
276 int FI = li.reg().stackSlotIndex();
277 if (MFI->isDeadObjectIndex(FI))
278 continue;
279
280 SSIntervals.push_back(&li);
281 OrigAlignments[FI] = MFI->getObjectAlign(FI);
282 OrigSizes[FI] = MFI->getObjectSize(FI);
283
284 auto StackID = MFI->getStackID(FI);
285 if (StackID != 0) {
286 if (StackID >= AllColors.size()) {
287 AllColors.resize(StackID + 1);
288 UsedColors.resize(StackID + 1);
289 }
290 AllColors[StackID].resize(LastFI);
291 UsedColors[StackID].resize(LastFI);
292 }
293
294 AllColors[StackID].set(FI);
295 }
296 LLVM_DEBUG(dbgs() << '\n');
297
298 // Sort them by weight.
299 llvm::stable_sort(SSIntervals, IntervalSorter());
300
301 NextColors.resize(AllColors.size());
302
303 // Get first "color".
304 for (unsigned I = 0, E = AllColors.size(); I != E; ++I)
305 NextColors[I] = AllColors[I].find_first();
306}
307
308/// ColorSlot - Assign a "color" (stack slot) to the specified stack slot.
309int StackSlotColoring::ColorSlot(LiveInterval *li) {
310 int Color = -1;
311 bool Share = false;
312 int FI = li->reg().stackSlotIndex();
313 uint8_t StackID = MFI->getStackID(FI);
314
315 if (!DisableSharing) {
316
317 // Check if it's possible to reuse any of the used colors.
318 Color = UsedColors[StackID].find_first();
319 while (Color != -1) {
320 if (!Assignments[Color].overlaps(li)) {
321 Share = true;
322 ++NumEliminated;
323 break;
324 }
325 Color = UsedColors[StackID].find_next(Color);
326 }
327 }
328
329 if (Color != -1 && MFI->getStackID(Color) != MFI->getStackID(FI)) {
330 LLVM_DEBUG(dbgs() << "cannot share FIs with different stack IDs\n");
331 Share = false;
332 }
333
334 // Assign it to the first available color (assumed to be the best) if it's
335 // not possible to share a used color with other objects.
336 if (!Share) {
337 assert(NextColors[StackID] != -1 && "No more spill slots?");
338 Color = NextColors[StackID];
339 UsedColors[StackID].set(Color);
340 NextColors[StackID] = AllColors[StackID].find_next(NextColors[StackID]);
341 }
342
343 assert(MFI->getStackID(Color) == MFI->getStackID(FI));
344
345 // Record the assignment.
346 Assignments[Color].add(li, LIUAlloc);
347 LLVM_DEBUG(dbgs() << "Assigning fi#" << FI << " to fi#" << Color << "\n");
348
349 // Change size and alignment of the allocated slot. If there are multiple
350 // objects sharing the same slot, then make sure the size and alignment
351 // are large enough for all.
352 Align Alignment = OrigAlignments[FI];
353 if (!Share || Alignment > MFI->getObjectAlign(Color))
354 MFI->setObjectAlignment(Color, Alignment);
355 int64_t Size = OrigSizes[FI];
356 if (!Share || Size > MFI->getObjectSize(Color))
357 MFI->setObjectSize(Color, Size);
358 return Color;
359}
360
361/// Colorslots - Color all spill stack slots and rewrite all frameindex machine
362/// operands in the function.
363bool StackSlotColoring::ColorSlots(MachineFunction &MF) {
364 unsigned NumObjs = MFI->getObjectIndexEnd();
365 SmallVector<int, 16> SlotMapping(NumObjs, -1);
366 SmallVector<float, 16> SlotWeights(NumObjs, 0.0);
367 SmallVector<SmallVector<int, 4>, 16> RevMap(NumObjs);
368 BitVector UsedColors(NumObjs);
369
370 LLVM_DEBUG(dbgs() << "Color spill slot intervals:\n");
371 bool Changed = false;
372 for (LiveInterval *li : SSIntervals) {
373 int SS = li->reg().stackSlotIndex();
374 int NewSS = ColorSlot(li);
375 assert(NewSS >= 0 && "Stack coloring failed?");
376 SlotMapping[SS] = NewSS;
377 RevMap[NewSS].push_back(SS);
378 SlotWeights[NewSS] += li->weight();
379 UsedColors.set(NewSS);
380 Changed |= (SS != NewSS);
381 }
382
383 LLVM_DEBUG(dbgs() << "\nSpill slots after coloring:\n");
384 for (LiveInterval *li : SSIntervals) {
385 int SS = li->reg().stackSlotIndex();
386 li->setWeight(SlotWeights[SS]);
387 }
388 // Sort them by new weight.
389 llvm::stable_sort(SSIntervals, IntervalSorter());
390
391#ifndef NDEBUG
392 for (LiveInterval *li : SSIntervals)
393 LLVM_DEBUG(li->dump());
394 LLVM_DEBUG(dbgs() << '\n');
395#endif
396
397 if (!Changed)
398 return false;
399
400 // Rewrite all MachineMemOperands.
401 for (unsigned SS = 0, SE = SSRefs.size(); SS != SE; ++SS) {
402 int NewFI = SlotMapping[SS];
403 if (NewFI == -1 || (NewFI == (int)SS))
404 continue;
405
406 const PseudoSourceValue *NewSV = MF.getPSVManager().getFixedStack(NewFI);
407 SmallVectorImpl<MachineMemOperand *> &RefMMOs = SSRefs[SS];
408 for (MachineMemOperand *MMO : RefMMOs)
409 MMO->setValue(NewSV);
410 }
411
412 // Rewrite all MO_FrameIndex operands. Look for dead stores.
413 for (MachineBasicBlock &MBB : MF) {
414 for (MachineInstr &MI : MBB)
415 RewriteInstruction(MI, SlotMapping, MF);
416 RemoveDeadStores(&MBB);
417 }
418
419 // Delete unused stack slots.
420 for (int StackID = 0, E = AllColors.size(); StackID != E; ++StackID) {
421 int NextColor = NextColors[StackID];
422 while (NextColor != -1) {
423 LLVM_DEBUG(dbgs() << "Removing unused stack object fi#" << NextColor << "\n");
424 MFI->RemoveStackObject(NextColor);
425 NextColor = AllColors[StackID].find_next(NextColor);
426 }
427 }
428
429 return true;
430}
431
432/// RewriteInstruction - Rewrite specified instruction by replacing references
433/// to old frame index with new one.
434void StackSlotColoring::RewriteInstruction(MachineInstr &MI,
435 SmallVectorImpl<int> &SlotMapping,
436 MachineFunction &MF) {
437 // Update the operands.
438 for (MachineOperand &MO : MI.operands()) {
439 if (!MO.isFI())
440 continue;
441 int OldFI = MO.getIndex();
442 if (OldFI < 0)
443 continue;
444 int NewFI = SlotMapping[OldFI];
445 if (NewFI == -1 || NewFI == OldFI)
446 continue;
447
448 assert(MFI->getStackID(OldFI) == MFI->getStackID(NewFI));
449 MO.setIndex(NewFI);
450 }
451
452 // The MachineMemOperands have already been updated.
453}
454
455/// RemoveDeadStores - Scan through a basic block and look for loads followed
456/// by stores. If they're both using the same stack slot, then the store is
457/// definitely dead. This could obviously be much more aggressive (consider
458/// pairs with instructions between them), but such extensions might have a
459/// considerable compile time impact.
460bool StackSlotColoring::RemoveDeadStores(MachineBasicBlock* MBB) {
461 // FIXME: This could be much more aggressive, but we need to investigate
462 // the compile time impact of doing so.
463 bool changed = false;
464
465 SmallVector<MachineInstr*, 4> toErase;
466
468 I != E; ++I) {
469 if (DCELimit != -1 && (int)NumDead >= DCELimit)
470 break;
471 int FirstSS, SecondSS;
472 if (TII->isStackSlotCopy(*I, FirstSS, SecondSS) && FirstSS == SecondSS &&
473 FirstSS != -1) {
474 ++NumDead;
475 changed = true;
476 toErase.push_back(&*I);
477 continue;
478 }
479
480 MachineBasicBlock::iterator NextMI = std::next(I);
481 MachineBasicBlock::iterator ProbableLoadMI = I;
482
483 Register LoadReg;
484 Register StoreReg;
485 TypeSize LoadSize = TypeSize::getZero();
486 TypeSize StoreSize = TypeSize::getZero();
487 if (!(LoadReg = TII->isLoadFromStackSlot(*I, FirstSS, LoadSize)))
488 continue;
489 // Skip the ...pseudo debugging... instructions between a load and store.
490 while ((NextMI != E) && NextMI->isDebugInstr()) {
491 ++NextMI;
492 ++I;
493 }
494 if (NextMI == E) continue;
495 if (!(StoreReg = TII->isStoreToStackSlot(*NextMI, SecondSS, StoreSize)))
496 continue;
497 // Skip if the stack size is unknown.
498 if (!LoadSize || !StoreSize)
499 continue;
500 if (FirstSS != SecondSS || LoadReg != StoreReg || FirstSS == -1 ||
501 LoadSize != StoreSize || !MFI->isSpillSlotObjectIndex(FirstSS))
502 continue;
503
504 ++NumDead;
505 changed = true;
506
507 if (NextMI->findRegisterUseOperandIdx(LoadReg, /*TRI=*/nullptr, true) !=
508 -1) {
509 ++NumDead;
510 toErase.push_back(&*ProbableLoadMI);
511 }
512
513 toErase.push_back(&*NextMI);
514 ++I;
515 }
516
517 for (MachineInstr *MI : toErase) {
518 if (Indexes)
520 MI->eraseFromParent();
521 }
522
523 return changed;
524}
525
526bool StackSlotColoring::run(MachineFunction &MF) {
527 LLVM_DEBUG({
528 dbgs() << "********** Stack Slot Coloring **********\n"
529 << "********** Function: " << MF.getName() << '\n';
530 });
531
532 bool Changed = false;
533
534 unsigned NumSlots = LS->getNumIntervals();
535 if (NumSlots == 0)
536 // Nothing to do!
537 return false;
538
539 // If there are calls to setjmp or sigsetjmp, don't perform stack slot
540 // coloring. The stack could be modified before the longjmp is executed,
541 // resulting in the wrong value being used afterwards.
542 if (MF.exposesReturnsTwice())
543 return false;
544
545 // Gather spill slot references
546 ScanForSpillSlotRefs(MF);
547 InitializeSlots();
548 Changed = ColorSlots(MF);
549
550 for (int &Next : NextColors)
551 Next = -1;
552
553 SSIntervals.clear();
554 for (auto &RefMMOs : SSRefs)
555 RefMMOs.clear();
556 SSRefs.clear();
557 OrigAlignments.clear();
558 OrigSizes.clear();
559 AllColors.clear();
560 UsedColors.clear();
561 Assignments.clear();
562
563 return Changed;
564}
565
566bool StackSlotColoringLegacy::runOnMachineFunction(MachineFunction &MF) {
567 if (skipFunction(MF.getFunction()))
568 return false;
569
570 LiveStacks *LS = &getAnalysis<LiveStacksWrapperLegacy>().getLS();
571 MachineBlockFrequencyInfo *MBFI =
572 &getAnalysis<MachineBlockFrequencyInfoWrapperPass>().getMBFI();
573 SlotIndexes *Indexes = &getAnalysis<SlotIndexesWrapperPass>().getSI();
574 StackSlotColoring Impl(MF, LS, MBFI, Indexes);
575 return Impl.run(MF);
576}
577
578PreservedAnalyses
581 LiveStacks *LS = &MFAM.getResult<LiveStacksAnalysis>(MF);
584 SlotIndexes *Indexes = &MFAM.getResult<SlotIndexesAnalysis>(MF);
585 StackSlotColoring Impl(MF, LS, MBFI, Indexes);
586 bool Changed = Impl.run(MF);
587 if (!Changed)
588 return PreservedAnalyses::all();
589
591 PA.preserveSet<CFGAnalyses>();
592 PA.preserve<SlotIndexesAnalysis>();
593 PA.preserve<LiveIntervalsAnalysis>();
594 PA.preserve<LiveDebugVariablesAnalysis>();
595 return PA;
596}
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