diff options
| author | Misha Brukman <brukman+llvm@gmail.com> | 2002-12-13 04:34:02 +0000 |
|---|---|---|
| committer | Misha Brukman <brukman+llvm@gmail.com> | 2002-12-13 04:34:02 +0000 |
| commit | 4ef74c8079476b7c5bdf6fd35622e2b02cc0a735 (patch) | |
| tree | a7ff83bd0cfbe685d2d62a4ca0595ab3cbc6fa2e /llvm/lib/CodeGen | |
| parent | 862f3ef8bc9912333f6cfdb70ae18a8bb831c198 (diff) | |
| download | bcm5719-llvm-4ef74c8079476b7c5bdf6fd35622e2b02cc0a735.tar.gz bcm5719-llvm-4ef74c8079476b7c5bdf6fd35622e2b02cc0a735.zip | |
Start allocating stack space at [ebp-4] to not overwrite the return address.
Also make all loads & stores 4-byte aligned for performance. ;)
llvm-svn: 4982
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/RegAllocSimple.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/RegAllocSimple.cpp b/llvm/lib/CodeGen/RegAllocSimple.cpp index d78a75c92e3..e5f7ddb9e98 100644 --- a/llvm/lib/CodeGen/RegAllocSimple.cpp +++ b/llvm/lib/CodeGen/RegAllocSimple.cpp @@ -50,13 +50,15 @@ namespace { RegAllocSimple(TargetMachine &tm) : TM(tm), CurrMBB(0), maxOffset(0), RegInfo(tm.getRegisterInfo()), - NumBytesAllocated(0), ByteAlignment(4) + ByteAlignment(4) { // build reverse mapping for physReg -> register class RegInfo->buildReg2RegClassMap(PhysReg2RegClassMap); RegsUsed[RegInfo->getFramePointer()] = 1; RegsUsed[RegInfo->getStackPointer()] = 1; + + cleanupAfterFunction(); } bool isAvailableReg(unsigned Reg) { @@ -80,7 +82,7 @@ namespace { void cleanupAfterFunction() { RegMap.clear(); SSA2PhysRegMap.clear(); - NumBytesAllocated = 0; + NumBytesAllocated = 4; } /// Moves value from memory into that register @@ -112,6 +114,7 @@ unsigned RegAllocSimple::allocateStackSpaceFor(unsigned VirtReg, const TargetRegisterClass *regClass) { if (RegMap.find(VirtReg) == RegMap.end()) { +#if 0 unsigned size = regClass->getDataSize(); unsigned over = NumBytesAllocated - (NumBytesAllocated % ByteAlignment); if (size >= ByteAlignment - over) { @@ -120,6 +123,10 @@ unsigned RegAllocSimple::allocateStackSpaceFor(unsigned VirtReg, } RegMap[VirtReg] = NumBytesAllocated; NumBytesAllocated += size; +#endif + // FIXME: forcing each arg to take 4 bytes on the stack + RegMap[VirtReg] = NumBytesAllocated; + NumBytesAllocated += 4; } return RegMap[VirtReg]; } |

