summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2002-03-31 18:57:49 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2002-03-31 18:57:49 +0000
commitf434a9ed5f8621f4ceedf052e76c263a9c149e07 (patch)
tree7c634f2d29670eaadc95c66107bb015f4841ba83 /llvm
parent5bf8890305a8e0a7136b698672652a6e86591974 (diff)
downloadbcm5719-llvm-f434a9ed5f8621f4ceedf052e76c263a9c149e07.tar.gz
bcm5719-llvm-f434a9ed5f8621f4ceedf052e76c263a9c149e07.zip
Include temp. values when computing max. size of stack frame!
llvm-svn: 2070
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/CodeGen/MachineCodeForMethod.h12
-rw-r--r--llvm/include/llvm/CodeGen/MachineFunction.h12
-rw-r--r--llvm/lib/CodeGen/MachineFunction.cpp6
3 files changed, 27 insertions, 3 deletions
diff --git a/llvm/include/llvm/CodeGen/MachineCodeForMethod.h b/llvm/include/llvm/CodeGen/MachineCodeForMethod.h
index d8f3339e170..01c9fd9d24f 100644
--- a/llvm/include/llvm/CodeGen/MachineCodeForMethod.h
+++ b/llvm/include/llvm/CodeGen/MachineCodeForMethod.h
@@ -29,6 +29,7 @@ class MachineCodeForMethod : private Annotation {
unsigned currentOptionalArgsSize;
unsigned maxOptionalArgsSize;
unsigned currentTmpValuesSize;
+ unsigned maxTmpValuesSize;
std::hash_set<const Constant*> constantsForConstPool;
std::hash_map<const Value*, int> offsets;
@@ -108,6 +109,17 @@ private:
regSpillsSize+= incr;
staticStackSize += incr;
}
+ inline void incrementTmpAreaSize(int incr) {
+ currentTmpValuesSize += incr;
+ if (maxTmpValuesSize < currentTmpValuesSize)
+ {
+ staticStackSize += currentTmpValuesSize - maxTmpValuesSize;
+ maxTmpValuesSize = currentTmpValuesSize;
+ }
+ }
+ inline void resetTmpAreaSize() {
+ currentTmpValuesSize = 0;
+ }
inline void incrementCurrentOptionalArgsSize(int incr) {
currentOptionalArgsSize+= incr; // stack size already includes this!
}
diff --git a/llvm/include/llvm/CodeGen/MachineFunction.h b/llvm/include/llvm/CodeGen/MachineFunction.h
index d8f3339e170..01c9fd9d24f 100644
--- a/llvm/include/llvm/CodeGen/MachineFunction.h
+++ b/llvm/include/llvm/CodeGen/MachineFunction.h
@@ -29,6 +29,7 @@ class MachineCodeForMethod : private Annotation {
unsigned currentOptionalArgsSize;
unsigned maxOptionalArgsSize;
unsigned currentTmpValuesSize;
+ unsigned maxTmpValuesSize;
std::hash_set<const Constant*> constantsForConstPool;
std::hash_map<const Value*, int> offsets;
@@ -108,6 +109,17 @@ private:
regSpillsSize+= incr;
staticStackSize += incr;
}
+ inline void incrementTmpAreaSize(int incr) {
+ currentTmpValuesSize += incr;
+ if (maxTmpValuesSize < currentTmpValuesSize)
+ {
+ staticStackSize += currentTmpValuesSize - maxTmpValuesSize;
+ maxTmpValuesSize = currentTmpValuesSize;
+ }
+ }
+ inline void resetTmpAreaSize() {
+ currentTmpValuesSize = 0;
+ }
inline void incrementCurrentOptionalArgsSize(int incr) {
currentOptionalArgsSize+= incr; // stack size already includes this!
}
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp
index de3e4f694f3..ef27dbae71c 100644
--- a/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/llvm/lib/CodeGen/MachineFunction.cpp
@@ -124,7 +124,7 @@ MachineCodeForMethod::MachineCodeForMethod(const Method* _M,
method(_M), compiledAsLeaf(false), staticStackSize(0),
automaticVarsSize(0), regSpillsSize(0),
currentOptionalArgsSize(0), maxOptionalArgsSize(0),
- currentTmpValuesSize(0)
+ currentTmpValuesSize(0), maxTmpValuesSize(0)
{
maxOptionalArgsSize = ComputeMaxOptionalArgsSize(target, method);
staticStackSize = maxOptionalArgsSize
@@ -284,14 +284,14 @@ MachineCodeForMethod::pushTempValue(const TargetMachine& target,
offset = growUp ? firstTmpOffset + offset : firstTmpOffset - offset;
- currentTmpValuesSize += size;
+ incrementTmpAreaSize(size);
return offset;
}
void
MachineCodeForMethod::popAllTempValues(const TargetMachine& target)
{
- currentTmpValuesSize = 0;
+ resetTmpAreaSize();
}
int
OpenPOWER on IntegriCloud