summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp49
-rw-r--r--llvm/test/CodeGen/SystemZ/anyregcc-novec.ll17
2 files changed, 41 insertions, 25 deletions
diff --git a/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp b/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp
index d183eb5b3eb..24b99e49fc6 100644
--- a/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp
@@ -21,27 +21,27 @@
using namespace llvm;
namespace {
-// The ABI-defined register save slots, relative to the incoming stack
-// pointer.
+// The ABI-defined register save slots, relative to the CFA (i.e.
+// incoming stack pointer + SystemZMC::CallFrameSize).
static const TargetFrameLowering::SpillSlot SpillOffsetTable[] = {
- { SystemZ::R2D, 0x10 },
- { SystemZ::R3D, 0x18 },
- { SystemZ::R4D, 0x20 },
- { SystemZ::R5D, 0x28 },
- { SystemZ::R6D, 0x30 },
- { SystemZ::R7D, 0x38 },
- { SystemZ::R8D, 0x40 },
- { SystemZ::R9D, 0x48 },
- { SystemZ::R10D, 0x50 },
- { SystemZ::R11D, 0x58 },
- { SystemZ::R12D, 0x60 },
- { SystemZ::R13D, 0x68 },
- { SystemZ::R14D, 0x70 },
- { SystemZ::R15D, 0x78 },
- { SystemZ::F0D, 0x80 },
- { SystemZ::F2D, 0x88 },
- { SystemZ::F4D, 0x90 },
- { SystemZ::F6D, 0x98 }
+ { SystemZ::R2D, -SystemZMC::CallFrameSize + 0x10 },
+ { SystemZ::R3D, -SystemZMC::CallFrameSize + 0x18 },
+ { SystemZ::R4D, -SystemZMC::CallFrameSize + 0x20 },
+ { SystemZ::R5D, -SystemZMC::CallFrameSize + 0x28 },
+ { SystemZ::R6D, -SystemZMC::CallFrameSize + 0x30 },
+ { SystemZ::R7D, -SystemZMC::CallFrameSize + 0x38 },
+ { SystemZ::R8D, -SystemZMC::CallFrameSize + 0x40 },
+ { SystemZ::R9D, -SystemZMC::CallFrameSize + 0x48 },
+ { SystemZ::R10D, -SystemZMC::CallFrameSize + 0x50 },
+ { SystemZ::R11D, -SystemZMC::CallFrameSize + 0x58 },
+ { SystemZ::R12D, -SystemZMC::CallFrameSize + 0x60 },
+ { SystemZ::R13D, -SystemZMC::CallFrameSize + 0x68 },
+ { SystemZ::R14D, -SystemZMC::CallFrameSize + 0x70 },
+ { SystemZ::R15D, -SystemZMC::CallFrameSize + 0x78 },
+ { SystemZ::F0D, -SystemZMC::CallFrameSize + 0x80 },
+ { SystemZ::F2D, -SystemZMC::CallFrameSize + 0x88 },
+ { SystemZ::F4D, -SystemZMC::CallFrameSize + 0x90 },
+ { SystemZ::F6D, -SystemZMC::CallFrameSize + 0x98 }
};
} // end anonymous namespace
@@ -49,10 +49,17 @@ SystemZFrameLowering::SystemZFrameLowering()
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown, Align(8),
-SystemZMC::CallFrameSize, Align(8),
false /* StackRealignable */) {
+ // Due to the SystemZ ABI, the DWARF CFA (Canonical Frame Address) is not
+ // equal to the incoming stack pointer, but to incoming stack pointer plus
+ // 160. The getOffsetOfLocalArea() returned value is interpreted as "the
+ // offset of the local area from the CFA".
+
// Create a mapping from register number to save slot offset.
+ // These offsets are relative to the start of the register save area.
RegSpillOffsets.grow(SystemZ::NUM_TARGET_REGS);
for (unsigned I = 0, E = array_lengthof(SpillOffsetTable); I != E; ++I)
- RegSpillOffsets[SpillOffsetTable[I].Reg] = SpillOffsetTable[I].Offset;
+ RegSpillOffsets[SpillOffsetTable[I].Reg] =
+ SystemZMC::CallFrameSize + SpillOffsetTable[I].Offset;
}
const TargetFrameLowering::SpillSlot *
diff --git a/llvm/test/CodeGen/SystemZ/anyregcc-novec.ll b/llvm/test/CodeGen/SystemZ/anyregcc-novec.ll
index 72bf00c2265..f7e2af91792 100644
--- a/llvm/test/CodeGen/SystemZ/anyregcc-novec.ll
+++ b/llvm/test/CodeGen/SystemZ/anyregcc-novec.ll
@@ -5,13 +5,14 @@ define anyregcc void @anyregcc1() {
entry:
;CHECK-LABEL: anyregcc1
;CHECK: stmg %r2, %r15, 16(%r15)
-;CHECK: std %f0,
+;CHECK: aghi %r15, -256
+;CHECK: std %f0, 384(%r15)
;CHECK: std %f1,
-;CHECK: std %f2,
+;CHECK: std %f2, 392(%r15)
;CHECK: std %f3,
-;CHECK: std %f4,
+;CHECK: std %f4, 400(%r15)
;CHECK: std %f5,
-;CHECK: std %f6,
+;CHECK: std %f6, 408(%r15)
;CHECK: std %f7,
;CHECK: std %f8,
;CHECK: std %f9,
@@ -21,6 +22,14 @@ entry:
;CHECK: std %f13,
;CHECK: std %f14,
;CHECK: std %f15,
+;CHECK: .cfi_offset %f0, -32
+;CHECK: .cfi_offset %f2, -24
+;CHECK: .cfi_offset %f4, -16
+;CHECK: .cfi_offset %f6, -8
+;CHECK: ld %f0, 384(%r15)
+;CHECK: ld %f2, 392(%r15)
+;CHECK: ld %f4, 400(%r15)
+;CHECK: ld %f6, 408(%r15)
call void asm sideeffect "", "~{r0},~{r1},~{r2},~{r3},~{r4},~{r5},~{r6},~{r7},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{f0},~{f1},~{f2},~{f3},~{f4},~{f5},~{f6},~{f7},~{f8},~{f9},~{f10},~{f11},~{f12},~{f13},~{f14},~{f15}"() nounwind
ret void
}
OpenPOWER on IntegriCloud