From 30ec8a3658b1f06bb94d392c55feb7f107517bf8 Mon Sep 17 00:00:00 2001 From: Venkatraman Govindaraju Date: Thu, 26 Sep 2013 15:11:00 +0000 Subject: [Sparc] Implements exception handling in SPARC with DwarfCFI. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191432 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGen/SPARC/exception.ll | 112 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 test/CodeGen/SPARC/exception.ll (limited to 'test/CodeGen/SPARC') diff --git a/test/CodeGen/SPARC/exception.ll b/test/CodeGen/SPARC/exception.ll new file mode 100644 index 0000000000..cb5b6e5c11 --- /dev/null +++ b/test/CodeGen/SPARC/exception.ll @@ -0,0 +1,112 @@ +; RUN: llc < %s -march=sparc | FileCheck %s + + +%struct.__fundamental_type_info_pseudo = type { %struct.__type_info_pseudo } +%struct.__type_info_pseudo = type { i8*, i8* } + +@_ZTIi = external constant %struct.__fundamental_type_info_pseudo +@_ZTIf = external constant %struct.__fundamental_type_info_pseudo +@.cst = linker_private unnamed_addr constant [12 x i8] c"catched int\00", align 64 +@.cst1 = linker_private unnamed_addr constant [14 x i8] c"catched float\00", align 64 + +; CHECK-LABEL: main: +; CHECK: .cfi_startproc +; CHECK: .cfi_def_cfa_register 30 +; CHECK: .cfi_window_save +; CHECK: .cfi_register 15, 31 + +; CHECK: call __cxa_throw +; CHECK: call __cxa_throw + +; CHECK: call __cxa_begin_catch +; CHECK: call __cxa_end_catch + +; CHECK: call __cxa_begin_catch +; CHECK: call __cxa_end_catch + +; CHECK: .cfi_endproc + +define i32 @main(i32 %argc, i8** nocapture readnone %argv) unnamed_addr #0 { +entry: + %0 = icmp eq i32 %argc, 2 + %1 = tail call i8* @__cxa_allocate_exception(i32 4) #1 + br i1 %0, label %"3", label %"4" + +"3": ; preds = %entry + %2 = bitcast i8* %1 to i32* + store i32 0, i32* %2, align 4 + invoke void @__cxa_throw(i8* %1, i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIi to i8*), void (i8*)* null) #2 + to label %3 unwind label %"8" + +;