diff options
| author | Derek Schuff <dschuff@google.com> | 2018-03-02 17:46:39 +0000 |
|---|---|---|
| committer | Derek Schuff <dschuff@google.com> | 2018-03-02 17:46:39 +0000 |
| commit | 57feeed3076137da48c43010130eddbb8e81cb54 (patch) | |
| tree | 964b051cb0612658345e22886c5c5e03680bf9d4 /llvm/lib/Target/X86/X86FrameLowering.cpp | |
| parent | 4925653555942acbafbb936ccf81cc6e5b384868 (diff) | |
| download | bcm5719-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.cpp | 8 |
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 |

