diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2015-05-27 18:44:32 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2015-05-27 18:44:32 +0000 | 
| commit | 5a5ac124e1efaf208671f01c46edb15f29ed2a0b (patch) | |
| tree | a6140557876943cdd800ee997c9317283394b22c /include/llvm/CodeGen/MachineFrameInfo.h | |
| parent | f03b5bed27d0d2eafd68562ce14f8b5e3f1f0801 (diff) | |
Notes
Diffstat (limited to 'include/llvm/CodeGen/MachineFrameInfo.h')
| -rw-r--r-- | include/llvm/CodeGen/MachineFrameInfo.h | 34 | 
1 files changed, 30 insertions, 4 deletions
diff --git a/include/llvm/CodeGen/MachineFrameInfo.h b/include/llvm/CodeGen/MachineFrameInfo.h index 667736021f927..40f3b4944cc1e 100644 --- a/include/llvm/CodeGen/MachineFrameInfo.h +++ b/include/llvm/CodeGen/MachineFrameInfo.h @@ -246,6 +246,21 @@ class MachineFrameInfo {    /// True if this is a varargs function that contains a musttail call.    bool HasMustTailInVarArgFunc; +  /// True if this function contains a tail call. If so immutable objects like +  /// function arguments are no longer so. A tail call *can* override fixed +  /// stack objects like arguments so we can't treat them as immutable. +  bool HasTailCall; + +  /// Not null, if shrink-wrapping found a better place for the prologue. +  MachineBasicBlock *Save; +  /// Not null, if shrink-wrapping found a better place for the epilogue. +  MachineBasicBlock *Restore; + +  /// Check if it exists a path from \p MBB leading to the basic +  /// block with a SavePoint (a.k.a. prologue). +  bool isBeforeSavePoint(const MachineFunction &MF, +                         const MachineBasicBlock &MBB) const; +  public:    explicit MachineFrameInfo(unsigned StackAlign, bool isStackRealign,                              bool RealignOpt) @@ -269,6 +284,9 @@ public:      HasInlineAsmWithSPAdjust = false;      HasVAStart = false;      HasMustTailInVarArgFunc = false; +    Save = nullptr; +    Restore = nullptr; +    HasTailCall = false;    }    /// hasStackObjects - Return true if there are any stack objects in this @@ -496,6 +514,10 @@ public:    bool hasMustTailInVarArgFunc() const { return HasMustTailInVarArgFunc; }    void setHasMustTailInVarArgFunc(bool B) { HasMustTailInVarArgFunc = B; } +  /// Returns true if the function contains a tail call. +  bool hasTailCall() const { return HasTailCall; } +  void setHasTailCall() { HasTailCall = true; } +    /// getMaxCallFrameSize - Return the maximum size of a call frame that must be    /// allocated for an outgoing function call.  This is only available if    /// CallFrameSetup/Destroy pseudo instructions are used by the target, and @@ -516,10 +538,6 @@ public:    /// on the stack.  Returns an index with a negative value.    int CreateFixedSpillStackObject(uint64_t Size, int64_t SPOffset); -  /// Allocates memory at a fixed, target-specific offset from the frame -  /// pointer. Marks the function as having its frame address taken. -  int CreateFrameAllocation(uint64_t Size); -    /// isFixedObjectIndex - Returns true if the specified index corresponds to a    /// fixed stack object.    bool isFixedObjectIndex(int ObjectIdx) const { @@ -537,6 +555,9 @@ public:    /// isImmutableObjectIndex - Returns true if the specified index corresponds    /// to an immutable object.    bool isImmutableObjectIndex(int ObjectIdx) const { +    // Tail calling functions can clobber their function arguments. +    if (HasTailCall) +      return false;      assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&             "Invalid Object Idx!");      return Objects[ObjectIdx+NumFixedObjects].isImmutable; @@ -601,6 +622,11 @@ public:    void setCalleeSavedInfoValid(bool v) { CSIValid = v; } +  MachineBasicBlock *getSavePoint() const { return Save; } +  void setSavePoint(MachineBasicBlock *NewSave) { Save = NewSave; } +  MachineBasicBlock *getRestorePoint() const { return Restore; } +  void setRestorePoint(MachineBasicBlock *NewRestore) { Restore = NewRestore; } +    /// getPristineRegs - Return a set of physical registers that are pristine on    /// entry to the MBB.    ///  | 
