diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 | 
| commit | 044eb2f6afba375a914ac9d8024f8f5142bb912e (patch) | |
| tree | 1475247dc9f9fe5be155ebd4c9069c75aadf8c20 /lib/CodeGen/MachineFrameInfo.cpp | |
| parent | eb70dddbd77e120e5d490bd8fbe7ff3f8fa81c6b (diff) | |
Notes
Diffstat (limited to 'lib/CodeGen/MachineFrameInfo.cpp')
| -rw-r--r-- | lib/CodeGen/MachineFrameInfo.cpp | 47 | 
1 files changed, 27 insertions, 20 deletions
diff --git a/lib/CodeGen/MachineFrameInfo.cpp b/lib/CodeGen/MachineFrameInfo.cpp index 73d778ff3023..2aa9d6b816c8 100644 --- a/lib/CodeGen/MachineFrameInfo.cpp +++ b/lib/CodeGen/MachineFrameInfo.cpp @@ -16,12 +16,12 @@  #include "llvm/ADT/BitVector.h"  #include "llvm/CodeGen/MachineFunction.h"  #include "llvm/CodeGen/MachineRegisterInfo.h" +#include "llvm/CodeGen/TargetFrameLowering.h" +#include "llvm/CodeGen/TargetInstrInfo.h" +#include "llvm/CodeGen/TargetRegisterInfo.h" +#include "llvm/CodeGen/TargetSubtargetInfo.h"  #include "llvm/Support/Debug.h"  #include "llvm/Support/raw_ostream.h" -#include "llvm/Target/TargetFrameLowering.h" -#include "llvm/Target/TargetInstrInfo.h" -#include "llvm/Target/TargetRegisterInfo.h" -#include "llvm/Target/TargetSubtargetInfo.h"  #include <cassert>  #define DEBUG_TYPE "codegen" @@ -47,11 +47,13 @@ static inline unsigned clampStackAlignment(bool ShouldClamp, unsigned Align,  }  int MachineFrameInfo::CreateStackObject(uint64_t Size, unsigned Alignment, -                      bool isSS, const AllocaInst *Alloca) { +                                        bool IsSpillSlot, +                                        const AllocaInst *Alloca, +                                        uint8_t StackID) {    assert(Size != 0 && "Cannot allocate zero size stack objects!");    Alignment = clampStackAlignment(!StackRealignable, Alignment, StackAlignment); -  Objects.push_back(StackObject(Size, Alignment, 0, false, isSS, Alloca, -                                !isSS)); +  Objects.push_back(StackObject(Size, Alignment, 0, false, IsSpillSlot, Alloca, +                                !IsSpillSlot, StackID));    int Index = (int)Objects.size() - NumFixedObjects - 1;    assert(Index >= 0 && "Bad frame index!");    ensureMaxAlignment(Alignment); @@ -77,7 +79,7 @@ int MachineFrameInfo::CreateVariableSizedObject(unsigned Alignment,  }  int MachineFrameInfo::CreateFixedObject(uint64_t Size, int64_t SPOffset, -                                        bool Immutable, bool isAliased) { +                                        bool IsImmutable, bool IsAliased) {    assert(Size != 0 && "Cannot allocate zero size fixed stack objects!");    // The alignment of the frame index can be determined from its offset from    // the incoming frame position.  If the frame object is at offset 32 and @@ -85,23 +87,24 @@ int MachineFrameInfo::CreateFixedObject(uint64_t Size, int64_t SPOffset,    // object is 16-byte aligned. Note that unlike the non-fixed case, if the    // stack needs realignment, we can't assume that the stack will in fact be    // aligned. -  unsigned Align = MinAlign(SPOffset, ForcedRealign ? 1 : StackAlignment); -  Align = clampStackAlignment(!StackRealignable, Align, StackAlignment); -  Objects.insert(Objects.begin(), StackObject(Size, Align, SPOffset, Immutable, -                                              /*isSS*/   false, -                                              /*Alloca*/ nullptr, isAliased)); +  unsigned Alignment = MinAlign(SPOffset, ForcedRealign ? 1 : StackAlignment); +  Alignment = clampStackAlignment(!StackRealignable, Alignment, StackAlignment); +  Objects.insert(Objects.begin(), +                 StackObject(Size, Alignment, SPOffset, IsImmutable, +                             /*isSpillSlot=*/false, /*Alloca=*/nullptr, +                             IsAliased));    return -++NumFixedObjects;  }  int MachineFrameInfo::CreateFixedSpillStackObject(uint64_t Size,                                                    int64_t SPOffset, -                                                  bool Immutable) { -  unsigned Align = MinAlign(SPOffset, ForcedRealign ? 1 : StackAlignment); -  Align = clampStackAlignment(!StackRealignable, Align, StackAlignment); -  Objects.insert(Objects.begin(), StackObject(Size, Align, SPOffset, Immutable, -                                              /*isSS*/ true, -                                              /*Alloca*/ nullptr, -                                              /*isAliased*/ false)); +                                                  bool IsImmutable) { +  unsigned Alignment = MinAlign(SPOffset, ForcedRealign ? 1 : StackAlignment); +  Alignment = clampStackAlignment(!StackRealignable, Alignment, StackAlignment); +  Objects.insert(Objects.begin(), +                 StackObject(Size, Alignment, SPOffset, IsImmutable, +                             /*IsSpillSlot=*/true, /*Alloca=*/nullptr, +                             /*IsAliased=*/false));    return -++NumFixedObjects;  } @@ -212,6 +215,10 @@ void MachineFrameInfo::print(const MachineFunction &MF, raw_ostream &OS) const{    for (unsigned i = 0, e = Objects.size(); i != e; ++i) {      const StackObject &SO = Objects[i];      OS << "  fi#" << (int)(i-NumFixedObjects) << ": "; + +    if (SO.StackID != 0) +      OS << "id=" << SO.StackID << ' '; +      if (SO.Size == ~0ULL) {        OS << "dead\n";        continue;  | 
