brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.1 KiB · cfb1fd7 Raw
85 lines · c
1// RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -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 -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 -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 -emit-llvm \12// RUN:     -fno-use-cxa-atexit -fregister-global-dtors-with-atexit < %s | \13// RUN:   FileCheck --check-prefix=REGISTER %s14 15int bar(void) __attribute__((destructor(100)));16int bar2(void) __attribute__((destructor(65535)));17int bar3(int) __attribute__((destructor(65535)));18 19int bar(void) {20  return 1;21}22 23int bar2(void) {24  return 2;25}26 27int bar3(int a) {28  return a;29}30 31// NO-REGISTER: @llvm.global_dtors = appending global [3 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 100, ptr @bar, ptr null }, { i32, ptr, ptr } { i32 65535, ptr @bar2, ptr null }, { i32, ptr, ptr } { i32 65535, ptr @bar3, ptr null }]32 33// REGISTER: @llvm.global_ctors = appending global [2 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 100, ptr @__GLOBAL_init_100, ptr null }, { i32, ptr, ptr } { i32 65535, ptr @__GLOBAL_init_65535, ptr null }]34// REGISTER: @llvm.global_dtors = appending global [2 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 100, ptr @__GLOBAL_cleanup_100, ptr null }, { i32, ptr, ptr } { i32 65535, ptr @__GLOBAL_cleanup_65535, ptr null }]35 36// REGISTER: define internal void @__GLOBAL_init_100() [[ATTR:#[0-9]+]] {37// REGISTER: entry:38// REGISTER:   %0 = call i32 @atexit(ptr @bar)39// REGISTER:   ret void40// REGISTER: }41 42// REGISTER: define internal void @__GLOBAL_init_65535() [[ATTR:#[0-9]+]] {43// REGISTER: entry:44// REGISTER:   %0 = call i32 @atexit(ptr @bar2)45// REGISTER:   %1 = call i32 @atexit(ptr @bar3)46// REGISTER:   ret void47// REGISTER: }48 49// REGISTER: define internal void @__GLOBAL_cleanup_100() [[ATTR:#[0-9]+]] {50// REGISTER: entry:51// REGISTER:   %0 = call i32 @unatexit(ptr @bar)52// REGISTER:   %needs_destruct = icmp eq i32 %0, 053// REGISTER:   br i1 %needs_destruct, label %destruct.call, label %destruct.end54 55// REGISTER: destruct.call:56// REGISTER:   call void @bar()57// REGISTER:   br label %destruct.end58 59// REGISTER: destruct.end:60// REGISTER:   ret void61// REGISTER: }62 63// REGISTER: define internal void @__GLOBAL_cleanup_65535() [[ATTR:#[0-9]+]] {64// REGISTER: entry:65// REGISTER:   %0 = call i32 @unatexit(ptr @bar3)66// REGISTER:   %needs_destruct = icmp eq i32 %0, 067// REGISTER:   br i1 %needs_destruct, label %destruct.call, label %unatexit.call68 69// REGISTER: destruct.call:70// REGISTER:   call void @bar3()71// REGISTER:   br label %unatexit.call72 73// REGISTER: unatexit.call:74// REGISTER:   %1 = call i32 @unatexit(ptr @bar2)75// REGISTER:   %needs_destruct1 = icmp eq i32 %1, 076// REGISTER:   br i1 %needs_destruct1, label %destruct.call2, label %destruct.end77 78// REGISTER: destruct.call2:79// REGISTER:   call void @bar2()80// REGISTER:   br label %destruct.end81 82// REGISTER: destruct.end:83// REGISTER:   ret void84// REGISTER: }85