LLVM  9.0.0svn
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 
13 #include "llvm/ADT/BitVector.h"
14 #include "llvm/ADT/SmallVector.h"
15 #include "llvm/ADT/Statistic.h"
27 #include "llvm/CodeGen/Passes.h"
33 #include "llvm/Pass.h"
34 #include "llvm/Support/Casting.h"
36 #include "llvm/Support/Debug.h"
38 #include <algorithm>
39 #include <cassert>
40 #include <cstdint>
41 #include <iterator>
42 #include <vector>
43 
44 using namespace llvm;
45 
46 #define DEBUG_TYPE "stack-slot-coloring"
47 
48 static cl::opt<bool>
49 DisableSharing("no-stack-slot-sharing",
50  cl::init(false), cl::Hidden,
51  cl::desc("Suppress slot sharing during stack coloring"));
52 
53 static cl::opt<int> DCELimit("ssc-dce-limit", cl::init(-1), cl::Hidden);
54 
55 STATISTIC(NumEliminated, "Number of stack slots eliminated due to coloring");
56 STATISTIC(NumDead, "Number of trivially dead stack accesses eliminated");
57 
58 namespace {
59 
60  class StackSlotColoring : public MachineFunctionPass {
61  LiveStacks* LS;
62  MachineFrameInfo *MFI;
63  const TargetInstrInfo *TII;
64  const MachineBlockFrequencyInfo *MBFI;
65 
66  // SSIntervals - Spill slot intervals.
67  std::vector<LiveInterval*> SSIntervals;
68 
69  // SSRefs - Keep a list of MachineMemOperands for each spill slot.
70  // MachineMemOperands can be shared between instructions, so we need
71  // to be careful that renames like [FI0, FI1] -> [FI1, FI2] do not
72  // become FI0 -> FI1 -> FI2.
74 
75  // OrigAlignments - Alignments of stack objects before coloring.
76  SmallVector<unsigned, 16> OrigAlignments;
77 
78  // OrigSizes - Sizess of stack objects before coloring.
79  SmallVector<unsigned, 16> OrigSizes;
80 
81  // AllColors - If index is set, it's a spill slot, i.e. color.
82  // FIXME: This assumes PEI locate spill slot with smaller indices
83  // closest to stack pointer / frame pointer. Therefore, smaller
84  // index == better color. This is per stack ID.
85  SmallVector<BitVector, 2> AllColors;
86 
87  // NextColor - Next "color" that's not yet used. This is per stack ID.
88  SmallVector<int, 2> NextColors = { -1 };
89 
90  // UsedColors - "Colors" that have been assigned. This is per stack ID
91  SmallVector<BitVector, 2> UsedColors;
92 
93  // Assignments - Color to intervals mapping.
95 
96  public:
97  static char ID; // Pass identification
98 
99  StackSlotColoring() : MachineFunctionPass(ID) {
101  }
102 
103  void getAnalysisUsage(AnalysisUsage &AU) const override {
104  AU.setPreservesCFG();
105  AU.addRequired<SlotIndexes>();
107  AU.addRequired<LiveStacks>();
112  }
113 
114  bool runOnMachineFunction(MachineFunction &MF) override;
115 
116  private:
117  void InitializeSlots();
118  void ScanForSpillSlotRefs(MachineFunction &MF);
119  bool OverlapWithAssignments(LiveInterval *li, int Color) const;
120  int ColorSlot(LiveInterval *li);
121  bool ColorSlots(MachineFunction &MF);
122  void RewriteInstruction(MachineInstr &MI, SmallVectorImpl<int> &SlotMapping,
123  MachineFunction &MF);
124  bool RemoveDeadStores(MachineBasicBlock* MBB);
125  };
126 
127 } // end anonymous namespace
128 
129 char StackSlotColoring::ID = 0;
130 
132 
133 INITIALIZE_PASS_BEGIN(StackSlotColoring, DEBUG_TYPE,
134  "Stack Slot Coloring", false, false)
138 INITIALIZE_PASS_END(StackSlotColoring, DEBUG_TYPE,
139  "Stack Slot Coloring", false, false)
140 
141 namespace {
142 
143 // IntervalSorter - Comparison predicate that sort live intervals by
144 // their weight.
146  bool operator()(LiveInterval* LHS, LiveInterval* RHS) const {
147  return LHS->weight > RHS->weight;
148  }
149 };
150 
151 } // end anonymous namespace
152 
153 /// ScanForSpillSlotRefs - Scan all the machine instructions for spill slot
154 /// references and update spill slot weights.
155 void StackSlotColoring::ScanForSpillSlotRefs(MachineFunction &MF) {
156  SSRefs.resize(MFI->getObjectIndexEnd());
157 
158  // FIXME: Need the equivalent of MachineRegisterInfo for frameindex operands.
159  for (MachineFunction::iterator MBBI = MF.begin(), E = MF.end();
160  MBBI != E; ++MBBI) {
161  MachineBasicBlock *MBB = &*MBBI;
162  for (MachineBasicBlock::iterator MII = MBB->begin(), EE = MBB->end();
163  MII != EE; ++MII) {
164  MachineInstr &MI = *MII;
165  for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) {
166  MachineOperand &MO = MI.getOperand(i);
167  if (!MO.isFI())
168  continue;
169  int FI = MO.getIndex();
170  if (FI < 0)
171  continue;
172  if (!LS->hasInterval(FI))
173  continue;
174  LiveInterval &li = LS->getInterval(FI);
175  if (!MI.isDebugValue())
176  li.weight += LiveIntervals::getSpillWeight(false, true, MBFI, MI);
177  }
179  EE = MI.memoperands_end();
180  MMOI != EE; ++MMOI) {
181  MachineMemOperand *MMO = *MMOI;
182  if (const FixedStackPseudoSourceValue *FSV =
183  dyn_cast_or_null<FixedStackPseudoSourceValue>(
184  MMO->getPseudoValue())) {
185  int FI = FSV->getFrameIndex();
186  if (FI >= 0)
187  SSRefs[FI].push_back(MMO);
188  }
189  }
190  }
191  }
192 }
193 
194 /// InitializeSlots - Process all spill stack slot liveintervals and add them
195 /// to a sorted (by weight) list.
196 void StackSlotColoring::InitializeSlots() {
197  int LastFI = MFI->getObjectIndexEnd();
198 
199  // There is always at least one stack ID.
200  AllColors.resize(1);
201  UsedColors.resize(1);
202 
203  OrigAlignments.resize(LastFI);
204  OrigSizes.resize(LastFI);
205  AllColors[0].resize(LastFI);
206  UsedColors[0].resize(LastFI);
207  Assignments.resize(LastFI);
208 
209  using Pair = std::iterator_traits<LiveStacks::iterator>::value_type;
210 
211  SmallVector<Pair *, 16> Intervals;
212 
213  Intervals.reserve(LS->getNumIntervals());
214  for (auto &I : *LS)
215  Intervals.push_back(&I);
216  llvm::sort(Intervals,
217  [](Pair *LHS, Pair *RHS) { return LHS->first < RHS->first; });
218 
219  // Gather all spill slots into a list.
220  LLVM_DEBUG(dbgs() << "Spill slot intervals:\n");
221  for (auto *I : Intervals) {
222  LiveInterval &li = I->second;
223  LLVM_DEBUG(li.dump());
225  if (MFI->isDeadObjectIndex(FI))
226  continue;
227 
228  SSIntervals.push_back(&li);
229  OrigAlignments[FI] = MFI->getObjectAlignment(FI);
230  OrigSizes[FI] = MFI->getObjectSize(FI);
231 
232  auto StackID = MFI->getStackID(FI);
233  if (StackID != 0) {
234  AllColors.resize(StackID + 1);
235  UsedColors.resize(StackID + 1);
236  AllColors[StackID].resize(LastFI);
237  UsedColors[StackID].resize(LastFI);
238  }
239 
240  AllColors[StackID].set(FI);
241  }
242  LLVM_DEBUG(dbgs() << '\n');
243 
244  // Sort them by weight.
245  llvm::stable_sort(SSIntervals, IntervalSorter());
246 
247  NextColors.resize(AllColors.size());
248 
249  // Get first "color".
250  for (unsigned I = 0, E = AllColors.size(); I != E; ++I)
251  NextColors[I] = AllColors[I].find_first();
252 }
253 
254 /// OverlapWithAssignments - Return true if LiveInterval overlaps with any
255 /// LiveIntervals that have already been assigned to the specified color.
256 bool
257 StackSlotColoring::OverlapWithAssignments(LiveInterval *li, int Color) const {
258  const SmallVectorImpl<LiveInterval *> &OtherLIs = Assignments[Color];
259  for (unsigned i = 0, e = OtherLIs.size(); i != e; ++i) {
260  LiveInterval *OtherLI = OtherLIs[i];
261  if (OtherLI->overlaps(*li))
262  return true;
263  }
264  return false;
265 }
266 
267 /// ColorSlot - Assign a "color" (stack slot) to the specified stack slot.
268 int StackSlotColoring::ColorSlot(LiveInterval *li) {
269  int Color = -1;
270  bool Share = false;
272  uint8_t StackID = MFI->getStackID(FI);
273 
274  if (!DisableSharing) {
275 
276  // Check if it's possible to reuse any of the used colors.
277  Color = UsedColors[StackID].find_first();
278  while (Color != -1) {
279  if (!OverlapWithAssignments(li, Color)) {
280  Share = true;
281  ++NumEliminated;
282  break;
283  }
284  Color = UsedColors[StackID].find_next(Color);
285  }
286  }
287 
288  if (Color != -1 && MFI->getStackID(Color) != MFI->getStackID(FI)) {
289  LLVM_DEBUG(dbgs() << "cannot share FIs with different stack IDs\n");
290  Share = false;
291  }
292 
293  // Assign it to the first available color (assumed to be the best) if it's
294  // not possible to share a used color with other objects.
295  if (!Share) {
296  assert(NextColors[StackID] != -1 && "No more spill slots?");
297  Color = NextColors[StackID];
298  UsedColors[StackID].set(Color);
299  NextColors[StackID] = AllColors[StackID].find_next(NextColors[StackID]);
300  }
301 
302  assert(MFI->getStackID(Color) == MFI->getStackID(FI));
303 
304  // Record the assignment.
305  Assignments[Color].push_back(li);
306  LLVM_DEBUG(dbgs() << "Assigning fi#" << FI << " to fi#" << Color << "\n");
307 
308  // Change size and alignment of the allocated slot. If there are multiple
309  // objects sharing the same slot, then make sure the size and alignment
310  // are large enough for all.
311  unsigned Align = OrigAlignments[FI];
312  if (!Share || Align > MFI->getObjectAlignment(Color))
313  MFI->setObjectAlignment(Color, Align);
314  int64_t Size = OrigSizes[FI];
315  if (!Share || Size > MFI->getObjectSize(Color))
316  MFI->setObjectSize(Color, Size);
317  return Color;
318 }
319 
320 /// Colorslots - Color all spill stack slots and rewrite all frameindex machine
321 /// operands in the function.
322 bool StackSlotColoring::ColorSlots(MachineFunction &MF) {
323  unsigned NumObjs = MFI->getObjectIndexEnd();
324  SmallVector<int, 16> SlotMapping(NumObjs, -1);
325  SmallVector<float, 16> SlotWeights(NumObjs, 0.0);
326  SmallVector<SmallVector<int, 4>, 16> RevMap(NumObjs);
327  BitVector UsedColors(NumObjs);
328 
329  LLVM_DEBUG(dbgs() << "Color spill slot intervals:\n");
330  bool Changed = false;
331  for (unsigned i = 0, e = SSIntervals.size(); i != e; ++i) {
332  LiveInterval *li = SSIntervals[i];
334  int NewSS = ColorSlot(li);
335  assert(NewSS >= 0 && "Stack coloring failed?");
336  SlotMapping[SS] = NewSS;
337  RevMap[NewSS].push_back(SS);
338  SlotWeights[NewSS] += li->weight;
339  UsedColors.set(NewSS);
340  Changed |= (SS != NewSS);
341  }
342 
343  LLVM_DEBUG(dbgs() << "\nSpill slots after coloring:\n");
344  for (unsigned i = 0, e = SSIntervals.size(); i != e; ++i) {
345  LiveInterval *li = SSIntervals[i];
347  li->weight = SlotWeights[SS];
348  }
349  // Sort them by new weight.
350  llvm::stable_sort(SSIntervals, IntervalSorter());
351 
352 #ifndef NDEBUG
353  for (unsigned i = 0, e = SSIntervals.size(); i != e; ++i)
354  LLVM_DEBUG(SSIntervals[i]->dump());
355  LLVM_DEBUG(dbgs() << '\n');
356 #endif
357 
358  if (!Changed)
359  return false;
360 
361  // Rewrite all MachineMemOperands.
362  for (unsigned SS = 0, SE = SSRefs.size(); SS != SE; ++SS) {
363  int NewFI = SlotMapping[SS];
364  if (NewFI == -1 || (NewFI == (int)SS))
365  continue;
366 
367  const PseudoSourceValue *NewSV = MF.getPSVManager().getFixedStack(NewFI);
368  SmallVectorImpl<MachineMemOperand *> &RefMMOs = SSRefs[SS];
369  for (unsigned i = 0, e = RefMMOs.size(); i != e; ++i)
370  RefMMOs[i]->setValue(NewSV);
371  }
372 
373  // Rewrite all MO_FrameIndex operands. Look for dead stores.
374  for (MachineBasicBlock &MBB : MF) {
375  for (MachineInstr &MI : MBB)
376  RewriteInstruction(MI, SlotMapping, MF);
377  RemoveDeadStores(&MBB);
378  }
379 
380  // Delete unused stack slots.
381  for (int StackID = 0, E = AllColors.size(); StackID != E; ++StackID) {
382  int NextColor = NextColors[StackID];
383  while (NextColor != -1) {
384  LLVM_DEBUG(dbgs() << "Removing unused stack object fi#" << NextColor << "\n");
385  MFI->RemoveStackObject(NextColor);
386  NextColor = AllColors[StackID].find_next(NextColor);
387  }
388  }
389 
390  return true;
391 }
392 
393 /// RewriteInstruction - Rewrite specified instruction by replacing references
394 /// to old frame index with new one.
395 void StackSlotColoring::RewriteInstruction(MachineInstr &MI,
397  MachineFunction &MF) {
398  // Update the operands.
399  for (unsigned i = 0, ee = MI.getNumOperands(); i != ee; ++i) {
400  MachineOperand &MO = MI.getOperand(i);
401  if (!MO.isFI())
402  continue;
403  int OldFI = MO.getIndex();
404  if (OldFI < 0)
405  continue;
406  int NewFI = SlotMapping[OldFI];
407  if (NewFI == -1 || NewFI == OldFI)
408  continue;
409 
410  assert(MFI->getStackID(OldFI) == MFI->getStackID(NewFI));
411  MO.setIndex(NewFI);
412  }
413 
414  // The MachineMemOperands have already been updated.
415 }
416 
417 /// RemoveDeadStores - Scan through a basic block and look for loads followed
418 /// by stores. If they're both using the same stack slot, then the store is
419 /// definitely dead. This could obviously be much more aggressive (consider
420 /// pairs with instructions between them), but such extensions might have a
421 /// considerable compile time impact.
422 bool StackSlotColoring::RemoveDeadStores(MachineBasicBlock* MBB) {
423  // FIXME: This could be much more aggressive, but we need to investigate
424  // the compile time impact of doing so.
425  bool changed = false;
426 
428 
429  for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->end();
430  I != E; ++I) {
431  if (DCELimit != -1 && (int)NumDead >= DCELimit)
432  break;
433  int FirstSS, SecondSS;
434  if (TII->isStackSlotCopy(*I, FirstSS, SecondSS) && FirstSS == SecondSS &&
435  FirstSS != -1) {
436  ++NumDead;
437  changed = true;
438  toErase.push_back(&*I);
439  continue;
440  }
441 
442  MachineBasicBlock::iterator NextMI = std::next(I);
443  MachineBasicBlock::iterator ProbableLoadMI = I;
444 
445  unsigned LoadReg = 0;
446  unsigned StoreReg = 0;
447  unsigned LoadSize = 0;
448  unsigned StoreSize = 0;
449  if (!(LoadReg = TII->isLoadFromStackSlot(*I, FirstSS, LoadSize)))
450  continue;
451  // Skip the ...pseudo debugging... instructions between a load and store.
452  while ((NextMI != E) && NextMI->isDebugInstr()) {
453  ++NextMI;
454  ++I;
455  }
456  if (NextMI == E) continue;
457  if (!(StoreReg = TII->isStoreToStackSlot(*NextMI, SecondSS, StoreSize)))
458  continue;
459  if (FirstSS != SecondSS || LoadReg != StoreReg || FirstSS == -1 ||
460  LoadSize != StoreSize)
461  continue;
462 
463  ++NumDead;
464  changed = true;
465 
466  if (NextMI->findRegisterUseOperandIdx(LoadReg, true, nullptr) != -1) {
467  ++NumDead;
468  toErase.push_back(&*ProbableLoadMI);
469  }
470 
471  toErase.push_back(&*NextMI);
472  ++I;
473  }
474 
476  E = toErase.end(); I != E; ++I)
477  (*I)->eraseFromParent();
478 
479  return changed;
480 }
481 
482 bool StackSlotColoring::runOnMachineFunction(MachineFunction &MF) {
483  LLVM_DEBUG({
484  dbgs() << "********** Stack Slot Coloring **********\n"
485  << "********** Function: " << MF.getName() << '\n';
486  });
487 
488  if (skipFunction(MF.getFunction()))
489  return false;
490 
491  MFI = &MF.getFrameInfo();
492  TII = MF.getSubtarget().getInstrInfo();
493  LS = &getAnalysis<LiveStacks>();
494  MBFI = &getAnalysis<MachineBlockFrequencyInfo>();
495 
496  bool Changed = false;
497 
498  unsigned NumSlots = LS->getNumIntervals();
499  if (NumSlots == 0)
500  // Nothing to do!
501  return false;
502 
503  // If there are calls to setjmp or sigsetjmp, don't perform stack slot
504  // coloring. The stack could be modified before the longjmp is executed,
505  // resulting in the wrong value being used afterwards. (See
506  // <rdar://problem/8007500>.)
507  if (MF.exposesReturnsTwice())
508  return false;
509 
510  // Gather spill slot references
511  ScanForSpillSlotRefs(MF);
512  InitializeSlots();
513  Changed = ColorSlots(MF);
514 
515  for (int &Next : NextColors)
516  Next = -1;
517 
518  SSIntervals.clear();
519  for (unsigned i = 0, e = SSRefs.size(); i != e; ++i)
520  SSRefs[i].clear();
521  SSRefs.clear();
522  OrigAlignments.clear();
523  OrigSizes.clear();
524  AllColors.clear();
525  UsedColors.clear();
526  for (unsigned i = 0, e = Assignments.size(); i != e; ++i)
527  Assignments[i].clear();
528  Assignments.clear();
529 
530  return Changed;
531 }
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
BitVector & set()
Definition: BitVector.h:397
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
const unsigned reg
Definition: LiveInterval.h:666
static float getSpillWeight(bool isDef, bool isUse, const MachineBlockFrequencyInfo *MBFI, const MachineInstr &MI)
Calculate the spill weight to assign to a single instruction.
This class represents lattice values for constants.
Definition: AllocatorList.h:23
bool isDeadObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a dead object.
char & MachineDominatorsID
MachineDominators - This pass is a machine dominators analysis pass.
LiveInterval - This class represents the liveness of a register, or stack slot.
Definition: LiveInterval.h:637
Stack Slot Coloring
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
LiveInterval & getInterval(int Slot)
Definition: LiveStacks.h:63
STATISTIC(NumFunctions, "Total number of functions")
void reserve(size_type N)
Definition: SmallVector.h:369
static int stackSlot2Index(unsigned Reg)
Compute the frame index from a register value representing a stack slot.
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
Definition: PassSupport.h:50
A description of a memory reference used in the backend.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const HexagonInstrInfo * TII
unsigned getNumOperands() const
Retuns the total number of operands.
Definition: MachineInstr.h:411
void setIndex(int Idx)
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
SlotIndexes pass.
Definition: SlotIndexes.h:328
PseudoSourceValueManager & getPSVManager() const
bool operator()(LiveInterval *LHS, LiveInterval *RHS) const
char & StackSlotColoringID
StackSlotColoring - This pass performs stack slot coloring.
AnalysisUsage & addPreservedID(const void *ID)
virtual unsigned isStoreToStackSlot(const MachineInstr &MI, int &FrameIndex) const
If the specified machine instruction is a direct store to a stack slot, return the virtual or physica...
int getObjectIndexEnd() const
Return one past the maximum frame object index.
virtual const TargetInstrInfo * getInstrInfo() const
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
const PseudoSourceValue * getFixedStack(int FI)
Return a pseudo source value referencing a fixed stack frame entry, e.g., a spill slot...
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
TargetInstrInfo - Interface to description of machine instruction set.
void initializeStackSlotColoringPass(PassRegistry &)
unsigned getObjectAlignment(int ObjectIdx) const
Return the alignment of the specified stack object.
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:432
#define DEBUG_TYPE
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
void RemoveStackObject(int ObjectIdx)
Remove or mark dead a statically sized stack object.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static cl::opt< int > DCELimit("ssc-dce-limit", cl::init(-1), cl::Hidden)
Represent the analysis usage information of a pass.
const PseudoSourceValue * getPseudoValue() const
void setObjectSize(int ObjectIdx, int64_t Size)
Change the size of the specified stack object.
size_t size() const
Definition: SmallVector.h:52
static cl::opt< bool > DisableSharing("no-stack-slot-sharing", cl::init(false), cl::Hidden, cl::desc("Suppress slot sharing during stack coloring"))
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
void sort(IteratorTy Start, IteratorTy End)
Definition: STLExtras.h:1115
virtual bool isStackSlotCopy(const MachineInstr &MI, int &DestFrameIndex, int &SrcFrameIndex) const
Return true if the specified machine instruction is a copy of one stack slot to another and has no ot...
Iterator for intrusive lists based on ilist_node.
Color
A "color", which is either even or odd.
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.
Definition: MachineInstr.h:533
INITIALIZE_PASS_BEGIN(StackSlotColoring, DEBUG_TYPE, "Stack Slot Coloring", false, false) INITIALIZE_PASS_END(StackSlotColoring
bool isDebugValue() const
Definition: MachineInstr.h:996
MachineOperand class - Representation of each machine instruction operand.
This is a &#39;vector&#39; (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:841
void setPreservesCFG()
This function should be called by the pass, iff they do not:
Definition: Pass.cpp:301
const Function & getFunction() const
Return the LLVM function that this machine code represents.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:132
Special value supplied for machine level alias analysis.
This struct contains the mappings from the slot numbers to unnamed metadata nodes, global values and types.
Definition: SlotMapping.h:32
static void clear(coro::Shape &Shape)
Definition: Coroutines.cpp:211
Representation of each machine instruction.
Definition: MachineInstr.h:63
bool overlaps(const LiveRange &other) const
overlaps - Return true if the intersection of the two live ranges is not empty.
Definition: LiveInterval.h:435
bool exposesReturnsTwice() const
exposesReturnsTwice - Returns true if the function calls setjmp or any other similar functions with a...
virtual unsigned isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const
If the specified machine instruction is a direct load from a stack slot, return the virtual or physic...
unsigned getNumIntervals() const
Definition: LiveStacks.h:59
#define I(x, y, z)
Definition: MD5.cpp:58
bool isFI() const
isFI - Tests if this is a MO_FrameIndex operand.
uint32_t Size
Definition: Profile.cpp:46
uint8_t getStackID(int ObjectIdx) const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool hasInterval(int Slot) const
Definition: LiveStacks.h:77
void stable_sort(R &&Range)
Definition: STLExtras.h:1309
IRTranslator LLVM IR MI
A specialized PseudoSourceValue for holding FixedStack values, which must include a frame index...
#define LLVM_DEBUG(X)
Definition: Debug.h:122
const MachineOperand & getOperand(unsigned i) const
Definition: MachineInstr.h:413
void setObjectAlignment(int ObjectIdx, unsigned Align)
setObjectAlignment - Change the alignment of the specified stack object.
mmo_iterator memoperands_end() const
Access to memory operands of the instruction.
Definition: MachineInstr.h:540
void resize(size_type N)
Definition: SmallVector.h:344