1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
llvm-mirror/test/CodeGen/X86/frameregister.ll
Pat Gavlin a6d3ba4544 Allow {e,r}bp as the target of {read,write}_register.
This patch allows the read_register and write_register intrinsics to
read/write the RBP/EBP registers on X86 iff the targeted register is
the frame pointer for the containing function.

Differential Revision: http://reviews.llvm.org/D10977

llvm-svn: 241827
2015-07-09 17:40:29 +00:00

31 lines
884 B
LLVM

; 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_frame() #0 {
entry:
; CHECK-LABEL: get_frame:
; CHECK: movq %rbp, %rax
%sp = call i64 @llvm.read_register.i64(metadata !0)
; OPT: @llvm.read_register.i64
ret i64 %sp
}
define void @set_frame(i64 %val) #0 {
entry:
; CHECK-LABEL: set_frame:
; CHECK: movq %rdi, %rbp
call void @llvm.write_register.i64(metadata !0, i64 %val)
; OPT: @llvm.write_register.i64
ret void
}
declare i64 @llvm.read_register.i64(metadata) nounwind
declare void @llvm.write_register.i64(metadata, i64) nounwind
; register unsigned long current_stack_pointer asm("rbp");
; CHECK-NOT: .asciz "rbp"
!0 = !{!"rbp\00"}
attributes #0 = { nounwind "no-frame-pointer-elim"="true" }