[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
This commit is contained in:
Chad Rosier 2013-02-19 23:50:45 +00:00
parent 4c96e99235
commit 45a52fa097
2 changed files with 6 additions and 4 deletions

View File

@ -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;

View File

@ -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
}