• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mtriple=x86_64-apple-darwin  | FileCheck %s
2; RUN: llc < %s -mtriple=x86_64-linux-gnueabi | FileCheck %s
3; RUN: opt < %s -O3 -S -mtriple=x86_64-linux-gnueabi | FileCheck %s --check-prefix=OPT
4
5define i64 @get_frame() #0 {
6entry:
7; CHECK-LABEL: get_frame:
8; CHECK: movq	%rbp, %rax
9  %sp = call i64 @llvm.read_register.i64(metadata !0)
10; OPT: @llvm.read_register.i64
11  ret i64 %sp
12}
13
14define void @set_frame(i64 %val) #0 {
15entry:
16; CHECK-LABEL: set_frame:
17; CHECK: movq	%rdi, %rbp
18  call void @llvm.write_register.i64(metadata !0, i64 %val)
19; OPT: @llvm.write_register.i64
20  ret void
21}
22
23declare i64 @llvm.read_register.i64(metadata) nounwind
24declare void @llvm.write_register.i64(metadata, i64) nounwind
25
26; register unsigned long current_stack_pointer asm("rbp");
27; CHECK-NOT: .asciz  "rbp"
28!0 = !{!"rbp\00"}
29
30attributes #0 = { nounwind "no-frame-pointer-elim"="true" }
31