summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86FrameLowering.cpp
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@google.com>2018-03-02 17:46:39 +0000
committerDerek Schuff <dschuff@google.com>2018-03-02 17:46:39 +0000
commit57feeed3076137da48c43010130eddbb8e81cb54 (patch)
tree964b051cb0612658345e22886c5c5e03680bf9d4 /llvm/lib/Target/X86/X86FrameLowering.cpp
parent4925653555942acbafbb936ccf81cc6e5b384868 (diff)
downloadbcm5719-llvm-57feeed3076137da48c43010130eddbb8e81cb54.tar.gz
bcm5719-llvm-57feeed3076137da48c43010130eddbb8e81cb54.zip
[X86][x32] Save callee-save register used as base pointer for x32 ABI
For the x32 ABI, since the base pointer register (EBX) is a callee save register it should be saved before use. This fixes https://bugs.llvm.org/show_bug.cgi?id=36011 Differential Revision: https://reviews.llvm.org/D42358 Patch by Pratik Bhatu llvm-svn: 326593
Diffstat (limited to 'llvm/lib/Target/X86/X86FrameLowering.cpp')
-rw-r--r--llvm/lib/Target/X86/X86FrameLowering.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp
index 545248ac100..34febe679db 100644
--- a/llvm/lib/Target/X86/X86FrameLowering.cpp
+++ b/llvm/lib/Target/X86/X86FrameLowering.cpp
@@ -2108,8 +2108,12 @@ void X86FrameLowering::determineCalleeSaves(MachineFunction &MF,
TargetFrameLowering::determineCalleeSaves(MF, SavedRegs, RS);
// Spill the BasePtr if it's used.
- if (TRI->hasBasePointer(MF))
- SavedRegs.set(TRI->getBaseRegister());
+ if (TRI->hasBasePointer(MF)){
+ unsigned BasePtr = TRI->getBaseRegister();
+ if (STI.isTarget64BitILP32())
+ BasePtr = getX86SubSuperRegister(BasePtr, 64);
+ SavedRegs.set(BasePtr);
+ }
}
static bool
OpenPOWER on IntegriCloud