mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 15:17:25 +00:00
MS inline asm: Use memory constraints for functions instead of registers
This is consistent with how we parse them in a standalone .s file, and
inline assembly shouldn't differ.
This fixes errors about requiring more registers than available in
cases like this:
void f();
void __declspec(naked) g() {
__asm pusha
__asm call f
__asm popa
__asm ret
}
There are no registers available to pass the address of 'f' into the asm
blob. The asm should now directly call 'f'.
Tests will land in Clang shortly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214550 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -110,7 +110,7 @@ define i32 @t31() {
|
||||
entry:
|
||||
%val = alloca i32, align 64
|
||||
store i32 -1, i32* %val, align 64
|
||||
call void asm sideeffect inteldialect "mov dword ptr $0, esp", "=*m,~{dirflag},~{fpsr},~{flags}"(i32* %val) #1
|
||||
call void asm sideeffect inteldialect "mov dword ptr $0, esp", "=*m,~{dirflag},~{fpsr},~{flags}"(i32* %val)
|
||||
%sp = load i32* %val, align 64
|
||||
ret i32 %sp
|
||||
; CHECK-LABEL: t31:
|
||||
@@ -125,3 +125,12 @@ entry:
|
||||
; CHECK: movl (%esp), %eax
|
||||
; CHECK: ret
|
||||
}
|
||||
|
||||
declare void @other_func()
|
||||
|
||||
define void @naked() #0 {
|
||||
call void asm sideeffect inteldialect "call dword ptr $0", "*m,~{eax},~{ebx},~{ecx},~{edx},~{edi},~{esi},~{esp},~{ebp},~{dirflag},~{fpsr},~{flags}"(void()* @other_func)
|
||||
unreachable
|
||||
}
|
||||
|
||||
attributes #0 = { naked }
|
||||
|
||||
Reference in New Issue
Block a user