1; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \ 2; RUN: -mattr=-altivec -simplifycfg-require-and-preserve-domtree=1 < %s | \ 3; RUN: FileCheck --check-prefixes=ASM,ASMNFS,ASM32 %s 4 5; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -mcpu=pwr4 \ 6; RUN: -mattr=-altivec -simplifycfg-require-and-preserve-domtree=1 < %s | \ 7; RUN: FileCheck --check-prefixes=ASM,ASMNFS,ASM64 %s 8 9; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \ 10; RUN: -mattr=-altivec -simplifycfg-require-and-preserve-domtree=1 \ 11; RUN: -function-sections < %s | \ 12; RUN: FileCheck --check-prefixes=ASM,ASMFS,ASM32 %s 13 14; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -mcpu=pwr4 \ 15; RUN: -mattr=-altivec -simplifycfg-require-and-preserve-domtree=1 \ 16; RUN: -function-sections < %s | \ 17; RUN: FileCheck --check-prefixes=ASM,ASMFS,ASM64 %s 18 19@_ZTIi = external constant i8* 20 21define void @_Z9throwFuncv() { 22entry: 23 %exception = call i8* @__cxa_allocate_exception(i32 4) #2 24 %0 = bitcast i8* %exception to i32* 25 store i32 1, i32* %0, align 16 26 call void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null) #3 27 unreachable 28} 29 30; ASMNFS: ._Z9throwFuncv: 31; ASMFS: .csect ._Z9throwFuncv[PR],5 32; ASM: bl .__cxa_allocate_exception[PR] 33; ASM: nop 34; ASM32: lwz 4, L..C0(2) 35; ASM64: ld 4, L..C0(2) 36; ASM: bl .__cxa_throw[PR] 37; ASM: nop 38 39define i32 @_Z9catchFuncv() personality i8* bitcast (i32 (...)* @__xlcxx_personality_v1 to i8*) { 40entry: 41 %retval = alloca i32, align 4 42 %exn.slot = alloca i8*, align 4 43 %ehselector.slot = alloca i32, align 4 44 %0 = alloca i32, align 4 45 invoke void @_Z9throwFuncv() 46 to label %invoke.cont unwind label %lpad 47 48invoke.cont: ; preds = %entry 49 br label %try.cont 50 51lpad: ; preds = %entry 52 %1 = landingpad { i8*, i32 } 53 catch i8* bitcast (i8** @_ZTIi to i8*) 54 %2 = extractvalue { i8*, i32 } %1, 0 55 store i8* %2, i8** %exn.slot, align 4 56 %3 = extractvalue { i8*, i32 } %1, 1 57 store i32 %3, i32* %ehselector.slot, align 4 58 br label %catch.dispatch 59 60catch.dispatch: ; preds = %lpad 61 %sel = load i32, i32* %ehselector.slot, align 4 62 %4 = call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)) #2 63 %matches = icmp eq i32 %sel, %4 64 br i1 %matches, label %catch, label %eh.resume 65 66catch: ; preds = %catch.dispatch 67 %exn = load i8*, i8** %exn.slot, align 4 68 %5 = call i8* @__cxa_begin_catch(i8* %exn) #2 69 %6 = bitcast i8* %5 to i32* 70 %7 = load i32, i32* %6, align 4 71 store i32 %7, i32* %0, align 4 72 store i32 2, i32* %retval, align 4 73 call void @__cxa_end_catch() #2 74 br label %return 75 76try.cont: ; preds = %invoke.cont 77 store i32 1, i32* %retval, align 4 78 br label %return 79 80return: ; preds = %try.cont, %catch 81 %8 = load i32, i32* %retval, align 4 82 ret i32 %8 83 84eh.resume: ; preds = %catch.dispatch 85 %exn1 = load i8*, i8** %exn.slot, align 4 86 %sel2 = load i32, i32* %ehselector.slot, align 4 87 %lpad.val = insertvalue { i8*, i32 } undef, i8* %exn1, 0 88 %lpad.val3 = insertvalue { i8*, i32 } %lpad.val, i32 %sel2, 1 89 resume { i8*, i32 } %lpad.val3 90} 91 92; ASMNFS: ._Z9catchFuncv: 93; ASMFS: .csect ._Z9catchFuncv[PR],5 94; ASM: L..func_begin0: 95; ASM: # %bb.0: # %entry 96; ASM: mflr 0 97; ASM: L..tmp0: 98; ASM: bl ._Z9throwFuncv 99; ASM: nop 100; ASM: L..tmp1: 101; ASM: # %bb.1: # %invoke.cont 102; ASM: li 3, 1 103; ASM: L..BB1_2: # %return 104; ASM: mtlr 0 105; ASM: blr 106; ASM: L..BB1_3: # %lpad 107; ASM: L..tmp2: 108; ASM: bl .__cxa_begin_catch[PR] 109; ASM: nop 110; ASM: bl .__cxa_end_catch[PR] 111; ASM: nop 112; ASM: b L..BB1_2 113 114; ASM: L.._Z9catchFuncv0: 115; ASM: .vbyte 4, 0x00000000 # Traceback table begin 116; ASM: .byte 0x00 # Version = 0 117; ASM: .byte 0x09 # Language = CPlusPlus 118; ASM: .byte 0x20 # -IsGlobaLinkage, -IsOutOfLineEpilogOrPrologue 119; ASM: # +HasTraceBackTableOffset, -IsInternalProcedure 120; ASM: # -HasControlledStorage, -IsTOCless 121; ASM: # -IsFloatingPointPresent 122; ASM: # -IsFloatingPointOperationLogOrAbortEnabled 123; ASM: .byte 0x41 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed 124; ASM: # OnConditionDirective = 0, -IsCRSaved, +IsLRSaved 125; ASM: .byte 0x80 # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 126; ASM: .byte 0x80 # +HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 0 127; ASM: .byte 0x00 # NumberOfFixedParms = 0 128; ASM: .byte 0x01 # NumberOfFPParms = 0, +HasParmsOnStack 129; ASMNFS: .vbyte 4, L.._Z9catchFuncv0-._Z9catchFuncv # Function size 130; ASMFS: .vbyte 4, L.._Z9catchFuncv0-._Z9catchFuncv[PR] # Function size 131; ASM: .vbyte 2, 0x000d # Function name len = 13 132; ASM: .byte "_Z9catchFuncv" # Function Name 133; ASM: .byte 0x08 # ExtensionTableFlag = TB_EH_INFO 134; ASM: .align 2 135; ASM32: .vbyte 4, L..C1-TOC[TC0] # EHInfo Table 136; ASM64: .vbyte 8, L..C1-TOC[TC0] # EHInfo Table 137; ASM: L..func_end0: 138 139; ASMNFS: .csect .gcc_except_table[RO],2 140; ASMFS: .csect .gcc_except_table._Z9catchFuncv[RO],2 141; ASM: .align 2 142; ASM: GCC_except_table1: 143; ASM: L..exception0: 144; ASM: .byte 255 # @LPStart Encoding = omit 145; ASM32: .byte 187 # @TType Encoding = indirect datarel sdata4 146; ASM64: .byte 188 # @TType Encoding = indirect datarel sdata8 147; ASM32: .byte 37 148; ASM64: .byte 41 149; ASM: .byte 3 # Call site Encoding = udata4 150; ASM: .byte 26 151; ASM: .vbyte 4, L..tmp0-L..func_begin0 # >> Call Site 1 << 152; ASM: .vbyte 4, L..tmp1-L..tmp0 # Call between L..tmp0 and L..tmp1 153; ASM: .vbyte 4, L..tmp2-L..func_begin0 # jumps to L..tmp2 154; ASM: .byte 1 # On action: 1 155; ASM: .vbyte 4, L..tmp1-L..func_begin0 # >> Call Site 2 << 156; ASM: .vbyte 4, L..func_end0-L..tmp1 # Call between L..tmp1 and L..func_end0 157; ASM: .vbyte 4, 0 # has no landing pad 158; ASM: .byte 0 # On action: cleanup 159; ASM: L..cst_end0: 160; ASM: .byte 1 # >> Action Record 1 << 161; ASM: # Catch TypeInfo 1 162; ASM: .byte 0 # No further actions 163; ASM: .align 2 164; ASM: # >> Catch TypeInfos << 165; ASM32: .vbyte 4, L..C0-TOC[TC0] # TypeInfo 1 166; ASM64: .vbyte 8, L..C0-TOC[TC0] # TypeInfo 1 167; ASM: L..ttbase0: 168; ASM: .align 2 169 170; ASMNFS: .csect .eh_info_table[RW],2 171; ASMFS: .csect .eh_info_table._Z9catchFuncv[RW],2 172; ASM: __ehinfo.1: 173; ASM: .vbyte 4, 0 174; ASM32: .align 2 175; ASM32: .vbyte 4, GCC_except_table1 176; ASM32: .vbyte 4, __xlcxx_personality_v1[DS] 177; ASM64: .align 3 178; ASM64: .vbyte 8, GCC_except_table1 179; ASM64: .vbyte 8, __xlcxx_personality_v1[DS] 180 181; ASM: .toc 182; ASM: L..C0: 183; ASM: .tc _ZTIi[TC],_ZTIi[UA] 184; ASM: L..C1: 185; ASM: .tc __ehinfo.1[TC],__ehinfo.1 186 187declare i8* @__cxa_allocate_exception(i32) 188declare void @__cxa_throw(i8*, i8*, i8*) 189declare i32 @__xlcxx_personality_v1(...) 190declare i32 @llvm.eh.typeid.for(i8*) 191declare i8* @__cxa_begin_catch(i8*) 192declare void @__cxa_end_catch() 193