brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.6 KiB · 5ebea7a Raw
91 lines · cpp
1// RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -x c++ -emit-llvm \2// RUN:     -fno-use-cxa-atexit < %s | \3// RUN:   FileCheck --check-prefix=NO-REGISTER %s4// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -x c++ -emit-llvm \5// RUN:     -fno-use-cxa-atexit < %s | \6// RUN:   FileCheck --check-prefix=NO-REGISTER %s7 8// RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -x c++ -emit-llvm \9// RUN:     -fno-use-cxa-atexit -fregister-global-dtors-with-atexit < %s | \10// RUN:   FileCheck --check-prefix=REGISTER %s11// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -x c++ -emit-llvm \12// RUN:     -fno-use-cxa-atexit -fregister-global-dtors-with-atexit < %s | \13// RUN:   FileCheck --check-prefix=REGISTER %s14 15struct test {16  test();17  ~test();18} t;19 20int bar() __attribute__((destructor(100)));21int bar2() __attribute__((destructor(65535)));22int bar3(int) __attribute__((destructor(65535)));23 24int bar() {25  return 1;26}27 28int bar2() {29  return 2;30}31 32int bar3(int a) {33  return a;34}35 36// NO-REGISTER: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__sub_I__, ptr null }]37// NO-REGISTER: @llvm.global_dtors = appending global [4 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 100, ptr @_Z3barv, ptr null }, { i32, ptr, ptr } { i32 65535, ptr @_Z4bar2v, ptr null }, { i32, ptr, ptr } { i32 65535, ptr @_Z4bar3i, ptr null }, { i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__D_a, ptr null }]38 39// REGISTER: @llvm.global_ctors = appending global [3 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__sub_I__, ptr null }, { i32, ptr, ptr } { i32 100, ptr @__GLOBAL_init_100, ptr null }, { i32, ptr, ptr } { i32 65535, ptr @__GLOBAL_init_65535, ptr null }]40// REGISTER: @llvm.global_dtors = appending global [3 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__D_a, ptr null }, { i32, ptr, ptr } { i32 100, ptr @__GLOBAL_cleanup_100, ptr null }, { i32, ptr, ptr } { i32 65535, ptr @__GLOBAL_cleanup_65535, ptr null }]41 42// REGISTER: define internal void @__GLOBAL_init_100() [[ATTR:#[0-9]+]] {43// REGISTER: entry:44// REGISTER:   %0 = call i32 @atexit(ptr @_Z3barv)45// REGISTER:   ret void46// REGISTER: }47 48// REGISTER: define internal void @__GLOBAL_init_65535() [[ATTR:#[0-9]+]] {49// REGISTER: entry:50// REGISTER:   %0 = call i32 @atexit(ptr @_Z4bar2v)51// REGISTER:   %1 = call i32 @atexit(ptr @_Z4bar3i)52// REGISTER:   ret void53// REGISTER: }54 55// REGISTER: define internal void @__GLOBAL_cleanup_100() [[ATTR:#[0-9]+]] {56// REGISTER: entry:57// REGISTER:   %0 = call i32 @unatexit(ptr @_Z3barv)58// REGISTER:   %needs_destruct = icmp eq i32 %0, 059// REGISTER:   br i1 %needs_destruct, label %destruct.call, label %destruct.end60 61// REGISTER: destruct.call:62// REGISTER:   call void @_Z3barv()63// REGISTER:   br label %destruct.end64 65// REGISTER: destruct.end:66// REGISTER:   ret void67// REGISTER: }68 69// REGISTER: define internal void @__GLOBAL_cleanup_65535() [[ATTR:#[0-9]+]] {70// REGISTER: entry:71// REGISTER:   %0 = call i32 @unatexit(ptr @_Z4bar3i)72// REGISTER:   %needs_destruct = icmp eq i32 %0, 073// REGISTER:   br i1 %needs_destruct, label %destruct.call, label %unatexit.call74 75// REGISTER: destruct.call:76// REGISTER:   call void @_Z4bar3i()77// REGISTER:   br label %unatexit.call78 79// REGISTER: unatexit.call:80// REGISTER:   %1 = call i32 @unatexit(ptr @_Z4bar2v)81// REGISTER:   %needs_destruct1 = icmp eq i32 %1, 082// REGISTER:   br i1 %needs_destruct1, label %destruct.call2, label %destruct.end83 84// REGISTER: destruct.call2:85// REGISTER:   call void @_Z4bar2v()86// REGISTER:   br label %destruct.end87 88// REGISTER: destruct.end:89// REGISTER:   ret void90// REGISTER: }91