summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/SystemZ
diff options
context:
space:
mode:
authorJonas Paulsson <paulsson@linux.vnet.ibm.com>2019-11-25 18:48:47 +0100
committerJonas Paulsson <paulsson@linux.vnet.ibm.com>2019-11-25 19:03:05 +0100
commita7d3f6933ddbbd1c0b20529a0734ed66f98d75a0 (patch)
treea8e5526fdaf52596357b3a156e8a28084ee3220c /llvm/lib/Target/SystemZ
parentaaf7f05a96e6c21b7a6d1ad9e73fb7ab5eee7d83 (diff)
downloadbcm5719-llvm-a7d3f6933ddbbd1c0b20529a0734ed66f98d75a0.tar.gz
bcm5719-llvm-a7d3f6933ddbbd1c0b20529a0734ed66f98d75a0.zip
[SystemZ] Return the right offsets from getCalleeSavedSpillSlots().
// 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". The immediate offsets into the Register save area returned by getCalleeSavedSpillSlots() should take this offset into account, which this patch makes sure of. Patch and review by Ulrich Weigand. https://reviews.llvm.org/D70427
Diffstat (limited to 'llvm/lib/Target/SystemZ')
-rw-r--r--llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp49
1 files changed, 28 insertions, 21 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 *
OpenPOWER on IntegriCloud