aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2003-07-02 06:59:22 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2003-07-02 06:59:22 +0000
commitea28dd3392a7548b8710475c4b9fe525e76558f0 (patch)
treed52d64c93164e36d1d638dc0218ffc8dd84fd26c /lib
parent44cfdf9b9a682d0d3f90949a50d23670b11ce561 (diff)
downloadexternal_llvm-ea28dd3392a7548b8710475c4b9fe525e76558f0.zip
external_llvm-ea28dd3392a7548b8710475c4b9fe525e76558f0.tar.gz
external_llvm-ea28dd3392a7548b8710475c4b9fe525e76558f0.tar.bz2
Force fixed-size but large alloca objects to the dynamically allocated
area to avoid using up precious stack space within the 4095 offset limit from %fp. Such objects that would themselves live at a large offset were being put there already so this is a simple change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7066 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/SparcV9/SparcV9InstrSelection.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/Target/SparcV9/SparcV9InstrSelection.cpp b/lib/Target/SparcV9/SparcV9InstrSelection.cpp
index 086b4a3..58c15ed 100644
--- a/lib/Target/SparcV9/SparcV9InstrSelection.cpp
+++ b/lib/Target/SparcV9/SparcV9InstrSelection.cpp
@@ -1109,15 +1109,21 @@ CreateCodeForFixedSizeAlloca(const TargetMachine& target,
Function *F = result->getParent()->getParent();
MachineFunction &mcInfo = MachineFunction::get(F);
- // Check if the offset would small enough to use as an immediate in
- // load/stores (check LDX because all load/stores have the same-size immediate
- // field). If not, put the variable in the dynamically sized area of the
- // frame.
- unsigned paddedSizeIgnored;
+ // Put the variable in the dynamically sized area of the frame if either:
+ // (a) The offset is too large to use as an immediate in load/stores
+ // (check LDX because all load/stores have the same-size immed. field).
+ // (b) The object is "large", so it could cause many other locals,
+ // spills, and temporaries to have large offsets.
+ // NOTE: We use LARGE = 8 * argSlotSize = 64 bytes.
+ // You've gotta love having only 13 bits for constant offset values :-|.
+ //
+ unsigned paddedSize;
int offsetFromFP = mcInfo.getInfo()->computeOffsetforLocalVar(result,
- paddedSizeIgnored,
- tsize * numElements);
- if (! target.getInstrInfo().constantFitsInImmedField(V9::LDXi,offsetFromFP)) {
+ paddedSize,
+ tsize * numElements);
+
+ if (((int)paddedSize) > 8 * target.getFrameInfo().getSizeOfEachArgOnStack() ||
+ ! target.getInstrInfo().constantFitsInImmedField(V9::LDXi,offsetFromFP)) {
CreateCodeForVariableSizeAlloca(target, result, tsize,
ConstantSInt::get(Type::IntTy,numElements),
getMvec);