mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-15 16:09:02 +00:00
[WebAssembly] Write stack pointer back to memory when FP is used
The stack pointer is bumped when there is a frame pointer or when there are static-size objects, but was only getting written back when there were static-size objects. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261453 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
37d3f7f35c
commit
545c0902d4
@ -125,7 +125,7 @@ void WebAssemblyFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
WebAssembly::FP32)
|
||||
.addReg(WebAssembly::SP32);
|
||||
}
|
||||
if (StackSize) {
|
||||
if (StackSize || hasFP(MF)) {
|
||||
SPAddr = MRI.createVirtualRegister(&WebAssembly::I32RegClass);
|
||||
// The SP32 register now has the new stacktop. Also write it back to memory.
|
||||
BuildMI(MBB, InsertPt, DL, TII->get(WebAssembly::CONST_I32), SPAddr)
|
||||
|
@ -135,7 +135,8 @@ define void @dynamic_alloca(i32 %alloc) {
|
||||
; CHECK-NEXT: i32.load [[SP:.+]]=, 0($pop[[L1]])
|
||||
; CHECK-NEXT: copy_local [[FP:.+]]=, [[SP]]
|
||||
; Target independent codegen bumps the stack pointer
|
||||
; FIXME: we need to write the value back to memory
|
||||
; CHECK: i32.const $push[[L4:.+]]=, __stack_pointer{{$}}
|
||||
; CHECK-NEXT: i32.store [[SP]]=, 0($pop[[L4]]), [[SP]]
|
||||
%r = alloca i32, i32 %alloc
|
||||
; Target-independent codegen also calculates the store addr
|
||||
store i32 0, i32* %r
|
||||
@ -193,6 +194,8 @@ declare i8* @llvm.frameaddress(i32)
|
||||
; CHECK: i32.const $push[[L1:.+]]=, __stack_pointer
|
||||
; CHECK-NEXT: i32.load [[SP:.+]]=, 0($pop[[L1]])
|
||||
; CHECK-NEXT: copy_local [[FP:.+]]=, [[SP]]
|
||||
; CHECK-NEXT: i32.const $push[[L2:.+]]=, __stack_pointer{{$}}
|
||||
; CHECK-NEXT: i32.store [[SP]]=, 0($pop[[L2]]), [[SP]]
|
||||
; CHECK-NEXT: call use_i8_star@FUNCTION, [[FP]]
|
||||
; CHECK-NEXT: i32.const $push[[L6:.+]]=, __stack_pointer
|
||||
; CHECK-NEXT: i32.store [[SP]]=, 0($pop[[L6]]), [[FP]]
|
||||
|
Loading…
Reference in New Issue
Block a user