LLVM  14.0.0git
MachineFrameInfo.h
Go to the documentation of this file.
1 //===-- CodeGen/MachineFrameInfo.h - Abstract Stack Frame Rep. --*- C++ -*-===//
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 // The file defines the MachineFrameInfo class.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CODEGEN_MACHINEFRAMEINFO_H
14 #define LLVM_CODEGEN_MACHINEFRAMEINFO_H
15 
16 #include "llvm/ADT/SmallVector.h"
17 #include "llvm/CodeGen/Register.h"
18 #include "llvm/Support/Alignment.h"
19 #include "llvm/Support/DataTypes.h"
20 #include <cassert>
21 #include <vector>
22 
23 namespace llvm {
24 class raw_ostream;
25 class MachineFunction;
26 class MachineBasicBlock;
27 class BitVector;
28 class AllocaInst;
29 
30 /// The CalleeSavedInfo class tracks the information need to locate where a
31 /// callee saved register is in the current frame.
32 /// Callee saved reg can also be saved to a different register rather than
33 /// on the stack by setting DstReg instead of FrameIdx.
35  Register Reg;
36  union {
37  int FrameIdx;
38  unsigned DstReg;
39  };
40  /// Flag indicating whether the register is actually restored in the epilog.
41  /// In most cases, if a register is saved, it is also restored. There are
42  /// some situations, though, when this is not the case. For example, the
43  /// LR register on ARM is usually saved, but on exit from the function its
44  /// saved value may be loaded directly into PC. Since liveness tracking of
45  /// physical registers treats callee-saved registers are live outside of
46  /// the function, LR would be treated as live-on-exit, even though in these
47  /// scenarios it is not. This flag is added to indicate that the saved
48  /// register described by this object is not restored in the epilog.
49  /// The long-term solution is to model the liveness of callee-saved registers
50  /// by implicit uses on the return instructions, however, the required
51  /// changes in the ARM backend would be quite extensive.
52  bool Restored;
53  /// Flag indicating whether the register is spilled to stack or another
54  /// register.
55  bool SpilledToReg;
56 
57 public:
58  explicit CalleeSavedInfo(unsigned R, int FI = 0)
59  : Reg(R), FrameIdx(FI), Restored(true), SpilledToReg(false) {}
60 
61  // Accessors.
62  Register getReg() const { return Reg; }
63  int getFrameIdx() const { return FrameIdx; }
64  unsigned getDstReg() const { return DstReg; }
65  void setFrameIdx(int FI) {
66  FrameIdx = FI;
67  SpilledToReg = false;
68  }
69  void setDstReg(Register SpillReg) {
70  DstReg = SpillReg;
71  SpilledToReg = true;
72  }
73  bool isRestored() const { return Restored; }
74  void setRestored(bool R) { Restored = R; }
75  bool isSpilledToReg() const { return SpilledToReg; }
76 };
77 
78 /// The MachineFrameInfo class represents an abstract stack frame until
79 /// prolog/epilog code is inserted. This class is key to allowing stack frame
80 /// representation optimizations, such as frame pointer elimination. It also
81 /// allows more mundane (but still important) optimizations, such as reordering
82 /// of abstract objects on the stack frame.
83 ///
84 /// To support this, the class assigns unique integer identifiers to stack
85 /// objects requested clients. These identifiers are negative integers for
86 /// fixed stack objects (such as arguments passed on the stack) or nonnegative
87 /// for objects that may be reordered. Instructions which refer to stack
88 /// objects use a special MO_FrameIndex operand to represent these frame
89 /// indexes.
90 ///
91 /// Because this class keeps track of all references to the stack frame, it
92 /// knows when a variable sized object is allocated on the stack. This is the
93 /// sole condition which prevents frame pointer elimination, which is an
94 /// important optimization on register-poor architectures. Because original
95 /// variable sized alloca's in the source program are the only source of
96 /// variable sized stack objects, it is safe to decide whether there will be
97 /// any variable sized objects before all stack objects are known (for
98 /// example, register allocator spill code never needs variable sized
99 /// objects).
100 ///
101 /// When prolog/epilog code emission is performed, the final stack frame is
102 /// built and the machine instructions are modified to refer to the actual
103 /// stack offsets of the object, eliminating all MO_FrameIndex operands from
104 /// the program.
105 ///
106 /// Abstract Stack Frame Information
108 public:
109  /// Stack Smashing Protection (SSP) rules require that vulnerable stack
110  /// allocations are located close the stack protector.
112  SSPLK_None, ///< Did not trigger a stack protector. No effect on data
113  ///< layout.
114  SSPLK_LargeArray, ///< Array or nested array >= SSP-buffer-size. Closest
115  ///< to the stack protector.
116  SSPLK_SmallArray, ///< Array or nested array < SSP-buffer-size. 2nd closest
117  ///< to the stack protector.
118  SSPLK_AddrOf ///< The address of this allocation is exposed and
119  ///< triggered protection. 3rd closest to the protector.
120  };
121 
122 private:
123  // Represent a single object allocated on the stack.
124  struct StackObject {
125  // The offset of this object from the stack pointer on entry to
126  // the function. This field has no meaning for a variable sized element.
127  int64_t SPOffset;
128 
129  // The size of this object on the stack. 0 means a variable sized object,
130  // ~0ULL means a dead object.
131  uint64_t Size;
132 
133  // The required alignment of this stack slot.
134  Align Alignment;
135 
136  // If true, the value of the stack object is set before
137  // entering the function and is not modified inside the function. By
138  // default, fixed objects are immutable unless marked otherwise.
139  bool isImmutable;
140 
141  // If true the stack object is used as spill slot. It
142  // cannot alias any other memory objects.
143  bool isSpillSlot;
144 
145  /// If true, this stack slot is used to spill a value (could be deopt
146  /// and/or GC related) over a statepoint. We know that the address of the
147  /// slot can't alias any LLVM IR value. This is very similar to a Spill
148  /// Slot, but is created by statepoint lowering is SelectionDAG, not the
149  /// register allocator.
150  bool isStatepointSpillSlot = false;
151 
152  /// Identifier for stack memory type analagous to address space. If this is
153  /// non-0, the meaning is target defined. Offsets cannot be directly
154  /// compared between objects with different stack IDs. The object may not
155  /// necessarily reside in the same contiguous memory block as other stack
156  /// objects. Objects with differing stack IDs should not be merged or
157  /// replaced substituted for each other.
158  //
159  /// It is assumed a target uses consecutive, increasing stack IDs starting
160  /// from 1.
161  uint8_t StackID;
162 
163  /// If this stack object is originated from an Alloca instruction
164  /// this value saves the original IR allocation. Can be NULL.
165  const AllocaInst *Alloca;
166 
167  // If true, the object was mapped into the local frame
168  // block and doesn't need additional handling for allocation beyond that.
169  bool PreAllocated = false;
170 
171  // If true, an LLVM IR value might point to this object.
172  // Normally, spill slots and fixed-offset objects don't alias IR-accessible
173  // objects, but there are exceptions (on PowerPC, for example, some byval
174  // arguments have ABI-prescribed offsets).
175  bool isAliased;
176 
177  /// If true, the object has been zero-extended.
178  bool isZExt = false;
179 
180  /// If true, the object has been sign-extended.
181  bool isSExt = false;
182 
183  uint8_t SSPLayout;
184 
185  StackObject(uint64_t Size, Align Alignment, int64_t SPOffset,
186  bool IsImmutable, bool IsSpillSlot, const AllocaInst *Alloca,
187  bool IsAliased, uint8_t StackID = 0)
188  : SPOffset(SPOffset), Size(Size), Alignment(Alignment),
189  isImmutable(IsImmutable), isSpillSlot(IsSpillSlot), StackID(StackID),
190  Alloca(Alloca), isAliased(IsAliased), SSPLayout(SSPLK_None) {}
191  };
192 
193  /// The alignment of the stack.
194  Align StackAlignment;
195 
196  /// Can the stack be realigned. This can be false if the target does not
197  /// support stack realignment, or if the user asks us not to realign the
198  /// stack. In this situation, overaligned allocas are all treated as dynamic
199  /// allocations and the target must handle them as part of DYNAMIC_STACKALLOC
200  /// lowering. All non-alloca stack objects have their alignment clamped to the
201  /// base ABI stack alignment.
202  /// FIXME: There is room for improvement in this case, in terms of
203  /// grouping overaligned allocas into a "secondary stack frame" and
204  /// then only use a single alloca to allocate this frame and only a
205  /// single virtual register to access it. Currently, without such an
206  /// optimization, each such alloca gets its own dynamic realignment.
207  bool StackRealignable;
208 
209  /// Whether the function has the \c alignstack attribute.
210  bool ForcedRealign;
211 
212  /// The list of stack objects allocated.
213  std::vector<StackObject> Objects;
214 
215  /// This contains the number of fixed objects contained on
216  /// the stack. Because fixed objects are stored at a negative index in the
217  /// Objects list, this is also the index to the 0th object in the list.
218  unsigned NumFixedObjects = 0;
219 
220  /// This boolean keeps track of whether any variable
221  /// sized objects have been allocated yet.
222  bool HasVarSizedObjects = false;
223 
224  /// This boolean keeps track of whether there is a call
225  /// to builtin \@llvm.frameaddress.
226  bool FrameAddressTaken = false;
227 
228  /// This boolean keeps track of whether there is a call
229  /// to builtin \@llvm.returnaddress.
230  bool ReturnAddressTaken = false;
231 
232  /// This boolean keeps track of whether there is a call
233  /// to builtin \@llvm.experimental.stackmap.
234  bool HasStackMap = false;
235 
236  /// This boolean keeps track of whether there is a call
237  /// to builtin \@llvm.experimental.patchpoint.
238  bool HasPatchPoint = false;
239 
240  /// The prolog/epilog code inserter calculates the final stack
241  /// offsets for all of the fixed size objects, updating the Objects list
242  /// above. It then updates StackSize to contain the number of bytes that need
243  /// to be allocated on entry to the function.
244  uint64_t StackSize = 0;
245 
246  /// The amount that a frame offset needs to be adjusted to
247  /// have the actual offset from the stack/frame pointer. The exact usage of
248  /// this is target-dependent, but it is typically used to adjust between
249  /// SP-relative and FP-relative offsets. E.G., if objects are accessed via
250  /// SP then OffsetAdjustment is zero; if FP is used, OffsetAdjustment is set
251  /// to the distance between the initial SP and the value in FP. For many
252  /// targets, this value is only used when generating debug info (via
253  /// TargetRegisterInfo::getFrameIndexReference); when generating code, the
254  /// corresponding adjustments are performed directly.
255  int OffsetAdjustment = 0;
256 
257  /// The prolog/epilog code inserter may process objects that require greater
258  /// alignment than the default alignment the target provides.
259  /// To handle this, MaxAlignment is set to the maximum alignment
260  /// needed by the objects on the current frame. If this is greater than the
261  /// native alignment maintained by the compiler, dynamic alignment code will
262  /// be needed.
263  ///
264  Align MaxAlignment;
265 
266  /// Set to true if this function adjusts the stack -- e.g.,
267  /// when calling another function. This is only valid during and after
268  /// prolog/epilog code insertion.
269  bool AdjustsStack = false;
270 
271  /// Set to true if this function has any function calls.
272  bool HasCalls = false;
273 
274  /// The frame index for the stack protector.
275  int StackProtectorIdx = -1;
276 
277  /// The frame index for the function context. Used for SjLj exceptions.
278  int FunctionContextIdx = -1;
279 
280  /// This contains the size of the largest call frame if the target uses frame
281  /// setup/destroy pseudo instructions (as defined in the TargetFrameInfo
282  /// class). This information is important for frame pointer elimination.
283  /// It is only valid during and after prolog/epilog code insertion.
284  unsigned MaxCallFrameSize = ~0u;
285 
286  /// The number of bytes of callee saved registers that the target wants to
287  /// report for the current function in the CodeView S_FRAMEPROC record.
288  unsigned CVBytesOfCalleeSavedRegisters = 0;
289 
290  /// The prolog/epilog code inserter fills in this vector with each
291  /// callee saved register saved in either the frame or a different
292  /// register. Beyond its use by the prolog/ epilog code inserter,
293  /// this data is used for debug info and exception handling.
294  std::vector<CalleeSavedInfo> CSInfo;
295 
296  /// Has CSInfo been set yet?
297  bool CSIValid = false;
298 
299  /// References to frame indices which are mapped
300  /// into the local frame allocation block. <FrameIdx, LocalOffset>
301  SmallVector<std::pair<int, int64_t>, 32> LocalFrameObjects;
302 
303  /// Size of the pre-allocated local frame block.
304  int64_t LocalFrameSize = 0;
305 
306  /// Required alignment of the local object blob, which is the strictest
307  /// alignment of any object in it.
308  Align LocalFrameMaxAlign;
309 
310  /// Whether the local object blob needs to be allocated together. If not,
311  /// PEI should ignore the isPreAllocated flags on the stack objects and
312  /// just allocate them normally.
313  bool UseLocalStackAllocationBlock = false;
314 
315  /// True if the function dynamically adjusts the stack pointer through some
316  /// opaque mechanism like inline assembly or Win32 EH.
317  bool HasOpaqueSPAdjustment = false;
318 
319  /// True if the function contains operations which will lower down to
320  /// instructions which manipulate the stack pointer.
321  bool HasCopyImplyingStackAdjustment = false;
322 
323  /// True if the function contains a call to the llvm.vastart intrinsic.
324  bool HasVAStart = false;
325 
326  /// True if this is a varargs function that contains a musttail call.
327  bool HasMustTailInVarArgFunc = false;
328 
329  /// True if this function contains a tail call. If so immutable objects like
330  /// function arguments are no longer so. A tail call *can* override fixed
331  /// stack objects like arguments so we can't treat them as immutable.
332  bool HasTailCall = false;
333 
334  /// Not null, if shrink-wrapping found a better place for the prologue.
335  MachineBasicBlock *Save = nullptr;
336  /// Not null, if shrink-wrapping found a better place for the epilogue.
337  MachineBasicBlock *Restore = nullptr;
338 
339 public:
340  explicit MachineFrameInfo(unsigned StackAlignment, bool StackRealignable,
341  bool ForcedRealign)
342  : StackAlignment(assumeAligned(StackAlignment)),
343  StackRealignable(StackRealignable), ForcedRealign(ForcedRealign) {}
344 
345  MachineFrameInfo(const MachineFrameInfo &) = delete;
346 
347  /// Return true if there are any stack objects in this function.
348  bool hasStackObjects() const { return !Objects.empty(); }
349 
350  /// This method may be called any time after instruction
351  /// selection is complete to determine if the stack frame for this function
352  /// contains any variable sized objects.
353  bool hasVarSizedObjects() const { return HasVarSizedObjects; }
354 
355  /// Return the index for the stack protector object.
356  int getStackProtectorIndex() const { return StackProtectorIdx; }
357  void setStackProtectorIndex(int I) { StackProtectorIdx = I; }
358  bool hasStackProtectorIndex() const { return StackProtectorIdx != -1; }
359 
360  /// Return the index for the function context object.
361  /// This object is used for SjLj exceptions.
362  int getFunctionContextIndex() const { return FunctionContextIdx; }
363  void setFunctionContextIndex(int I) { FunctionContextIdx = I; }
364 
365  /// This method may be called any time after instruction
366  /// selection is complete to determine if there is a call to
367  /// \@llvm.frameaddress in this function.
368  bool isFrameAddressTaken() const { return FrameAddressTaken; }
369  void setFrameAddressIsTaken(bool T) { FrameAddressTaken = T; }
370 
371  /// This method may be called any time after
372  /// instruction selection is complete to determine if there is a call to
373  /// \@llvm.returnaddress in this function.
374  bool isReturnAddressTaken() const { return ReturnAddressTaken; }
375  void setReturnAddressIsTaken(bool s) { ReturnAddressTaken = s; }
376 
377  /// This method may be called any time after instruction
378  /// selection is complete to determine if there is a call to builtin
379  /// \@llvm.experimental.stackmap.
380  bool hasStackMap() const { return HasStackMap; }
381  void setHasStackMap(bool s = true) { HasStackMap = s; }
382 
383  /// This method may be called any time after instruction
384  /// selection is complete to determine if there is a call to builtin
385  /// \@llvm.experimental.patchpoint.
386  bool hasPatchPoint() const { return HasPatchPoint; }
387  void setHasPatchPoint(bool s = true) { HasPatchPoint = s; }
388 
389  /// Return the minimum frame object index.
390  int getObjectIndexBegin() const { return -NumFixedObjects; }
391 
392  /// Return one past the maximum frame object index.
393  int getObjectIndexEnd() const { return (int)Objects.size()-NumFixedObjects; }
394 
395  /// Return the number of fixed objects.
396  unsigned getNumFixedObjects() const { return NumFixedObjects; }
397 
398  /// Return the number of objects.
399  unsigned getNumObjects() const { return Objects.size(); }
400 
401  /// Map a frame index into the local object block
402  void mapLocalFrameObject(int ObjectIndex, int64_t Offset) {
403  LocalFrameObjects.push_back(std::pair<int, int64_t>(ObjectIndex, Offset));
404  Objects[ObjectIndex + NumFixedObjects].PreAllocated = true;
405  }
406 
407  /// Get the local offset mapping for a for an object.
408  std::pair<int, int64_t> getLocalFrameObjectMap(int i) const {
409  assert (i >= 0 && (unsigned)i < LocalFrameObjects.size() &&
410  "Invalid local object reference!");
411  return LocalFrameObjects[i];
412  }
413 
414  /// Return the number of objects allocated into the local object block.
415  int64_t getLocalFrameObjectCount() const { return LocalFrameObjects.size(); }
416 
417  /// Set the size of the local object blob.
418  void setLocalFrameSize(int64_t sz) { LocalFrameSize = sz; }
419 
420  /// Get the size of the local object blob.
421  int64_t getLocalFrameSize() const { return LocalFrameSize; }
422 
423  /// Required alignment of the local object blob,
424  /// which is the strictest alignment of any object in it.
425  void setLocalFrameMaxAlign(Align Alignment) {
426  LocalFrameMaxAlign = Alignment;
427  }
428 
429  /// Return the required alignment of the local object blob.
430  Align getLocalFrameMaxAlign() const { return LocalFrameMaxAlign; }
431 
432  /// Get whether the local allocation blob should be allocated together or
433  /// let PEI allocate the locals in it directly.
435  return UseLocalStackAllocationBlock;
436  }
437 
438  /// setUseLocalStackAllocationBlock - Set whether the local allocation blob
439  /// should be allocated together or let PEI allocate the locals in it
440  /// directly.
442  UseLocalStackAllocationBlock = v;
443  }
444 
445  /// Return true if the object was pre-allocated into the local block.
446  bool isObjectPreAllocated(int ObjectIdx) const {
447  assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
448  "Invalid Object Idx!");
449  return Objects[ObjectIdx+NumFixedObjects].PreAllocated;
450  }
451 
452  /// Return the size of the specified object.
453  int64_t getObjectSize(int ObjectIdx) const {
454  assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
455  "Invalid Object Idx!");
456  return Objects[ObjectIdx+NumFixedObjects].Size;
457  }
458 
459  /// Change the size of the specified stack object.
460  void setObjectSize(int ObjectIdx, int64_t Size) {
461  assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
462  "Invalid Object Idx!");
463  Objects[ObjectIdx+NumFixedObjects].Size = Size;
464  }
465 
466  /// Return the alignment of the specified stack object.
467  Align getObjectAlign(int ObjectIdx) const {
468  assert(unsigned(ObjectIdx + NumFixedObjects) < Objects.size() &&
469  "Invalid Object Idx!");
470  return Objects[ObjectIdx + NumFixedObjects].Alignment;
471  }
472 
473  /// setObjectAlignment - Change the alignment of the specified stack object.
474  void setObjectAlignment(int ObjectIdx, Align Alignment) {
475  assert(unsigned(ObjectIdx + NumFixedObjects) < Objects.size() &&
476  "Invalid Object Idx!");
477  Objects[ObjectIdx + NumFixedObjects].Alignment = Alignment;
478 
479  // Only ensure max alignment for the default stack.
480  if (getStackID(ObjectIdx) == 0)
481  ensureMaxAlignment(Alignment);
482  }
483 
484  /// Return the underlying Alloca of the specified
485  /// stack object if it exists. Returns 0 if none exists.
486  const AllocaInst* getObjectAllocation(int ObjectIdx) const {
487  assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
488  "Invalid Object Idx!");
489  return Objects[ObjectIdx+NumFixedObjects].Alloca;
490  }
491 
492  /// Return the assigned stack offset of the specified object
493  /// from the incoming stack pointer.
494  int64_t getObjectOffset(int ObjectIdx) const {
495  assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
496  "Invalid Object Idx!");
497  assert(!isDeadObjectIndex(ObjectIdx) &&
498  "Getting frame offset for a dead object?");
499  return Objects[ObjectIdx+NumFixedObjects].SPOffset;
500  }
501 
502  bool isObjectZExt(int ObjectIdx) const {
503  assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
504  "Invalid Object Idx!");
505  return Objects[ObjectIdx+NumFixedObjects].isZExt;
506  }
507 
508  void setObjectZExt(int ObjectIdx, bool IsZExt) {
509  assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
510  "Invalid Object Idx!");
511  Objects[ObjectIdx+NumFixedObjects].isZExt = IsZExt;
512  }
513 
514  bool isObjectSExt(int ObjectIdx) const {
515  assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
516  "Invalid Object Idx!");
517  return Objects[ObjectIdx+NumFixedObjects].isSExt;
518  }
519 
520  void setObjectSExt(int ObjectIdx, bool IsSExt) {
521  assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
522  "Invalid Object Idx!");
523  Objects[ObjectIdx+NumFixedObjects].isSExt = IsSExt;
524  }
525 
526  /// Set the stack frame offset of the specified object. The
527  /// offset is relative to the stack pointer on entry to the function.
528  void setObjectOffset(int ObjectIdx, int64_t SPOffset) {
529  assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
530  "Invalid Object Idx!");
531  assert(!isDeadObjectIndex(ObjectIdx) &&
532  "Setting frame offset for a dead object?");
533  Objects[ObjectIdx+NumFixedObjects].SPOffset = SPOffset;
534  }
535 
536  SSPLayoutKind getObjectSSPLayout(int ObjectIdx) const {
537  assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
538  "Invalid Object Idx!");
539  return (SSPLayoutKind)Objects[ObjectIdx+NumFixedObjects].SSPLayout;
540  }
541 
542  void setObjectSSPLayout(int ObjectIdx, SSPLayoutKind Kind) {
543  assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
544  "Invalid Object Idx!");
545  assert(!isDeadObjectIndex(ObjectIdx) &&
546  "Setting SSP layout for a dead object?");
547  Objects[ObjectIdx+NumFixedObjects].SSPLayout = Kind;
548  }
549 
550  /// Return the number of bytes that must be allocated to hold
551  /// all of the fixed size frame objects. This is only valid after
552  /// Prolog/Epilog code insertion has finalized the stack frame layout.
553  uint64_t getStackSize() const { return StackSize; }
554 
555  /// Set the size of the stack.
556  void setStackSize(uint64_t Size) { StackSize = Size; }
557 
558  /// Estimate and return the size of the stack frame.
559  uint64_t estimateStackSize(const MachineFunction &MF) const;
560 
561  /// Return the correction for frame offsets.
562  int getOffsetAdjustment() const { return OffsetAdjustment; }
563 
564  /// Set the correction for frame offsets.
565  void setOffsetAdjustment(int Adj) { OffsetAdjustment = Adj; }
566 
567  /// Return the alignment in bytes that this function must be aligned to,
568  /// which is greater than the default stack alignment provided by the target.
569  Align getMaxAlign() const { return MaxAlignment; }
570 
571  /// Make sure the function is at least Align bytes aligned.
572  void ensureMaxAlignment(Align Alignment);
573 
574  /// Return true if this function adjusts the stack -- e.g.,
575  /// when calling another function. This is only valid during and after
576  /// prolog/epilog code insertion.
577  bool adjustsStack() const { return AdjustsStack; }
578  void setAdjustsStack(bool V) { AdjustsStack = V; }
579 
580  /// Return true if the current function has any function calls.
581  bool hasCalls() const { return HasCalls; }
582  void setHasCalls(bool V) { HasCalls = V; }
583 
584  /// Returns true if the function contains opaque dynamic stack adjustments.
585  bool hasOpaqueSPAdjustment() const { return HasOpaqueSPAdjustment; }
586  void setHasOpaqueSPAdjustment(bool B) { HasOpaqueSPAdjustment = B; }
587 
588  /// Returns true if the function contains operations which will lower down to
589  /// instructions which manipulate the stack pointer.
591  return HasCopyImplyingStackAdjustment;
592  }
594  HasCopyImplyingStackAdjustment = B;
595  }
596 
597  /// Returns true if the function calls the llvm.va_start intrinsic.
598  bool hasVAStart() const { return HasVAStart; }
599  void setHasVAStart(bool B) { HasVAStart = B; }
600 
601  /// Returns true if the function is variadic and contains a musttail call.
602  bool hasMustTailInVarArgFunc() const { return HasMustTailInVarArgFunc; }
603  void setHasMustTailInVarArgFunc(bool B) { HasMustTailInVarArgFunc = B; }
604 
605  /// Returns true if the function contains a tail call.
606  bool hasTailCall() const { return HasTailCall; }
607  void setHasTailCall(bool V = true) { HasTailCall = V; }
608 
609  /// Computes the maximum size of a callframe and the AdjustsStack property.
610  /// This only works for targets defining
611  /// TargetInstrInfo::getCallFrameSetupOpcode(), getCallFrameDestroyOpcode(),
612  /// and getFrameSize().
613  /// This is usually computed by the prologue epilogue inserter but some
614  /// targets may call this to compute it earlier.
616 
617  /// Return the maximum size of a call frame that must be
618  /// allocated for an outgoing function call. This is only available if
619  /// CallFrameSetup/Destroy pseudo instructions are used by the target, and
620  /// then only during or after prolog/epilog code insertion.
621  ///
622  unsigned getMaxCallFrameSize() const {
623  // TODO: Enable this assert when targets are fixed.
624  //assert(isMaxCallFrameSizeComputed() && "MaxCallFrameSize not computed yet");
626  return 0;
627  return MaxCallFrameSize;
628  }
630  return MaxCallFrameSize != ~0u;
631  }
632  void setMaxCallFrameSize(unsigned S) { MaxCallFrameSize = S; }
633 
634  /// Returns how many bytes of callee-saved registers the target pushed in the
635  /// prologue. Only used for debug info.
637  return CVBytesOfCalleeSavedRegisters;
638  }
640  CVBytesOfCalleeSavedRegisters = S;
641  }
642 
643  /// Create a new object at a fixed location on the stack.
644  /// All fixed objects should be created before other objects are created for
645  /// efficiency. By default, fixed objects are not pointed to by LLVM IR
646  /// values. This returns an index with a negative value.
647  int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool IsImmutable,
648  bool isAliased = false);
649 
650  /// Create a spill slot at a fixed location on the stack.
651  /// Returns an index with a negative value.
652  int CreateFixedSpillStackObject(uint64_t Size, int64_t SPOffset,
653  bool IsImmutable = false);
654 
655  /// Returns true if the specified index corresponds to a fixed stack object.
656  bool isFixedObjectIndex(int ObjectIdx) const {
657  return ObjectIdx < 0 && (ObjectIdx >= -(int)NumFixedObjects);
658  }
659 
660  /// Returns true if the specified index corresponds
661  /// to an object that might be pointed to by an LLVM IR value.
662  bool isAliasedObjectIndex(int ObjectIdx) const {
663  assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
664  "Invalid Object Idx!");
665  return Objects[ObjectIdx+NumFixedObjects].isAliased;
666  }
667 
668  /// Returns true if the specified index corresponds to an immutable object.
669  bool isImmutableObjectIndex(int ObjectIdx) const {
670  // Tail calling functions can clobber their function arguments.
671  if (HasTailCall)
672  return false;
673  assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
674  "Invalid Object Idx!");
675  return Objects[ObjectIdx+NumFixedObjects].isImmutable;
676  }
677 
678  /// Marks the immutability of an object.
679  void setIsImmutableObjectIndex(int ObjectIdx, bool IsImmutable) {
680  assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
681  "Invalid Object Idx!");
682  Objects[ObjectIdx+NumFixedObjects].isImmutable = IsImmutable;
683  }
684 
685  /// Returns true if the specified index corresponds to a spill slot.
686  bool isSpillSlotObjectIndex(int ObjectIdx) const {
687  assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
688  "Invalid Object Idx!");
689  return Objects[ObjectIdx+NumFixedObjects].isSpillSlot;
690  }
691 
692  bool isStatepointSpillSlotObjectIndex(int ObjectIdx) const {
693  assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
694  "Invalid Object Idx!");
695  return Objects[ObjectIdx+NumFixedObjects].isStatepointSpillSlot;
696  }
697 
698  /// \see StackID
699  uint8_t getStackID(int ObjectIdx) const {
700  return Objects[ObjectIdx+NumFixedObjects].StackID;
701  }
702 
703  /// \see StackID
704  void setStackID(int ObjectIdx, uint8_t ID) {
705  assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
706  "Invalid Object Idx!");
707  Objects[ObjectIdx+NumFixedObjects].StackID = ID;
708  // If ID > 0, MaxAlignment may now be overly conservative.
709  // If ID == 0, MaxAlignment will need to be updated separately.
710  }
711 
712  /// Returns true if the specified index corresponds to a dead object.
713  bool isDeadObjectIndex(int ObjectIdx) const {
714  assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
715  "Invalid Object Idx!");
716  return Objects[ObjectIdx+NumFixedObjects].Size == ~0ULL;
717  }
718 
719  /// Returns true if the specified index corresponds to a variable sized
720  /// object.
721  bool isVariableSizedObjectIndex(int ObjectIdx) const {
722  assert(unsigned(ObjectIdx + NumFixedObjects) < Objects.size() &&
723  "Invalid Object Idx!");
724  return Objects[ObjectIdx + NumFixedObjects].Size == 0;
725  }
726 
728  assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
729  "Invalid Object Idx!");
730  Objects[ObjectIdx+NumFixedObjects].isStatepointSpillSlot = true;
731  assert(isStatepointSpillSlotObjectIndex(ObjectIdx) && "inconsistent");
732  }
733 
734  /// Create a new statically sized stack object, returning
735  /// a nonnegative identifier to represent it.
736  int CreateStackObject(uint64_t Size, Align Alignment, bool isSpillSlot,
737  const AllocaInst *Alloca = nullptr, uint8_t ID = 0);
738 
739  /// Create a new statically sized stack object that represents a spill slot,
740  /// returning a nonnegative identifier to represent it.
741  int CreateSpillStackObject(uint64_t Size, Align Alignment);
742 
743  /// Remove or mark dead a statically sized stack object.
744  void RemoveStackObject(int ObjectIdx) {
745  // Mark it dead.
746  Objects[ObjectIdx+NumFixedObjects].Size = ~0ULL;
747  }
748 
749  /// Notify the MachineFrameInfo object that a variable sized object has been
750  /// created. This must be created whenever a variable sized object is
751  /// created, whether or not the index returned is actually used.
752  int CreateVariableSizedObject(Align Alignment, const AllocaInst *Alloca);
753 
754  /// Returns a reference to call saved info vector for the current function.
755  const std::vector<CalleeSavedInfo> &getCalleeSavedInfo() const {
756  return CSInfo;
757  }
758  /// \copydoc getCalleeSavedInfo()
759  std::vector<CalleeSavedInfo> &getCalleeSavedInfo() { return CSInfo; }
760 
761  /// Used by prolog/epilog inserter to set the function's callee saved
762  /// information.
763  void setCalleeSavedInfo(std::vector<CalleeSavedInfo> CSI) {
764  CSInfo = std::move(CSI);
765  }
766 
767  /// Has the callee saved info been calculated yet?
768  bool isCalleeSavedInfoValid() const { return CSIValid; }
769 
770  void setCalleeSavedInfoValid(bool v) { CSIValid = v; }
771 
772  MachineBasicBlock *getSavePoint() const { return Save; }
773  void setSavePoint(MachineBasicBlock *NewSave) { Save = NewSave; }
774  MachineBasicBlock *getRestorePoint() const { return Restore; }
775  void setRestorePoint(MachineBasicBlock *NewRestore) { Restore = NewRestore; }
776 
777  /// Return a set of physical registers that are pristine.
778  ///
779  /// Pristine registers hold a value that is useless to the current function,
780  /// but that must be preserved - they are callee saved registers that are not
781  /// saved.
782  ///
783  /// Before the PrologueEpilogueInserter has placed the CSR spill code, this
784  /// method always returns an empty set.
785  BitVector getPristineRegs(const MachineFunction &MF) const;
786 
787  /// Used by the MachineFunction printer to print information about
788  /// stack objects. Implemented in MachineFunction.cpp.
789  void print(const MachineFunction &MF, raw_ostream &OS) const;
790 
791  /// dump - Print the function to stderr.
792  void dump(const MachineFunction &MF) const;
793 };
794 
795 } // End llvm namespace
796 
797 #endif
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
i
i
Definition: README.txt:29
llvm::MachineFrameInfo::isObjectZExt
bool isObjectZExt(int ObjectIdx) const
Definition: MachineFrameInfo.h:502
llvm::MachineFrameInfo::isMaxCallFrameSizeComputed
bool isMaxCallFrameSizeComputed() const
Definition: MachineFrameInfo.h:629
llvm::MachineFrameInfo::hasVarSizedObjects
bool hasVarSizedObjects() const
This method may be called any time after instruction selection is complete to determine if the stack ...
Definition: MachineFrameInfo.h:353
llvm::CalleeSavedInfo::setRestored
void setRestored(bool R)
Definition: MachineFrameInfo.h:74
llvm::MachineFrameInfo::estimateStackSize
uint64_t estimateStackSize(const MachineFunction &MF) const
Estimate and return the size of the stack frame.
Definition: MachineFrameInfo.cpp:137
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::MachineFrameInfo::hasVAStart
bool hasVAStart() const
Returns true if the function calls the llvm.va_start intrinsic.
Definition: MachineFrameInfo.h:598
llvm::CalleeSavedInfo::getReg
Register getReg() const
Definition: MachineFrameInfo.h:62
llvm::CalleeSavedInfo::isRestored
bool isRestored() const
Definition: MachineFrameInfo.h:73
llvm::MachineFrameInfo::getNumFixedObjects
unsigned getNumFixedObjects() const
Return the number of fixed objects.
Definition: MachineFrameInfo.h:396
llvm::MachineFrameInfo::setReturnAddressIsTaken
void setReturnAddressIsTaken(bool s)
Definition: MachineFrameInfo.h:375
llvm::MachineFrameInfo::hasCopyImplyingStackAdjustment
bool hasCopyImplyingStackAdjustment() const
Returns true if the function contains operations which will lower down to instructions which manipula...
Definition: MachineFrameInfo.h:590
llvm::MachineFrameInfo::setCVBytesOfCalleeSavedRegisters
void setCVBytesOfCalleeSavedRegisters(unsigned S)
Definition: MachineFrameInfo.h:639
llvm::MachineFrameInfo::getCVBytesOfCalleeSavedRegisters
unsigned getCVBytesOfCalleeSavedRegisters() const
Returns how many bytes of callee-saved registers the target pushed in the prologue.
Definition: MachineFrameInfo.h:636
llvm::MachineFrameInfo::getUseLocalStackAllocationBlock
bool getUseLocalStackAllocationBlock() const
Get whether the local allocation blob should be allocated together or let PEI allocate the locals in ...
Definition: MachineFrameInfo.h:434
llvm::MachineFrameInfo::getOffsetAdjustment
int getOffsetAdjustment() const
Return the correction for frame offsets.
Definition: MachineFrameInfo.h:562
llvm::MachineFrameInfo::setStackSize
void setStackSize(uint64_t Size)
Set the size of the stack.
Definition: MachineFrameInfo.h:556
llvm::MachineFrameInfo::isObjectPreAllocated
bool isObjectPreAllocated(int ObjectIdx) const
Return true if the object was pre-allocated into the local block.
Definition: MachineFrameInfo.h:446
llvm::MachineFrameInfo::SSPLK_LargeArray
@ SSPLK_LargeArray
Array or nested array >= SSP-buffer-size.
Definition: MachineFrameInfo.h:114
llvm::MachineFrameInfo::setMaxCallFrameSize
void setMaxCallFrameSize(unsigned S)
Definition: MachineFrameInfo.h:632
T
#define T
Definition: Mips16ISelLowering.cpp:341
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
llvm::MachineFrameInfo::setAdjustsStack
void setAdjustsStack(bool V)
Definition: MachineFrameInfo.h:578
llvm::MachineFrameInfo::setObjectSize
void setObjectSize(int ObjectIdx, int64_t Size)
Change the size of the specified stack object.
Definition: MachineFrameInfo.h:460
llvm::MachineFrameInfo::RemoveStackObject
void RemoveStackObject(int ObjectIdx)
Remove or mark dead a statically sized stack object.
Definition: MachineFrameInfo.h:744
llvm::MachineFrameInfo::getObjectIndexEnd
int getObjectIndexEnd() const
Return one past the maximum frame object index.
Definition: MachineFrameInfo.h:393
llvm::MachineFrameInfo::CreateVariableSizedObject
int CreateVariableSizedObject(Align Alignment, const AllocaInst *Alloca)
Notify the MachineFrameInfo object that a variable sized object has been created.
Definition: MachineFrameInfo.cpp:74
HasCalls
@ HasCalls
Definition: AArch64InstrInfo.cpp:6347
llvm::MachineFrameInfo::getMaxCallFrameSize
unsigned getMaxCallFrameSize() const
Return the maximum size of a call frame that must be allocated for an outgoing function call.
Definition: MachineFrameInfo.h:622
llvm::MachineFrameInfo::setObjectAlignment
void setObjectAlignment(int ObjectIdx, Align Alignment)
setObjectAlignment - Change the alignment of the specified stack object.
Definition: MachineFrameInfo.h:474
llvm::CalleeSavedInfo::setDstReg
void setDstReg(Register SpillReg)
Definition: MachineFrameInfo.h:69
llvm::MachineFrameInfo::hasStackObjects
bool hasStackObjects() const
Return true if there are any stack objects in this function.
Definition: MachineFrameInfo.h:348
llvm::MachineFrameInfo::setHasStackMap
void setHasStackMap(bool s=true)
Definition: MachineFrameInfo.h:381
llvm::MachineFrameInfo::ensureMaxAlignment
void ensureMaxAlignment(Align Alignment)
Make sure the function is at least Align bytes aligned.
Definition: MachineFrameInfo.cpp:31
llvm::MachineFrameInfo::isReturnAddressTaken
bool isReturnAddressTaken() const
This method may be called any time after instruction selection is complete to determine if there is a...
Definition: MachineFrameInfo.h:374
llvm::MachineFrameInfo::setObjectSSPLayout
void setObjectSSPLayout(int ObjectIdx, SSPLayoutKind Kind)
Definition: MachineFrameInfo.h:542
llvm::MachineFrameInfo::setCalleeSavedInfoValid
void setCalleeSavedInfoValid(bool v)
Definition: MachineFrameInfo.h:770
llvm::MachineFrameInfo::setLocalFrameMaxAlign
void setLocalFrameMaxAlign(Align Alignment)
Required alignment of the local object blob, which is the strictest alignment of any object in it.
Definition: MachineFrameInfo.h:425
int
Clang compiles this i1 i64 store i64 i64 store i64 i64 store i64 i64 store i64 align Which gets codegen d xmm0 movaps rbp movaps rbp movaps rbp movaps rbp rbp rbp rbp rbp It would be better to have movq s of instead of the movaps s LLVM produces ret int
Definition: README.txt:536
llvm::CalleeSavedInfo::DstReg
unsigned DstReg
Definition: MachineFrameInfo.h:38
llvm::MachineFrameInfo::print
void print(const MachineFunction &MF, raw_ostream &OS) const
Used by the MachineFunction printer to print information about stack objects.
Definition: MachineFrameInfo.cpp:212
false
Definition: StackSlotColoring.cpp:142
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::MachineFrameInfo::setHasOpaqueSPAdjustment
void setHasOpaqueSPAdjustment(bool B)
Definition: MachineFrameInfo.h:586
llvm::MachineFrameInfo::getRestorePoint
MachineBasicBlock * getRestorePoint() const
Definition: MachineFrameInfo.h:774
llvm::MachineFrameInfo::getStackID
uint8_t getStackID(int ObjectIdx) const
Definition: MachineFrameInfo.h:699
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::MachineFrameInfo::isAliasedObjectIndex
bool isAliasedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to an object that might be pointed to by an LLVM IR v...
Definition: MachineFrameInfo.h:662
llvm::MachineFrameInfo::SSPLK_None
@ SSPLK_None
Did not trigger a stack protector.
Definition: MachineFrameInfo.h:112
llvm::MachineFrameInfo::getLocalFrameMaxAlign
Align getLocalFrameMaxAlign() const
Return the required alignment of the local object blob.
Definition: MachineFrameInfo.h:430
llvm::MachineFrameInfo::getStackSize
uint64_t getStackSize() const
Return the number of bytes that must be allocated to hold all of the fixed size frame objects.
Definition: MachineFrameInfo.h:553
llvm::MachineFrameInfo::hasMustTailInVarArgFunc
bool hasMustTailInVarArgFunc() const
Returns true if the function is variadic and contains a musttail call.
Definition: MachineFrameInfo.h:602
llvm::MachineFrameInfo::getObjectOffset
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
Definition: MachineFrameInfo.h:494
llvm::BitVector
Definition: BitVector.h:74
Align
uint64_t Align
Definition: ELFObjHandler.cpp:83
llvm::MachineFrameInfo::isFixedObjectIndex
bool isFixedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a fixed stack object.
Definition: MachineFrameInfo.h:656
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
llvm::MachineFrameInfo::getObjectIndexBegin
int getObjectIndexBegin() const
Return the minimum frame object index.
Definition: MachineFrameInfo.h:390
llvm::MachineFrameInfo::isCalleeSavedInfoValid
bool isCalleeSavedInfoValid() const
Has the callee saved info been calculated yet?
Definition: MachineFrameInfo.h:768
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::CalleeSavedInfo::setFrameIdx
void setFrameIdx(int FI)
Definition: MachineFrameInfo.h:65
llvm::MachineBasicBlock
Definition: MachineBasicBlock.h:95
llvm::MachineFrameInfo::isDeadObjectIndex
bool isDeadObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a dead object.
Definition: MachineFrameInfo.h:713
llvm::MachineFrameInfo::CreateSpillStackObject
int CreateSpillStackObject(uint64_t Size, Align Alignment)
Create a new statically sized stack object that represents a spill slot, returning a nonnegative iden...
Definition: MachineFrameInfo.cpp:66
llvm::MachineFrameInfo::getLocalFrameObjectMap
std::pair< int, int64_t > getLocalFrameObjectMap(int i) const
Get the local offset mapping for a for an object.
Definition: MachineFrameInfo.h:408
llvm::MachineFrameInfo::MachineFrameInfo
MachineFrameInfo(unsigned StackAlignment, bool StackRealignable, bool ForcedRealign)
Definition: MachineFrameInfo.h:340
llvm::MachineFrameInfo::setCalleeSavedInfo
void setCalleeSavedInfo(std::vector< CalleeSavedInfo > CSI)
Used by prolog/epilog inserter to set the function's callee saved information.
Definition: MachineFrameInfo.h:763
llvm::CalleeSavedInfo::isSpilledToReg
bool isSpilledToReg() const
Definition: MachineFrameInfo.h:75
llvm::MachineFrameInfo::setHasMustTailInVarArgFunc
void setHasMustTailInVarArgFunc(bool B)
Definition: MachineFrameInfo.h:603
llvm::MachineFrameInfo::CreateFixedSpillStackObject
int CreateFixedSpillStackObject(uint64_t Size, int64_t SPOffset, bool IsImmutable=false)
Create a spill slot at a fixed location on the stack.
Definition: MachineFrameInfo.cpp:102
llvm::MachineFrameInfo::getLocalFrameSize
int64_t getLocalFrameSize() const
Get the size of the local object blob.
Definition: MachineFrameInfo.h:421
uint64_t
llvm::MachineFrameInfo::getObjectSize
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
Definition: MachineFrameInfo.h:453
llvm::CalleeSavedInfo::FrameIdx
int FrameIdx
Definition: MachineFrameInfo.h:37
llvm::MachineFrameInfo::hasStackProtectorIndex
bool hasStackProtectorIndex() const
Definition: MachineFrameInfo.h:358
s
multiplies can be turned into SHL s
Definition: README.txt:370
llvm::MachineFrameInfo::setHasCopyImplyingStackAdjustment
void setHasCopyImplyingStackAdjustment(bool B)
Definition: MachineFrameInfo.h:593
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::assumeAligned
Align assumeAligned(uint64_t Value)
Treats the value 0 as a 1, so Align is always at least 1.
Definition: Alignment.h:103
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::MachineFrameInfo::getObjectAlign
Align getObjectAlign(int ObjectIdx) const
Return the alignment of the specified stack object.
Definition: MachineFrameInfo.h:467
llvm::MachineFrameInfo::computeMaxCallFrameSize
void computeMaxCallFrameSize(const MachineFunction &MF)
Computes the maximum size of a callframe and the AdjustsStack property.
Definition: MachineFrameInfo.cpp:187
llvm::MachineFrameInfo::setObjectOffset
void setObjectOffset(int ObjectIdx, int64_t SPOffset)
Set the stack frame offset of the specified object.
Definition: MachineFrameInfo.h:528
llvm::MachineFrameInfo::setRestorePoint
void setRestorePoint(MachineBasicBlock *NewRestore)
Definition: MachineFrameInfo.h:775
llvm::MachineFrameInfo::setFunctionContextIndex
void setFunctionContextIndex(int I)
Definition: MachineFrameInfo.h:363
llvm::MachineFrameInfo::mapLocalFrameObject
void mapLocalFrameObject(int ObjectIndex, int64_t Offset)
Map a frame index into the local object block.
Definition: MachineFrameInfo.h:402
llvm::MachineFrameInfo::setHasTailCall
void setHasTailCall(bool V=true)
Definition: MachineFrameInfo.h:607
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::MachineFrameInfo::CreateFixedObject
int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool IsImmutable, bool isAliased=false)
Create a new object at a fixed location on the stack.
Definition: MachineFrameInfo.cpp:83
llvm::MachineFrameInfo::setSavePoint
void setSavePoint(MachineBasicBlock *NewSave)
Definition: MachineFrameInfo.h:773
llvm::MachineFunction
Definition: MachineFunction.h:234
llvm::MachineFrameInfo::getCalleeSavedInfo
const std::vector< CalleeSavedInfo > & getCalleeSavedInfo() const
Returns a reference to call saved info vector for the current function.
Definition: MachineFrameInfo.h:755
llvm::MachineFrameInfo::setStackID
void setStackID(int ObjectIdx, uint8_t ID)
Definition: MachineFrameInfo.h:704
llvm::MachineFrameInfo::hasPatchPoint
bool hasPatchPoint() const
This method may be called any time after instruction selection is complete to determine if there is a...
Definition: MachineFrameInfo.h:386
llvm::MachineFrameInfo::isStatepointSpillSlotObjectIndex
bool isStatepointSpillSlotObjectIndex(int ObjectIdx) const
Definition: MachineFrameInfo.h:692
llvm::MachineFrameInfo::setHasCalls
void setHasCalls(bool V)
Definition: MachineFrameInfo.h:582
llvm::MachineFrameInfo::CreateStackObject
int CreateStackObject(uint64_t Size, Align Alignment, bool isSpillSlot, const AllocaInst *Alloca=nullptr, uint8_t ID=0)
Create a new statically sized stack object, returning a nonnegative identifier to represent it.
Definition: MachineFrameInfo.cpp:51
llvm::MachineFrameInfo::getPristineRegs
BitVector getPristineRegs(const MachineFunction &MF) const
Return a set of physical registers that are pristine.
Definition: MachineFrameInfo.cpp:115
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::MachineFrameInfo::isObjectSExt
bool isObjectSExt(int ObjectIdx) const
Definition: MachineFrameInfo.h:514
llvm::MachineFrameInfo::getLocalFrameObjectCount
int64_t getLocalFrameObjectCount() const
Return the number of objects allocated into the local object block.
Definition: MachineFrameInfo.h:415
llvm::MachineFrameInfo::getMaxAlign
Align getMaxAlign() const
Return the alignment in bytes that this function must be aligned to, which is greater than the defaul...
Definition: MachineFrameInfo.h:569
llvm::Register
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
llvm::MachineFrameInfo::isFrameAddressTaken
bool isFrameAddressTaken() const
This method may be called any time after instruction selection is complete to determine if there is a...
Definition: MachineFrameInfo.h:368
llvm::MachineFrameInfo::hasCalls
bool hasCalls() const
Return true if the current function has any function calls.
Definition: MachineFrameInfo.h:581
llvm::MachineFrameInfo::dump
void dump(const MachineFunction &MF) const
dump - Print the function to stderr.
Definition: MachineFrameInfo.cpp:253
llvm::MachineFrameInfo::getSavePoint
MachineBasicBlock * getSavePoint() const
Definition: MachineFrameInfo.h:772
Alignment.h
llvm::MachineFrameInfo::getObjectSSPLayout
SSPLayoutKind getObjectSSPLayout(int ObjectIdx) const
Definition: MachineFrameInfo.h:536
llvm::CalleeSavedInfo
The CalleeSavedInfo class tracks the information need to locate where a callee saved register is in t...
Definition: MachineFrameInfo.h:34
llvm::MachineFrameInfo::isVariableSizedObjectIndex
bool isVariableSizedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a variable sized object.
Definition: MachineFrameInfo.h:721
llvm::MachineFrameInfo::setIsImmutableObjectIndex
void setIsImmutableObjectIndex(int ObjectIdx, bool IsImmutable)
Marks the immutability of an object.
Definition: MachineFrameInfo.h:679
llvm::CalleeSavedInfo::getDstReg
unsigned getDstReg() const
Definition: MachineFrameInfo.h:64
llvm::MachineFrameInfo::setObjectSExt
void setObjectSExt(int ObjectIdx, bool IsSExt)
Definition: MachineFrameInfo.h:520
llvm::MachineFrameInfo::isSpillSlotObjectIndex
bool isSpillSlotObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a spill slot.
Definition: MachineFrameInfo.h:686
llvm::MachineFrameInfo::setStackProtectorIndex
void setStackProtectorIndex(int I)
Definition: MachineFrameInfo.h:357
llvm::MachineFrameInfo::getNumObjects
unsigned getNumObjects() const
Return the number of objects.
Definition: MachineFrameInfo.h:399
llvm::MachineFrameInfo::isImmutableObjectIndex
bool isImmutableObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to an immutable object.
Definition: MachineFrameInfo.h:669
llvm::MachineFrameInfo
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
Definition: MachineFrameInfo.h:107
SmallVector.h
llvm::MachineFrameInfo::SSPLK_AddrOf
@ SSPLK_AddrOf
The address of this allocation is exposed and triggered protection.
Definition: MachineFrameInfo.h:118
llvm::MachineFrameInfo::SSPLayoutKind
SSPLayoutKind
Stack Smashing Protection (SSP) rules require that vulnerable stack allocations are located close the...
Definition: MachineFrameInfo.h:111
llvm::MachineFrameInfo::SSPLK_SmallArray
@ SSPLK_SmallArray
Array or nested array < SSP-buffer-size.
Definition: MachineFrameInfo.h:116
llvm::MachineFrameInfo::setHasPatchPoint
void setHasPatchPoint(bool s=true)
Definition: MachineFrameInfo.h:387
llvm::MachineFrameInfo::markAsStatepointSpillSlotObjectIndex
void markAsStatepointSpillSlotObjectIndex(int ObjectIdx)
Definition: MachineFrameInfo.h:727
llvm::MachineFrameInfo::setOffsetAdjustment
void setOffsetAdjustment(int Adj)
Set the correction for frame offsets.
Definition: MachineFrameInfo.h:565
DataTypes.h
llvm::MachineFrameInfo::hasOpaqueSPAdjustment
bool hasOpaqueSPAdjustment() const
Returns true if the function contains opaque dynamic stack adjustments.
Definition: MachineFrameInfo.h:585
llvm::MachineFrameInfo::getCalleeSavedInfo
std::vector< CalleeSavedInfo > & getCalleeSavedInfo()
Definition: MachineFrameInfo.h:759
llvm::MachineFrameInfo::getStackProtectorIndex
int getStackProtectorIndex() const
Return the index for the stack protector object.
Definition: MachineFrameInfo.h:356
Register.h
llvm::MachineFrameInfo::hasStackMap
bool hasStackMap() const
This method may be called any time after instruction selection is complete to determine if there is a...
Definition: MachineFrameInfo.h:380
llvm::MachineFrameInfo::adjustsStack
bool adjustsStack() const
Return true if this function adjusts the stack – e.g., when calling another function.
Definition: MachineFrameInfo.h:577
llvm::MachineFrameInfo::setFrameAddressIsTaken
void setFrameAddressIsTaken(bool T)
Definition: MachineFrameInfo.h:369
llvm::AllocaInst
an instruction to allocate memory on the stack
Definition: Instructions.h:62
llvm::MachineFrameInfo::hasTailCall
bool hasTailCall() const
Returns true if the function contains a tail call.
Definition: MachineFrameInfo.h:606
llvm::MachineFrameInfo::setObjectZExt
void setObjectZExt(int ObjectIdx, bool IsZExt)
Definition: MachineFrameInfo.h:508
true
basic Basic Alias true
Definition: BasicAliasAnalysis.cpp:1925
llvm::CalleeSavedInfo::getFrameIdx
int getFrameIdx() const
Definition: MachineFrameInfo.h:63
llvm::MachineFrameInfo::setLocalFrameSize
void setLocalFrameSize(int64_t sz)
Set the size of the local object blob.
Definition: MachineFrameInfo.h:418
llvm::MachineFrameInfo::setHasVAStart
void setHasVAStart(bool B)
Definition: MachineFrameInfo.h:599
llvm::CalleeSavedInfo::CalleeSavedInfo
CalleeSavedInfo(unsigned R, int FI=0)
Definition: MachineFrameInfo.h:58
llvm::MachineFrameInfo::setUseLocalStackAllocationBlock
void setUseLocalStackAllocationBlock(bool v)
setUseLocalStackAllocationBlock - Set whether the local allocation blob should be allocated together ...
Definition: MachineFrameInfo.h:441
llvm::MachineFrameInfo::getFunctionContextIndex
int getFunctionContextIndex() const
Return the index for the function context object.
Definition: MachineFrameInfo.h:362
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:37
llvm::MachineFrameInfo::getObjectAllocation
const AllocaInst * getObjectAllocation(int ObjectIdx) const
Return the underlying Alloca of the specified stack object if it exists.
Definition: MachineFrameInfo.h:486