• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mtriple=arm-apple-darwin  | FileCheck %s
2; RUN: llc < %s -mtriple=arm-linux-gnueabi | FileCheck %s
3
4define i32 @get_stack() nounwind {
5entry:
6; CHECK-LABEL: get_stack:
7; CHECK: mov   r0, sp
8	%sp = call i32 @llvm.read_register.i32(metadata !0)
9  ret i32 %sp
10}
11
12define void @set_stack(i32 %val) nounwind {
13entry:
14; CHECK-LABEL: set_stack:
15; CHECK: mov   sp, r0
16  call void @llvm.write_register.i32(metadata !0, i32 %val)
17  ret void
18}
19
20declare i32 @llvm.read_register.i32(metadata) nounwind
21declare void @llvm.write_register.i32(metadata, i32) nounwind
22
23; register unsigned long current_stack_pointer asm("sp");
24; CHECK-NOT: .asciz  "sp"
25!0 = !{!"sp\00"}
26