aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/CodeGen/MachineFrameInfo.h
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2010-02-13 01:56:41 +0000
committerEvan Cheng <evan.cheng@apple.com>2010-02-13 01:56:41 +0000
commit7545f49a5edfe19612d03e683d8b955c03018056 (patch)
treebe6cf7aad5799832c2c8bc1943186e0c604ad373 /include/llvm/CodeGen/MachineFrameInfo.h
parentf0907fe59093753fe5a9e8fe5adc399dbdc94627 (diff)
downloadexternal_llvm-7545f49a5edfe19612d03e683d8b955c03018056.zip
external_llvm-7545f49a5edfe19612d03e683d8b955c03018056.tar.gz
external_llvm-7545f49a5edfe19612d03e683d8b955c03018056.tar.bz2
Teach MachineFrameInfo to track maximum alignment while stack objects are being
created. This ensures it's updated at all time. It means targets which perform dynamic stack alignment would know whether it is required and whether frame pointer register cannot be made available register allocation. This is a fix for rdar://7625239. Sorry, I can't create a reasonably sized test case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96069 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineFrameInfo.h')
-rw-r--r--include/llvm/CodeGen/MachineFrameInfo.h16
1 files changed, 3 insertions, 13 deletions
diff --git a/include/llvm/CodeGen/MachineFrameInfo.h b/include/llvm/CodeGen/MachineFrameInfo.h
index 968e4ea..043e97f 100644
--- a/include/llvm/CodeGen/MachineFrameInfo.h
+++ b/include/llvm/CodeGen/MachineFrameInfo.h
@@ -276,6 +276,7 @@ public:
assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
"Invalid Object Idx!");
Objects[ObjectIdx+NumFixedObjects].Alignment = Align;
+ MaxAlignment = std::max(MaxAlignment, Align);
}
/// getObjectOffset - Return the assigned stack offset of the specified object
@@ -328,19 +329,6 @@ public:
///
void setMaxAlignment(unsigned Align) { MaxAlignment = Align; }
- /// calculateMaxStackAlignment() - If there is a local object which requires
- /// greater alignment than the current max alignment, adjust accordingly.
- void calculateMaxStackAlignment() {
- for (int i = getObjectIndexBegin(),
- e = getObjectIndexEnd(); i != e; ++i) {
- if (isDeadObjectIndex(i))
- continue;
-
- unsigned Align = getObjectAlignment(i);
- MaxAlignment = std::max(MaxAlignment, Align);
- }
- }
-
/// hasCalls - Return true if the current function has no function calls.
/// This is only valid during or after prolog/epilog code emission.
///
@@ -402,6 +390,7 @@ public:
Objects.push_back(StackObject(Size, Alignment, 0, false, isSS));
int Index = (int)Objects.size()-NumFixedObjects-1;
assert(Index >= 0 && "Bad frame index!");
+ MaxAlignment = std::max(MaxAlignment, Alignment);
return Index;
}
@@ -412,6 +401,7 @@ public:
int CreateSpillStackObject(uint64_t Size, unsigned Alignment) {
CreateStackObject(Size, Alignment, true);
int Index = (int)Objects.size()-NumFixedObjects-1;
+ MaxAlignment = std::max(MaxAlignment, Alignment);
return Index;
}