summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2013-02-19 23:50:45 +0000
committerChad Rosier <mcrosier@apple.com>2013-02-19 23:50:45 +0000
commit45a52fa097edb9ae619116e68274c908aea66519 (patch)
treef4fd3403ee5a2d76fb9f735f1433ec5216c2a7ad
parent4c96e99235b32b594abaf93e5c16c81aae7acb3c (diff)
downloadbcm5719-llvm-45a52fa097edb9ae619116e68274c908aea66519.tar.gz
bcm5719-llvm-45a52fa097edb9ae619116e68274c908aea66519.zip
[ms-inline asm] Force the use of a base pointer if the MachineFunction includes
MS-style inline assembly. This is a follow-on to r175334. Forcing a FP to be emitted doesn't ensure it will be used. Therefore, force the base pointer as well. We now treat MS inline assembly in the same way we treat functions with dynamic stack realignment and VLAs. This guarantees the BP will be used to reference parameters and locals. rdar://13218191 llvm-svn: 175576
-rw-r--r--llvm/lib/Target/X86/X86RegisterInfo.cpp6
-rw-r--r--llvm/test/CodeGen/X86/ms-inline-asm.ll4
2 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Target/X86/X86RegisterInfo.cpp b/llvm/lib/Target/X86/X86RegisterInfo.cpp
index 401eefb16af..fbe6331e845 100644
--- a/llvm/lib/Target/X86/X86RegisterInfo.cpp
+++ b/llvm/lib/Target/X86/X86RegisterInfo.cpp
@@ -389,8 +389,10 @@ bool X86RegisterInfo::hasBasePointer(const MachineFunction &MF) const {
return false;
// When we need stack realignment and there are dynamic allocas, we can't
- // reference off of the stack pointer, so we reserve a base pointer.
- if (needsStackRealignment(MF) && MFI->hasVarSizedObjects())
+ // reference off of the stack pointer, so we reserve a base pointer. This
+ // is also true if the function contain MS-style inline assembly.
+ if ((needsStackRealignment(MF) && MFI->hasVarSizedObjects()) ||
+ MF.hasMSInlineAsm())
return true;
return false;
diff --git a/llvm/test/CodeGen/X86/ms-inline-asm.ll b/llvm/test/CodeGen/X86/ms-inline-asm.ll
index eca174610da..5048a93ad30 100644
--- a/llvm/test/CodeGen/X86/ms-inline-asm.ll
+++ b/llvm/test/CodeGen/X86/ms-inline-asm.ll
@@ -103,8 +103,8 @@ entry:
; CHECK: {{## InlineAsm End|#NO_APP}}
; CHECK: {{## InlineAsm Start|#APP}}
; CHECK: .intel_syntax
-; CHECK: mov dword ptr [ebp - 8], edi
+; CHECK: mov dword ptr [esi], edi
; CHECK: .att_syntax
; CHECK: {{## InlineAsm End|#NO_APP}}
-; CHECK: movl -8(%ebp), %eax
+; CHECK: movl (%esi), %eax
}
OpenPOWER on IntegriCloud