aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/PrologEpilogInserter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-15 00:14:20 +0000
committerChris Lattner <sabre@nondot.org>2004-02-15 00:14:20 +0000
commit05d8350c12d8d81de1d8af6f7da155bc1c1da50e (patch)
treefb9a0bcff4ff3eaae17b63d2eba6b36273d74dfe /lib/CodeGen/PrologEpilogInserter.cpp
parentc81efdc59cd2ce5410cefd7ab5cb52cfd7ac3aad (diff)
Allow for fixed objects to reside in the local area, and if they don't to not
clobber them by allocating other objects in the same space! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11454 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/PrologEpilogInserter.cpp')
-rw-r--r--lib/CodeGen/PrologEpilogInserter.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/CodeGen/PrologEpilogInserter.cpp b/lib/CodeGen/PrologEpilogInserter.cpp
index bf1726d6ed..30e7eb6958 100644
--- a/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/lib/CodeGen/PrologEpilogInserter.cpp
@@ -24,8 +24,7 @@
#include "llvm/Target/MRegisterInfo.h"
#include "llvm/Target/TargetFrameInfo.h"
#include "llvm/Target/TargetInstrInfo.h"
-
-namespace llvm {
+using namespace llvm;
namespace {
struct PEI : public MachineFunctionPass {
@@ -72,7 +71,7 @@ namespace {
/// createPrologEpilogCodeInserter - This function returns a pass that inserts
/// prolog and epilog code, and eliminates abstract frame references.
///
-FunctionPass *createPrologEpilogCodeInserter() { return new PEI(); }
+FunctionPass *llvm::createPrologEpilogCodeInserter() { return new PEI(); }
/// saveCallerSavedRegisters - Scan the function for modified caller saved
@@ -203,8 +202,18 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &Fn) {
unsigned StackAlignment = TFI.getStackAlignment();
- // Start at the beginning of the local area...
+ // Start at the beginning of the local area.
int Offset = TFI.getOffsetOfLocalArea();
+
+ // Check to see if there are any fixed sized objects that are preallocated in
+ // the local area. We currently don't support filling in holes in between
+ // fixed sized objects, so we just skip to the end of the last fixed sized
+ // preallocated object.
+ for (int i = FFI->getObjectIndexBegin(); i != 0; ++i) {
+ int FixedOff = -FFI->getObjectOffset(i);
+ if (FixedOff > Offset) Offset = FixedOff;
+ }
+
for (unsigned i = 0, e = FFI->getObjectIndexEnd(); i != e; ++i) {
Offset += FFI->getObjectSize(i); // Allocate Size bytes...
@@ -265,5 +274,3 @@ void PEI::replaceFrameIndices(MachineFunction &Fn) {
break;
}
}
-
-} // End llvm namespace