Home | History | Annotate | Download | only in ARM
      1 ; RUN: llc -mtriple armv7-apple-ios -relocation-model=pic -o - %s | FileCheck %s -check-prefix=ARM-PIC
      2 ; RUN: llc -mtriple armv7-apple-ios -relocation-model=static -o - %s | FileCheck %s -check-prefix=ARM-NOPIC
      3 ; RUN: llc -mtriple armv7-apple-ios -relocation-model=dynamic-no-pic -o - %s | FileCheck %s -check-prefix=ARM-NOPIC
      4 ; RUN: llc -mtriple thumbv6-apple-ios -relocation-model=pic -o - %s | FileCheck %s -check-prefix=THUMB1-PIC
      5 ; RUN: llc -mtriple thumbv6-apple-ios -relocation-model=static -o - %s | FileCheck %s -check-prefix=THUMB1-NOPIC
      6 ; RUN: llc -mtriple thumbv6-apple-ios -relocation-model=dynamic-no-pic -o - %s | FileCheck %s -check-prefix=THUMB1-NOPIC
      7 
      8 @_ZTIi = external constant i8*
      9 
     10 define i32 @main() #0 personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) {
     11 entry:
     12   %exception = tail call i8* @__cxa_allocate_exception(i32 4) #1
     13   %0 = bitcast i8* %exception to i32*
     14   store i32 1, i32* %0, align 4
     15   invoke void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null) #2
     16           to label %unreachable unwind label %lpad
     17 
     18 lpad:                                             ; preds = %entry
     19   %1 = landingpad { i8*, i32 }
     20           catch i8* null
     21   %2 = extractvalue { i8*, i32 } %1, 0
     22   %3 = tail call i8* @__cxa_begin_catch(i8* %2) #1
     23   tail call void @__cxa_end_catch()
     24   ret i32 0
     25 
     26 unreachable:                                      ; preds = %entry
     27   unreachable
     28 }
     29 
     30 declare i8* @__cxa_allocate_exception(i32)
     31 
     32 declare void @__cxa_throw(i8*, i8*, i8*)
     33 
     34 declare i8* @__cxa_begin_catch(i8*)
     35 
     36 declare void @__cxa_end_catch()
     37 
     38 declare i32 @__gxx_personality_sj0(...)
     39 
     40 attributes #0 = { ssp }
     41 attributes #1 = { nounwind }
     42 attributes #2 = { noreturn }
     43 
     44 ; ARM-PIC: cxa_throw
     45 ; ARM-PIC: trap
     46 ; ARM-PIC: adr [[REG1:r[0-9]+]], [[LJTI:.*]]
     47 ; ARM-PIC: ldr [[REG0:r[0-9]+]], [r{{[0-9]+}}, [[REG1]]]
     48 ; ARM-PIC: add pc, [[REG0]], [[REG1]]
     49 ; ARM-PIC: [[LJTI]]
     50 ; ARM-PIC: .data_region jt32
     51 ; ARM-PIC: .long [[LABEL:LBB0_[0-9]]]-[[LJTI]]
     52 ; ARM-PIC: .end_data_region
     53 ; ARM-PIC: [[LABEL]]
     54 
     55 ; ARM-NOPIC: cxa_throw
     56 ; ARM-NOPIC: trap
     57 ; ARM-NOPIC: adr [[REG1:r[0-9]+]], [[LJTI:.*]]
     58 ; ARM-NOPIC: ldr [[REG0:r[0-9]+]], [r{{[0-9]+}}, [[REG1]]]
     59 ; ARM-NOPIC: mov pc, [[REG0]]
     60 ; ARM-NOPIC: [[LJTI]]
     61 ; ARM-NOPIC: .data_region jt32
     62 ; ARM-NOPIC: .long [[LABEL:LBB0_[0-9]]]
     63 ; ARM-NOPIC: .end_data_region
     64 ; ARM-NOPIC: [[LABEL]]
     65 
     66 ; THUMB1-PIC: cxa_throw
     67 ; THUMB1-PIC: trap
     68 ; THUMB1-PIC: adr [[REG1:r[0-9]+]], [[LJTI:.*]]
     69 ; THUMB1-PIC: adds [[REG0:r[0-9]+]], [[REG0]], [[REG1]]
     70 ; THUMB1-PIC: ldr [[REG0]]
     71 ; THUMB1-PIC: adds [[REG0]], [[REG0]], [[REG1]]
     72 ; THUMB1-PIC: mov pc, [[REG0]]
     73 ; THUMB1-PIC: [[LJTI]]
     74 ; THUMB1-PIC: .data_region jt32
     75 ; THUMB1-PIC: .long [[LABEL:LBB0_[0-9]]]-[[LJTI]]
     76 ; THUMB1-PIC: .end_data_region
     77 ; THUMB1-PIC: [[LABEL]]
     78 
     79 ; THUMB1-NOPIC: cxa_throw
     80 ; THUMB1-NOPIC: trap
     81 ; THUMB1-NOPIC: adr [[REG1:r[0-9]+]], [[LJTI:.*]]
     82 ; THUMB1-NOPIC: adds [[REG0:r[0-9]+]], [[REG0]], [[REG1]]
     83 ; THUMB1-NOPIC: ldr [[REG0]]
     84 ; THUMB1-NOPIC: mov pc, [[REG0]]
     85 ; THUMB1-NOPIC: [[LJTI]]
     86 ; THUMB1-NOPIC: .data_region jt32
     87 ; THUMB1-NOPIC: .long [[LABEL:LBB0_[0-9]]]+1
     88 ; THUMB1-NOPIC: .end_data_region
     89 ; THUMB1-NOPIC: [[LABEL]]
     90