mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-16 11:30:51 +00:00
77c1b73211
This handles the simplest case for mov -> push conversion: 1. x86-32 calling convention, everything is passed through the stack. 2. There is no reserved call frame. 3. Only registers or immediates are pushed, no attempt to combine a mem-reg-mem sequence into a single PUSHmm. Differential Revision: http://reviews.llvm.org/D6503 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223757 91177308-0d34-0410-b5e6-96231b3b80d8
35 lines
822 B
LLVM
35 lines
822 B
LLVM
; RUN: llc < %s -mtriple=i686-pc-win32 | FileCheck %s
|
|
|
|
%Foo = type { i32, i32 }
|
|
|
|
%frame = type { %Foo, i32, %Foo }
|
|
|
|
declare void @f(%frame* inalloca %a)
|
|
|
|
declare void @Foo_ctor(%Foo* %this)
|
|
|
|
define void @g() {
|
|
entry:
|
|
%args = alloca inalloca %frame
|
|
%c = getelementptr %frame* %args, i32 0, i32 2
|
|
; CHECK: movl $20, %eax
|
|
; CHECK: calll __chkstk
|
|
; CHECK: movl %esp,
|
|
call void @Foo_ctor(%Foo* %c)
|
|
; CHECK: leal 12(%{{.*}}),
|
|
; CHECK-NEXT: pushl
|
|
; CHECK-NEXT: calll _Foo_ctor
|
|
; CHECK: addl $4, %esp
|
|
%b = getelementptr %frame* %args, i32 0, i32 1
|
|
store i32 42, i32* %b
|
|
; CHECK: movl $42,
|
|
%a = getelementptr %frame* %args, i32 0, i32 0
|
|
call void @Foo_ctor(%Foo* %a)
|
|
; CHECK-NEXT: pushl
|
|
; CHECK-NEXT: calll _Foo_ctor
|
|
; CHECK: addl $4, %esp
|
|
call void @f(%frame* inalloca %args)
|
|
; CHECK: calll _f
|
|
ret void
|
|
}
|