mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-12 13:30:51 +00:00
Avoids DCE on write_register
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209222 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c9b12d06ef
commit
5d7afdb2ec
@ -253,7 +253,7 @@ def int_frameaddress : Intrinsic<[llvm_ptr_ty], [llvm_i32_ty], [IntrNoMem]>;
|
||||
def int_read_register : Intrinsic<[llvm_anyint_ty], [llvm_metadata_ty],
|
||||
[IntrNoMem], "llvm.read_register">;
|
||||
def int_write_register : Intrinsic<[], [llvm_metadata_ty, llvm_anyint_ty],
|
||||
[IntrNoMem], "llvm.write_register">;
|
||||
[], "llvm.write_register">;
|
||||
|
||||
// Note: we treat stacksave/stackrestore as writemem because we don't otherwise
|
||||
// model their dependencies on allocas.
|
||||
|
@ -1,11 +1,13 @@
|
||||
; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s
|
||||
; RUN: llc < %s -mtriple=x86_64-linux-gnueabi | FileCheck %s
|
||||
; RUN: opt < %s -O3 -S -mtriple=x86_64-linux-gnueabi | FileCheck %s --check-prefix=OPT
|
||||
|
||||
define i64 @get_stack() nounwind {
|
||||
entry:
|
||||
; CHECK-LABEL: get_stack:
|
||||
; CHECK: movq %rsp, %rax
|
||||
%sp = call i64 @llvm.read_register.i64(metadata !0)
|
||||
; OPT: @llvm.read_register.i64
|
||||
ret i64 %sp
|
||||
}
|
||||
|
||||
@ -14,6 +16,7 @@ entry:
|
||||
; CHECK-LABEL: set_stack:
|
||||
; CHECK: movq %rdi, %rsp
|
||||
call void @llvm.write_register.i64(metadata !0, i64 %val)
|
||||
; OPT: @llvm.write_register.i64
|
||||
ret void
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user