summaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen/MachineFrameInfo.h
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-01-10 02:18:37 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-01-10 02:18:37 +0000
commit0d0e1b58cb800fc838b5752e10f3a261ca8e5e09 (patch)
treef1db48e1cab1df1c9bfd20b6c2ec698b4d9eb375 /include/llvm/CodeGen/MachineFrameInfo.h
parent038129dd58acbb2cd6e80bee05649903897df967 (diff)
downloadllvm-0d0e1b58cb800fc838b5752e10f3a261ca8e5e09.tar.gz
llvm-0d0e1b58cb800fc838b5752e10f3a261ca8e5e09.tar.bz2
llvm-0d0e1b58cb800fc838b5752e10f3a261ca8e5e09.tar.xz
Add a isImmutable bit to StackObject. Fixed stack objects are immutable (in the function) unless specified otherwise.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45812 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineFrameInfo.h')
-rw-r--r--include/llvm/CodeGen/MachineFrameInfo.h23
1 files changed, 18 insertions, 5 deletions
diff --git a/include/llvm/CodeGen/MachineFrameInfo.h b/include/llvm/CodeGen/MachineFrameInfo.h
index bad73fda5f..9b1cacd66e 100644
--- a/include/llvm/CodeGen/MachineFrameInfo.h
+++ b/include/llvm/CodeGen/MachineFrameInfo.h
@@ -86,8 +86,13 @@ class MachineFrameInfo {
// the function. This field has no meaning for a variable sized element.
int64_t SPOffset;
- StackObject(uint64_t Sz, unsigned Al, int64_t SP)
- : Size(Sz), Alignment(Al), SPOffset(SP) {}
+ // isImmutable - If true, the value of the stack object does not change
+ // in this function. By default, fixed objects are immutable unless marked
+ // otherwise.
+ bool isImmutable;
+
+ StackObject(uint64_t Sz, unsigned Al, int64_t SP, bool IM = false)
+ : Size(Sz), Alignment(Al), SPOffset(SP), isImmutable(IM) {}
};
/// Objects - The list of stack objects allocated...
@@ -255,11 +260,13 @@ public:
/// CreateFixedObject - Create a new object at a fixed location on the stack.
/// All fixed objects should be created before other objects are created for
- /// efficiency. This returns an index with a negative value.
+ /// efficiency. By default, fixed objects are immutable. This returns an
+ /// index with a negative value.
///
- int CreateFixedObject(uint64_t Size, int64_t SPOffset) {
+ int CreateFixedObject(uint64_t Size, int64_t SPOffset,
+ bool Immutable = true) {
assert(Size != 0 && "Cannot allocate zero size fixed stack objects!");
- Objects.insert(Objects.begin(), StackObject(Size, 1, SPOffset));
+ Objects.insert(Objects.begin(), StackObject(Size, 1, SPOffset, Immutable));
return -++NumFixedObjects;
}
@@ -269,6 +276,12 @@ public:
return ObjectIdx < 0 && (ObjectIdx >= -(int)NumFixedObjects);
}
+ /// isImmutableObjectIndex - Returns true if the specified index corresponds
+ /// to an immutable object.
+ bool isImmutableObjectIndex(int ObjectIdx) const {
+ return Objects[ObjectIdx+NumFixedObjects].isImmutable;
+ }
+
/// CreateStackObject - Create a new statically sized stack object, returning
/// a postive identifier to represent it.
///