Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Lower / dispatch-table.f90
blob7b5a5ec4a39e62e8f88e23d23cebb9da3b4eb407
1 ! RUN: bbc -polymorphic-type -emit-fir %s -o - | FileCheck %s
3 ! Tests the generation of fir.dispatch_table operations.
5 module polymorphic_types
6 type p1
7 integer :: a
8 integer :: b
9 contains
10 procedure :: proc1 => proc1_p1
11 procedure :: aproc
12 procedure :: zproc
13 end type
15 type, extends(p1) :: p2
16 integer :: c
17 contains
18 procedure :: proc1 => proc1_p2
19 procedure :: aproc2
20 end type
22 type, extends(p2) :: p3
23 integer :: d
24 contains
25 procedure :: aproc3
26 end type
27 contains
30 subroutine proc1_p1(p)
31 class(p1) :: p
32 end subroutine
34 subroutine aproc(p)
35 class(p1) :: p
36 end subroutine
38 subroutine zproc(p)
39 class(p1) :: p
40 end subroutine
42 subroutine proc1_p2(p)
43 class(p2) :: p
44 end subroutine
46 subroutine aproc2(p)
47 class(p2) :: p
48 end subroutine
50 subroutine aproc3(p)
51 class(p3) :: p
52 end subroutine
54 end module
56 ! CHECK-LABEL: fir.dispatch_table @_QMpolymorphic_typesTp1 {
57 ! CHECK: fir.dt_entry "aproc", @_QMpolymorphic_typesPaproc
58 ! CHECK: fir.dt_entry "proc1", @_QMpolymorphic_typesPproc1_p1
59 ! CHECK: fir.dt_entry "zproc", @_QMpolymorphic_typesPzproc
60 ! CHECK: }
62 ! CHECK-LABEL: fir.dispatch_table @_QMpolymorphic_typesTp2 extends("_QMpolymorphic_typesTp1") {
63 ! CHECK: fir.dt_entry "aproc", @_QMpolymorphic_typesPaproc
64 ! CHECK: fir.dt_entry "proc1", @_QMpolymorphic_typesPproc1_p2
65 ! CHECK: fir.dt_entry "zproc", @_QMpolymorphic_typesPzproc
66 ! CHECK: fir.dt_entry "aproc2", @_QMpolymorphic_typesPaproc2
67 ! CHECK: }
69 ! CHECK-LABEL: fir.dispatch_table @_QMpolymorphic_typesTp3 extends("_QMpolymorphic_typesTp2") {
70 ! CHECK: fir.dt_entry "aproc", @_QMpolymorphic_typesPaproc
71 ! CHECK: fir.dt_entry "proc1", @_QMpolymorphic_typesPproc1_p2
72 ! CHECK: fir.dt_entry "zproc", @_QMpolymorphic_typesPzproc
73 ! CHECK: fir.dt_entry "aproc2", @_QMpolymorphic_typesPaproc2
74 ! CHECK: fir.dt_entry "aproc3", @_QMpolymorphic_typesPaproc3
75 ! CHECK: }