[llvm-commits] CVS: llvm/lib/Target/Sparc/SparcInstrSelection.cpp
Vikram Adve
vadve at cs.uiuc.edu
Wed Jul 2 02:00:02 PDT 2003
Changes in directory llvm/lib/Target/Sparc:
SparcInstrSelection.cpp updated: 1.104 -> 1.105
---
Log message:
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.
---
Diffs of the changes:
Index: llvm/lib/Target/Sparc/SparcInstrSelection.cpp
diff -u llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.104 llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.105
--- llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.104 Tue Jul 1 20:13:57 2003
+++ llvm/lib/Target/Sparc/SparcInstrSelection.cpp Wed Jul 2 01:59:22 2003
@@ -1109,15 +1109,21 @@
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);
More information about the llvm-commits
mailing list