Dan Gohman | da594cf | 2009-09-09 00:09:15 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -mtriple=thumbv7-apple-darwin9 -relocation-model=pic | FileCheck %s |
Evan Cheng | 65c2642 | 2009-07-23 23:09:51 +0000 | [diff] [blame] | 2 | |
| 3 | %struct.anon = type { void ()* } |
| 4 | %struct.one_atexit_routine = type { %struct.anon, i32, i8* } |
| 5 | @__dso_handle = external global { } ; <{ }*> [#uses=1] |
| 6 | @llvm.used = appending global [1 x i8*] [i8* bitcast (i32 (void ()*)* @atexit to i8*)], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0] |
| 7 | |
| 8 | define hidden arm_apcscc i32 @atexit(void ()* %func) nounwind { |
| 9 | entry: |
| 10 | ; CHECK: atexit: |
Evan Cheng | d16eb2f | 2009-08-04 23:47:55 +0000 | [diff] [blame] | 11 | ; CHECK: add r0, pc |
Evan Cheng | 65c2642 | 2009-07-23 23:09:51 +0000 | [diff] [blame] | 12 | %r = alloca %struct.one_atexit_routine, align 4 ; <%struct.one_atexit_routine*> [#uses=3] |
| 13 | %0 = getelementptr %struct.one_atexit_routine* %r, i32 0, i32 0, i32 0 ; <void ()**> [#uses=1] |
| 14 | store void ()* %func, void ()** %0, align 4 |
| 15 | %1 = getelementptr %struct.one_atexit_routine* %r, i32 0, i32 1 ; <i32*> [#uses=1] |
| 16 | store i32 0, i32* %1, align 4 |
| 17 | %2 = call arm_apcscc i32 @atexit_common(%struct.one_atexit_routine* %r, i8* bitcast ({ }* @__dso_handle to i8*)) nounwind ; <i32> [#uses=1] |
| 18 | ret i32 %2 |
| 19 | } |
| 20 | |
| 21 | declare arm_apcscc i32 @atexit_common(%struct.one_atexit_routine*, i8*) nounwind |