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