diff options
Diffstat (limited to 'include/llvm/CodeGen/MachineFrameInfo.h')
-rw-r--r-- | include/llvm/CodeGen/MachineFrameInfo.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/include/llvm/CodeGen/MachineFrameInfo.h b/include/llvm/CodeGen/MachineFrameInfo.h index 9934bf6a94..856fb34bfa 100644 --- a/include/llvm/CodeGen/MachineFrameInfo.h +++ b/include/llvm/CodeGen/MachineFrameInfo.h @@ -80,7 +80,8 @@ class MachineFrameInfo { // StackObject - Represent a single object allocated on the stack. struct StackObject { - // The size of this object on the stack. 0 means a variable sized object + // The size of this object on the stack. 0 means a variable sized object, + // ~0ULL means a dead object. uint64_t Size; // Alignment - The required alignment of this stack slot. @@ -292,6 +293,14 @@ public: return Objects[ObjectIdx+NumFixedObjects].isImmutable; } + /// isDeadObjectIndex - Returns true if the specified index corresponds to + /// a dead object. + bool isDeadObjectIndex(int ObjectIdx) const { + assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() && + "Invalid Object Idx!"); + return Objects[ObjectIdx+NumFixedObjects].Size == ~0ULL; + } + /// CreateStackObject - Create a new statically sized stack object, returning /// a postive identifier to represent it. /// @@ -304,6 +313,17 @@ public: return Objects.size()-NumFixedObjects-1; } + /// RemoveStackObject - Remove or mark dead a statically sized stack object. + /// + void RemoveStackObject(int ObjectIdx) { + if (ObjectIdx == (int)(Objects.size()-NumFixedObjects-1)) + // Last object, simply pop it off the list. + Objects.pop_back(); + else + // Mark it dead. + Objects[ObjectIdx+NumFixedObjects].Size = ~0ULL; + } + /// CreateVariableSizedObject - Notify the MachineFrameInfo object that a /// variable sized object has been created. This must be created whenever a /// variable sized object is created, whether or not the index returned is |