MachineFrameInfo.h revision 198396
1290650Shselasky//===-- CodeGen/MachineFrameInfo.h - Abstract Stack Frame Rep. --*- C++ -*-===//
2290650Shselasky//
3290650Shselasky//                     The LLVM Compiler Infrastructure
4290650Shselasky//
5290650Shselasky// This file is distributed under the University of Illinois Open Source
6290650Shselasky// License. See LICENSE.TXT for details.
7290650Shselasky//
8290650Shselasky//===----------------------------------------------------------------------===//
9290650Shselasky//
10290650Shselasky// The file defines the MachineFrameInfo class.
11290650Shselasky//
12290650Shselasky//===----------------------------------------------------------------------===//
13290650Shselasky
14290650Shselasky#ifndef LLVM_CODEGEN_MACHINEFRAMEINFO_H
15290650Shselasky#define LLVM_CODEGEN_MACHINEFRAMEINFO_H
16290650Shselasky
17290650Shselasky#include "llvm/ADT/BitVector.h"
18290650Shselasky#include "llvm/ADT/DenseSet.h"
19290650Shselasky#include "llvm/Support/DataTypes.h"
20290650Shselasky#include <cassert>
21290650Shselasky#include <vector>
22290650Shselasky
23290650Shselaskynamespace llvm {
24290650Shselaskyclass raw_ostream;
25290650Shselaskyclass TargetData;
26290650Shselaskyclass TargetRegisterClass;
27290650Shselaskyclass Type;
28290650Shselaskyclass MachineModuleInfo;
29290650Shselaskyclass MachineFunction;
30322144Shselaskyclass MachineBasicBlock;
31290650Shselaskyclass TargetFrameInfo;
32290650Shselasky
33290650Shselasky/// The CalleeSavedInfo class tracks the information need to locate where a
34290650Shselasky/// callee saved register in the current frame.
35290650Shselaskyclass CalleeSavedInfo {
36290650Shselasky
37290650Shselaskyprivate:
38290650Shselasky  unsigned Reg;
39290650Shselasky  const TargetRegisterClass *RegClass;
40290650Shselasky  int FrameIdx;
41322146Shselasky
42290650Shselaskypublic:
43290650Shselasky  CalleeSavedInfo(unsigned R, const TargetRegisterClass *RC, int FI = 0)
44290650Shselasky  : Reg(R)
45290650Shselasky  , RegClass(RC)
46290650Shselasky  , FrameIdx(FI)
47290650Shselasky  {}
48290650Shselasky
49290650Shselasky  // Accessors.
50290650Shselasky  unsigned getReg()                        const { return Reg; }
51290650Shselasky  const TargetRegisterClass *getRegClass() const { return RegClass; }
52290650Shselasky  int getFrameIdx()                        const { return FrameIdx; }
53290650Shselasky  void setFrameIdx(int FI)                       { FrameIdx = FI; }
54290650Shselasky};
55290650Shselasky
56290650Shselasky/// The MachineFrameInfo class represents an abstract stack frame until
57290650Shselasky/// prolog/epilog code is inserted.  This class is key to allowing stack frame
58290650Shselasky/// representation optimizations, such as frame pointer elimination.  It also
59290650Shselasky/// allows more mundane (but still important) optimizations, such as reordering
60290650Shselasky/// of abstract objects on the stack frame.
61290650Shselasky///
62290650Shselasky/// To support this, the class assigns unique integer identifiers to stack
63290650Shselasky/// objects requested clients.  These identifiers are negative integers for
64290650Shselasky/// fixed stack objects (such as arguments passed on the stack) or nonnegative
65290650Shselasky/// for objects that may be reordered.  Instructions which refer to stack
66290650Shselasky/// objects use a special MO_FrameIndex operand to represent these frame
67290650Shselasky/// indexes.
68290650Shselasky///
69290650Shselasky/// Because this class keeps track of all references to the stack frame, it
70290650Shselasky/// knows when a variable sized object is allocated on the stack.  This is the
71290650Shselasky/// sole condition which prevents frame pointer elimination, which is an
72290650Shselasky/// important optimization on register-poor architectures.  Because original
73290650Shselasky/// variable sized alloca's in the source program are the only source of
74290650Shselasky/// variable sized stack objects, it is safe to decide whether there will be
75290650Shselasky/// any variable sized objects before all stack objects are known (for
76290650Shselasky/// example, register allocator spill code never needs variable sized
77290650Shselasky/// objects).
78290650Shselasky///
79290650Shselasky/// When prolog/epilog code emission is performed, the final stack frame is
80322146Shselasky/// built and the machine instructions are modified to refer to the actual
81322146Shselasky/// stack offsets of the object, eliminating all MO_FrameIndex operands from
82290650Shselasky/// the program.
83290650Shselasky///
84290650Shselasky/// @brief Abstract Stack Frame Information
85290650Shselaskyclass MachineFrameInfo {
86322146Shselasky
87290650Shselasky  // StackObject - Represent a single object allocated on the stack.
88290650Shselasky  struct StackObject {
89290650Shselasky    // SPOffset - The offset of this object from the stack pointer on entry to
90290650Shselasky    // the function.  This field has no meaning for a variable sized element.
91290650Shselasky    int64_t SPOffset;
92290650Shselasky
93290650Shselasky    // The size of this object on the stack. 0 means a variable sized object,
94290650Shselasky    // ~0ULL means a dead object.
95290650Shselasky    uint64_t Size;
96290650Shselasky
97290650Shselasky    // Alignment - The required alignment of this stack slot.
98290650Shselasky    unsigned Alignment;
99290650Shselasky
100290650Shselasky    // isImmutable - If true, the value of the stack object is set before
101290650Shselasky    // entering the function and is not modified inside the function. By
102290650Shselasky    // default, fixed objects are immutable unless marked otherwise.
103290650Shselasky    bool isImmutable;
104290650Shselasky
105290650Shselasky    // isSpillSlot - If true, the stack object is used as spill slot. It
106290650Shselasky    // cannot alias any other memory objects.
107290650Shselasky    bool isSpillSlot;
108290650Shselasky
109290650Shselasky    StackObject(uint64_t Sz, unsigned Al, int64_t SP = 0, bool IM = false,
110290650Shselasky                bool isSS = false)
111322146Shselasky      : SPOffset(SP), Size(Sz), Alignment(Al), isImmutable(IM),
112290650Shselasky        isSpillSlot(isSS) {}
113290650Shselasky  };
114290650Shselasky
115322146Shselasky  /// Objects - The list of stack objects allocated...
116322146Shselasky  ///
117290650Shselasky  std::vector<StackObject> Objects;
118290650Shselasky
119322146Shselasky  /// NumFixedObjects - This contains the number of fixed objects contained on
120290650Shselasky  /// the stack.  Because fixed objects are stored at a negative index in the
121290650Shselasky  /// Objects list, this is also the index to the 0th object in the list.
122290650Shselasky  ///
123290650Shselasky  unsigned NumFixedObjects;
124290650Shselasky
125290650Shselasky  /// HasVarSizedObjects - This boolean keeps track of whether any variable
126290650Shselasky  /// sized objects have been allocated yet.
127290650Shselasky  ///
128290650Shselasky  bool HasVarSizedObjects;
129290650Shselasky
130290650Shselasky  /// FrameAddressTaken - This boolean keeps track of whether there is a call
131290650Shselasky  /// to builtin \@llvm.frameaddress.
132290650Shselasky  bool FrameAddressTaken;
133290650Shselasky
134290650Shselasky  /// StackSize - The prolog/epilog code inserter calculates the final stack
135290650Shselasky  /// offsets for all of the fixed size objects, updating the Objects list
136290650Shselasky  /// above.  It then updates StackSize to contain the number of bytes that need
137290650Shselasky  /// to be allocated on entry to the function.
138290650Shselasky  ///
139290650Shselasky  uint64_t StackSize;
140290650Shselasky
141290650Shselasky  /// OffsetAdjustment - The amount that a frame offset needs to be adjusted to
142290650Shselasky  /// have the actual offset from the stack/frame pointer.  The exact usage of
143290650Shselasky  /// this is target-dependent, but it is typically used to adjust between
144290650Shselasky  /// SP-relative and FP-relative offsets.  E.G., if objects are accessed via
145290650Shselasky  /// SP then OffsetAdjustment is zero; if FP is used, OffsetAdjustment is set
146290650Shselasky  /// to the distance between the initial SP and the value in FP.  For many
147290650Shselasky  /// targets, this value is only used when generating debug info (via
148290650Shselasky  /// TargetRegisterInfo::getFrameIndexOffset); when generating code, the
149290650Shselasky  /// corresponding adjustments are performed directly.
150290650Shselasky  int OffsetAdjustment;
151290650Shselasky
152290650Shselasky  /// MaxAlignment - The prolog/epilog code inserter may process objects
153290650Shselasky  /// that require greater alignment than the default alignment the target
154290650Shselasky  /// provides. To handle this, MaxAlignment is set to the maximum alignment
155290650Shselasky  /// needed by the objects on the current frame.  If this is greater than the
156290650Shselasky  /// native alignment maintained by the compiler, dynamic alignment code will
157290650Shselasky  /// be needed.
158290650Shselasky  ///
159322146Shselasky  unsigned MaxAlignment;
160290650Shselasky
161290650Shselasky  /// HasCalls - Set to true if this function has any function calls.  This is
162290650Shselasky  /// only valid during and after prolog/epilog code insertion.
163290650Shselasky  bool HasCalls;
164290650Shselasky
165322146Shselasky  /// StackProtectorIdx - The frame index for the stack protector.
166290650Shselasky  int StackProtectorIdx;
167290650Shselasky
168290650Shselasky  /// MaxCallFrameSize - This contains the size of the largest call frame if the
169290650Shselasky  /// target uses frame setup/destroy pseudo instructions (as defined in the
170290650Shselasky  /// TargetFrameInfo class).  This information is important for frame pointer
171290650Shselasky  /// elimination.  If is only valid during and after prolog/epilog code
172290650Shselasky  /// insertion.
173290650Shselasky  ///
174290650Shselasky  unsigned MaxCallFrameSize;
175290650Shselasky
176290650Shselasky  /// CSInfo - The prolog/epilog code inserter fills in this vector with each
177290650Shselasky  /// callee saved register saved in the frame.  Beyond its use by the prolog/
178290650Shselasky  /// epilog code inserter, this data used for debug info and exception
179290650Shselasky  /// handling.
180290650Shselasky  std::vector<CalleeSavedInfo> CSInfo;
181290650Shselasky
182290650Shselasky  /// CSIValid - Has CSInfo been set yet?
183322146Shselasky  bool CSIValid;
184290650Shselasky
185290650Shselasky  /// MMI - This field is set (via setMachineModuleInfo) by a module info
186290650Shselasky  /// consumer (ex. DwarfWriter) to indicate that frame layout information
187290650Shselasky  /// should be acquired.  Typically, it's the responsibility of the target's
188290650Shselasky  /// TargetRegisterInfo prologue/epilogue emitting code to inform
189290650Shselasky  /// MachineModuleInfo of frame layouts.
190290650Shselasky  MachineModuleInfo *MMI;
191290650Shselasky
192290650Shselasky  /// TargetFrameInfo - Target information about frame layout.
193290650Shselasky  ///
194290650Shselasky  const TargetFrameInfo &TFI;
195290650Shselaskypublic:
196290650Shselasky  explicit MachineFrameInfo(const TargetFrameInfo &tfi) : TFI(tfi) {
197290650Shselasky    StackSize = NumFixedObjects = OffsetAdjustment = MaxAlignment = 0;
198290650Shselasky    HasVarSizedObjects = false;
199290650Shselasky    FrameAddressTaken = false;
200290650Shselasky    HasCalls = false;
201290650Shselasky    StackProtectorIdx = -1;
202290650Shselasky    MaxCallFrameSize = 0;
203290650Shselasky    CSIValid = false;
204290650Shselasky    MMI = 0;
205290650Shselasky  }
206290650Shselasky
207290650Shselasky  /// hasStackObjects - Return true if there are any stack objects in this
208290650Shselasky  /// function.
209290650Shselasky  ///
210290650Shselasky  bool hasStackObjects() const { return !Objects.empty(); }
211290650Shselasky
212290650Shselasky  /// hasVarSizedObjects - This method may be called any time after instruction
213290650Shselasky  /// selection is complete to determine if the stack frame for this function
214290650Shselasky  /// contains any variable sized objects.
215290650Shselasky  ///
216290650Shselasky  bool hasVarSizedObjects() const { return HasVarSizedObjects; }
217290650Shselasky
218290650Shselasky  /// getStackProtectorIndex/setStackProtectorIndex - Return the index for the
219290650Shselasky  /// stack protector object.
220290650Shselasky  ///
221290650Shselasky  int getStackProtectorIndex() const { return StackProtectorIdx; }
222290650Shselasky  void setStackProtectorIndex(int I) { StackProtectorIdx = I; }
223290650Shselasky
224290650Shselasky  /// isFrameAddressTaken - This method may be called any time after instruction
225290650Shselasky  /// selection is complete to determine if there is a call to
226290650Shselasky  /// \@llvm.frameaddress in this function.
227290650Shselasky  bool isFrameAddressTaken() const { return FrameAddressTaken; }
228290650Shselasky  void setFrameAddressIsTaken(bool T) { FrameAddressTaken = T; }
229290650Shselasky
230290650Shselasky  /// getObjectIndexBegin - Return the minimum frame object index.
231290650Shselasky  ///
232290650Shselasky  int getObjectIndexBegin() const { return -NumFixedObjects; }
233290650Shselasky
234290650Shselasky  /// getObjectIndexEnd - Return one past the maximum frame object index.
235290650Shselasky  ///
236290650Shselasky  int getObjectIndexEnd() const { return (int)Objects.size()-NumFixedObjects; }
237290650Shselasky
238290650Shselasky  /// getNumFixedObjects() - Return the number of fixed objects.
239290650Shselasky  unsigned getNumFixedObjects() const { return NumFixedObjects; }
240290650Shselasky
241290650Shselasky  /// getNumObjects() - Return the number of objects.
242290650Shselasky  ///
243290650Shselasky  unsigned getNumObjects() const { return Objects.size(); }
244290650Shselasky
245290650Shselasky  /// getObjectSize - Return the size of the specified object.
246290650Shselasky  ///
247290650Shselasky  int64_t getObjectSize(int ObjectIdx) const {
248290650Shselasky    assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
249290650Shselasky           "Invalid Object Idx!");
250308675Shselasky    return Objects[ObjectIdx+NumFixedObjects].Size;
251290650Shselasky  }
252290650Shselasky
253290650Shselasky  /// setObjectSize - Change the size of the specified stack object.
254290650Shselasky  void setObjectSize(int ObjectIdx, int64_t Size) {
255290650Shselasky    assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
256308675Shselasky           "Invalid Object Idx!");
257308675Shselasky    Objects[ObjectIdx+NumFixedObjects].Size = Size;
258290650Shselasky  }
259290650Shselasky
260290650Shselasky  /// getObjectAlignment - Return the alignment of the specified stack object.
261290650Shselasky  unsigned getObjectAlignment(int ObjectIdx) const {
262290650Shselasky    assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
263290650Shselasky           "Invalid Object Idx!");
264290650Shselasky    return Objects[ObjectIdx+NumFixedObjects].Alignment;
265290650Shselasky  }
266290650Shselasky
267290650Shselasky  /// setObjectAlignment - Change the alignment of the specified stack object.
268308675Shselasky  void setObjectAlignment(int ObjectIdx, unsigned Align) {
269290650Shselasky    assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
270290650Shselasky           "Invalid Object Idx!");
271290650Shselasky    Objects[ObjectIdx+NumFixedObjects].Alignment = Align;
272290650Shselasky  }
273290650Shselasky
274290650Shselasky  /// getObjectOffset - Return the assigned stack offset of the specified object
275290650Shselasky  /// from the incoming stack pointer.
276290650Shselasky  ///
277290650Shselasky  int64_t getObjectOffset(int ObjectIdx) const {
278290650Shselasky    assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
279290650Shselasky           "Invalid Object Idx!");
280290650Shselasky    assert(!isDeadObjectIndex(ObjectIdx) &&
281290650Shselasky           "Getting frame offset for a dead object?");
282290650Shselasky    return Objects[ObjectIdx+NumFixedObjects].SPOffset;
283290650Shselasky  }
284290650Shselasky
285290650Shselasky  /// setObjectOffset - Set the stack frame offset of the specified object.  The
286322144Shselasky  /// offset is relative to the stack pointer on entry to the function.
287290650Shselasky  ///
288290650Shselasky  void setObjectOffset(int ObjectIdx, int64_t SPOffset) {
289290650Shselasky    assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
290290650Shselasky           "Invalid Object Idx!");
291290650Shselasky    assert(!isDeadObjectIndex(ObjectIdx) &&
292290650Shselasky           "Setting frame offset for a dead object?");
293290650Shselasky    Objects[ObjectIdx+NumFixedObjects].SPOffset = SPOffset;
294290650Shselasky  }
295290650Shselasky
296290650Shselasky  /// getStackSize - Return the number of bytes that must be allocated to hold
297290650Shselasky  /// all of the fixed size frame objects.  This is only valid after
298290650Shselasky  /// Prolog/Epilog code insertion has finalized the stack frame layout.
299290650Shselasky  ///
300290650Shselasky  uint64_t getStackSize() const { return StackSize; }
301290650Shselasky
302290650Shselasky  /// setStackSize - Set the size of the stack...
303290650Shselasky  ///
304290650Shselasky  void setStackSize(uint64_t Size) { StackSize = Size; }
305290650Shselasky
306290650Shselasky  /// getOffsetAdjustment - Return the correction for frame offsets.
307308675Shselasky  ///
308290650Shselasky  int getOffsetAdjustment() const { return OffsetAdjustment; }
309290650Shselasky
310290650Shselasky  /// setOffsetAdjustment - Set the correction for frame offsets.
311290650Shselasky  ///
312290650Shselasky  void setOffsetAdjustment(int Adj) { OffsetAdjustment = Adj; }
313290650Shselasky
314290650Shselasky  /// getMaxAlignment - Return the alignment in bytes that this function must be
315290650Shselasky  /// aligned to, which is greater than the default stack alignment provided by
316290650Shselasky  /// the target.
317290650Shselasky  ///
318290650Shselasky  unsigned getMaxAlignment() const { return MaxAlignment; }
319290650Shselasky
320290650Shselasky  /// setMaxAlignment - Set the preferred alignment.
321290650Shselasky  ///
322290650Shselasky  void setMaxAlignment(unsigned Align) { MaxAlignment = Align; }
323290650Shselasky
324290650Shselasky  /// hasCalls - Return true if the current function has no function calls.
325290650Shselasky  /// This is only valid during or after prolog/epilog code emission.
326290650Shselasky  ///
327290650Shselasky  bool hasCalls() const { return HasCalls; }
328290650Shselasky  void setHasCalls(bool V) { HasCalls = V; }
329290650Shselasky
330290650Shselasky  /// getMaxCallFrameSize - Return the maximum size of a call frame that must be
331290650Shselasky  /// allocated for an outgoing function call.  This is only available if
332290650Shselasky  /// CallFrameSetup/Destroy pseudo instructions are used by the target, and
333290650Shselasky  /// then only during or after prolog/epilog code insertion.
334290650Shselasky  ///
335290650Shselasky  unsigned getMaxCallFrameSize() const { return MaxCallFrameSize; }
336290650Shselasky  void setMaxCallFrameSize(unsigned S) { MaxCallFrameSize = S; }
337290650Shselasky
338290650Shselasky  /// CreateFixedObject - Create a new object at a fixed location on the stack.
339290650Shselasky  /// All fixed objects should be created before other objects are created for
340290650Shselasky  /// efficiency. By default, fixed objects are immutable. This returns an
341290650Shselasky  /// index with a negative value.
342290650Shselasky  ///
343290650Shselasky  int CreateFixedObject(uint64_t Size, int64_t SPOffset,
344290650Shselasky                        bool Immutable = true);
345290650Shselasky
346290650Shselasky
347290650Shselasky  /// isFixedObjectIndex - Returns true if the specified index corresponds to a
348290650Shselasky  /// fixed stack object.
349290650Shselasky  bool isFixedObjectIndex(int ObjectIdx) const {
350290650Shselasky    return ObjectIdx < 0 && (ObjectIdx >= -(int)NumFixedObjects);
351290650Shselasky  }
352290650Shselasky
353290650Shselasky  /// isImmutableObjectIndex - Returns true if the specified index corresponds
354290650Shselasky  /// to an immutable object.
355290650Shselasky  bool isImmutableObjectIndex(int ObjectIdx) const {
356290650Shselasky    assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
357290650Shselasky           "Invalid Object Idx!");
358290650Shselasky    return Objects[ObjectIdx+NumFixedObjects].isImmutable;
359290650Shselasky  }
360322144Shselasky
361290650Shselasky  /// isSpillSlotObjectIndex - Returns true if the specified index corresponds
362290650Shselasky  /// to a spill slot..
363290650Shselasky  bool isSpillSlotObjectIndex(int ObjectIdx) const {
364290650Shselasky    assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
365290650Shselasky           "Invalid Object Idx!");
366290650Shselasky    return Objects[ObjectIdx+NumFixedObjects].isSpillSlot;;
367290650Shselasky  }
368290650Shselasky
369290650Shselasky  /// isDeadObjectIndex - Returns true if the specified index corresponds to
370290650Shselasky  /// a dead object.
371290650Shselasky  bool isDeadObjectIndex(int ObjectIdx) const {
372290650Shselasky    assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
373290650Shselasky           "Invalid Object Idx!");
374290650Shselasky    return Objects[ObjectIdx+NumFixedObjects].Size == ~0ULL;
375290650Shselasky  }
376290650Shselasky
377290650Shselasky  /// CreateStackObject - Create a new statically sized stack object, returning
378290650Shselasky  /// a nonnegative identifier to represent it.
379290650Shselasky  ///
380290650Shselasky  int CreateStackObject(uint64_t Size, unsigned Alignment, bool isSS = false) {
381290650Shselasky    assert(Size != 0 && "Cannot allocate zero size stack objects!");
382290650Shselasky    Objects.push_back(StackObject(Size, Alignment, 0, false, isSS));
383290650Shselasky    return (int)Objects.size()-NumFixedObjects-1;
384290650Shselasky  }
385290650Shselasky
386290650Shselasky  /// RemoveStackObject - Remove or mark dead a statically sized stack object.
387290650Shselasky  ///
388290650Shselasky  void RemoveStackObject(int ObjectIdx) {
389290650Shselasky    // Mark it dead.
390290650Shselasky    Objects[ObjectIdx+NumFixedObjects].Size = ~0ULL;
391290650Shselasky  }
392290650Shselasky
393290650Shselasky  /// CreateVariableSizedObject - Notify the MachineFrameInfo object that a
394290650Shselasky  /// variable sized object has been created.  This must be created whenever a
395290650Shselasky  /// variable sized object is created, whether or not the index returned is
396290650Shselasky  /// actually used.
397290650Shselasky  ///
398290650Shselasky  int CreateVariableSizedObject() {
399290650Shselasky    HasVarSizedObjects = true;
400290650Shselasky    Objects.push_back(StackObject(0, 1));
401290650Shselasky    return (int)Objects.size()-NumFixedObjects-1;
402290650Shselasky  }
403290650Shselasky
404290650Shselasky  /// getCalleeSavedInfo - Returns a reference to call saved info vector for the
405290650Shselasky  /// current function.
406290650Shselasky  const std::vector<CalleeSavedInfo> &getCalleeSavedInfo() const {
407290650Shselasky    return CSInfo;
408290650Shselasky  }
409290650Shselasky
410290650Shselasky  /// setCalleeSavedInfo - Used by prolog/epilog inserter to set the function's
411290650Shselasky  /// callee saved information.
412290650Shselasky  void  setCalleeSavedInfo(const std::vector<CalleeSavedInfo> &CSI) {
413290650Shselasky    CSInfo = CSI;
414290650Shselasky  }
415290650Shselasky
416290650Shselasky  /// isCalleeSavedInfoValid - Has the callee saved info been calculated yet?
417290650Shselasky  bool isCalleeSavedInfoValid() const { return CSIValid; }
418290650Shselasky
419290650Shselasky  void setCalleeSavedInfoValid(bool v) { CSIValid = v; }
420290650Shselasky
421290650Shselasky  /// getPristineRegs - Return a set of physical registers that are pristine on
422290650Shselasky  /// entry to the MBB.
423290650Shselasky  ///
424290650Shselasky  /// Pristine registers hold a value that is useless to the current function,
425290650Shselasky  /// but that must be preserved - they are callee saved registers that have not
426290650Shselasky  /// been saved yet.
427290650Shselasky  ///
428322144Shselasky  /// Before the PrologueEpilogueInserter has placed the CSR spill code, this
429322144Shselasky  /// method always returns an empty set.
430322144Shselasky  BitVector getPristineRegs(const MachineBasicBlock *MBB) const;
431322144Shselasky
432322144Shselasky  /// getMachineModuleInfo - Used by a prologue/epilogue
433322144Shselasky  /// emitter (TargetRegisterInfo) to provide frame layout information.
434322144Shselasky  MachineModuleInfo *getMachineModuleInfo() const { return MMI; }
435322144Shselasky
436322144Shselasky  /// setMachineModuleInfo - Used by a meta info consumer (DwarfWriter) to
437322144Shselasky  /// indicate that frame layout information should be gathered.
438322144Shselasky  void setMachineModuleInfo(MachineModuleInfo *mmi) { MMI = mmi; }
439322144Shselasky
440322144Shselasky  /// print - Used by the MachineFunction printer to print information about
441322144Shselasky  /// stack objects.  Implemented in MachineFunction.cpp
442322144Shselasky  ///
443322144Shselasky  void print(const MachineFunction &MF, raw_ostream &OS) const;
444322144Shselasky
445322144Shselasky  /// dump - Print the function to stderr.
446322144Shselasky  void dump(const MachineFunction &MF) const;
447322144Shselasky};
448322144Shselasky
449322144Shselasky} // End llvm namespace
450322144Shselasky
451322144Shselasky#endif
452322144Shselasky