forked from OSchip/llvm-project
SPARC v9 stack pointer bias.
64-bit SPARC v9 processes use biased stack and frame pointers, so the current function's stack frame is located at %sp+BIAS .. %fp+BIAS where BIAS = 2047. This makes more local variables directly accessible via [%fp+simm13] addressing. llvm-svn: 178965
This commit is contained in:
parent
63742f1379
commit
03d9f7fda6
|
@ -74,8 +74,9 @@ SparcRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
|||
|
||||
// Addressable stack objects are accessed using neg. offsets from %fp
|
||||
MachineFunction &MF = *MI.getParent()->getParent();
|
||||
int Offset = MF.getFrameInfo()->getObjectOffset(FrameIndex) +
|
||||
MI.getOperand(FIOperandNum + 1).getImm();
|
||||
int64_t Offset = MF.getFrameInfo()->getObjectOffset(FrameIndex) +
|
||||
MI.getOperand(FIOperandNum + 1).getImm() +
|
||||
Subtarget.getStackPointerBias();
|
||||
|
||||
// Replace frame index with a frame pointer reference.
|
||||
if (Offset >= -4096 && Offset <= 4095) {
|
||||
|
|
|
@ -52,6 +52,12 @@ public:
|
|||
}
|
||||
return std::string(p);
|
||||
}
|
||||
|
||||
/// The 64-bit ABI uses biased stack and frame pointers, so the stack frame
|
||||
/// of the current function is the area from [%sp+BIAS] to [%fp+BIAS].
|
||||
int64_t getStackPointerBias() const {
|
||||
return is64Bit() ? 2047 : 0;
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
|
|
@ -7,10 +7,9 @@
|
|||
; CHECK: st %i3, [%i4]
|
||||
; CHECK: stx %i4, [%i4]
|
||||
; CHECK: st %i5, [%i4]
|
||||
; FIXME: Stack bias
|
||||
; CHECK: ld [%fp+180], [[R:%[gilo][0-7]]]
|
||||
; CHECK: ld [%fp+2227], [[R:%[gilo][0-7]]]
|
||||
; CHECK: st [[R]], [%i4]
|
||||
; CHECK: ldx [%fp+184], [[R:%[gilo][0-7]]]
|
||||
; CHECK: ldx [%fp+2231], [[R:%[gilo][0-7]]]
|
||||
; CHECK: stx [[R]], [%i4]
|
||||
define void @intarg(i8 %a0, ; %i0
|
||||
i8 %a1, ; %i1
|
||||
|
@ -39,8 +38,7 @@ define void @intarg(i8 %a0, ; %i0
|
|||
; CHECK: faddd %f2,
|
||||
; CHECK: faddd %f4,
|
||||
; CHECK: faddd %f6,
|
||||
; FIXME: Stack bias
|
||||
; CHECK: ld [%fp+260], [[F:%f[0-9]+]]
|
||||
; CHECK: ld [%fp+2307], [[F:%f[0-9]+]]
|
||||
; CHECK: fadds %f31, [[F]]
|
||||
define double @floatarg(float %a0, ; %f1
|
||||
double %a1, ; %d2
|
||||
|
@ -74,8 +72,8 @@ define double @floatarg(float %a0, ; %f1
|
|||
; CHECK: fstod %f3
|
||||
; CHECK: faddd %f6
|
||||
; CHECK: faddd %f16
|
||||
; CHECK: ldx [%fp+184]
|
||||
; CHECK: ldx [%fp+200]
|
||||
; CHECK: ldx [%fp+2231]
|
||||
; CHECK: ldx [%fp+2247]
|
||||
define void @mixedarg(i8 %a0, ; %i0
|
||||
float %a1, ; %f3
|
||||
i16 %a2, ; %i2
|
||||
|
|
Loading…
Reference in New Issue