llvm.org GIT mirror llvm / 238f34a
Adding tests for the Intel JIT event listener's MCJIT support. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168459 91177308-0d34-0410-b5e6-96231b3b80d8 Andrew Kaylor 6 years ago
14 changed file(s) with 845 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
1111 set(EXCLUDE_FROM_ALL ON)
1212 endif()
1313
14 add_lit_testsuite(check-llvm "Running the LLVM regression tests"
15 ${CMAKE_CURRENT_BINARY_DIR}
16 PARAMS llvm_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
17 llvm_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
18 DEPENDS UnitTests
14 # Set the depends list as a variable so that it can grow conditionally.
15 set(LLVM_TEST_DEPENDS UnitTests
1916 BugpointPasses LLVMHello
2017 llc lli llvm-ar llvm-as
2118 llvm-bcanalyzer llvm-diff
2926 macho-dump opt
3027 profile_rt-shared
3128 FileCheck count not
32 yaml2obj
29 yaml2obj)
30
31 # If Intel JIT events are supported, depend on a tool that tests the listener.
32 if( LLVM_USE_INTEL_JITEVENTS )
33 set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} llvm-jitlistener)
34 endif( LLVM_USE_INTEL_JITEVENTS )
35
36 add_lit_testsuite(check-llvm "Running the LLVM regression tests"
37 ${CMAKE_CURRENT_BINARY_DIR}
38 PARAMS llvm_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
39 llvm_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
40 DEPENDS ${LLVM_TEST_DEPENDS}
3341 )
3442 set_target_properties(check-llvm PROPERTIES FOLDER "Tests")
3543
0 config.suffixes = ['.ll']
1
2 def getRoot(config):
3 if not config.parent:
4 return config
5 return getRoot(config.parent)
6
7 root = getRoot(config)
8 if not root.llvm_use_intel_jitevents == "ON":
9 config.unsupported = True
10
0 ; RUN: llvm-jitlistener %s | FileCheck %s
1
2 ; CHECK: Method load [1]: main, Size = 164
3 ; CHECK: Method unload [1]
4
5 ; ModuleID = ''
6 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
7 target triple = "x86_64-unknown-linux-gnu"
8
9 @zero_int = common global i32 0, align 4
10 @zero_arr = common global [10 x i32] zeroinitializer, align 16
11 @zero_double = common global double 0.000000e+00, align 8
12
13 define i32 @main() nounwind uwtable {
14 entry:
15 %retval = alloca i32, align 4
16 %i = alloca i32, align 4
17 store i32 0, i32* %retval
18 %0 = load i32* @zero_int, align 4, !dbg !21
19 %add = add nsw i32 %0, 5, !dbg !21
20 %idxprom = sext i32 %add to i64, !dbg !21
21 %arrayidx = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom, !dbg !21
22 store i32 40, i32* %arrayidx, align 4, !dbg !21
23 %1 = load double* @zero_double, align 8, !dbg !23
24 %cmp = fcmp olt double %1, 1.000000e+00, !dbg !23
25 br i1 %cmp, label %if.then, label %if.end, !dbg !23
26
27 if.then: ; preds = %entry
28 %2 = load i32* @zero_int, align 4, !dbg !24
29 %add1 = add nsw i32 %2, 2, !dbg !24
30 %idxprom2 = sext i32 %add1 to i64, !dbg !24
31 %arrayidx3 = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom2, !dbg !24
32 store i32 70, i32* %arrayidx3, align 4, !dbg !24
33 br label %if.end, !dbg !24
34
35 if.end: ; preds = %if.then, %entry
36 call void @llvm.dbg.declare(metadata !{i32* %i}, metadata !25), !dbg !27
37 store i32 1, i32* %i, align 4, !dbg !28
38 br label %for.cond, !dbg !28
39
40 for.cond: ; preds = %for.inc, %if.end
41 %3 = load i32* %i, align 4, !dbg !28
42 %cmp4 = icmp slt i32 %3, 10, !dbg !28
43 br i1 %cmp4, label %for.body, label %for.end, !dbg !28
44
45 for.body: ; preds = %for.cond
46 %4 = load i32* %i, align 4, !dbg !29
47 %sub = sub nsw i32 %4, 1, !dbg !29
48 %idxprom5 = sext i32 %sub to i64, !dbg !29
49 %arrayidx6 = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom5, !dbg !29
50 %5 = load i32* %arrayidx6, align 4, !dbg !29
51 %6 = load i32* %i, align 4, !dbg !29
52 %idxprom7 = sext i32 %6 to i64, !dbg !29
53 %arrayidx8 = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom7, !dbg !29
54 %7 = load i32* %arrayidx8, align 4, !dbg !29
55 %add9 = add nsw i32 %5, %7, !dbg !29
56 %8 = load i32* %i, align 4, !dbg !29
57 %idxprom10 = sext i32 %8 to i64, !dbg !29
58 %arrayidx11 = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom10, !dbg !29
59 store i32 %add9, i32* %arrayidx11, align 4, !dbg !29
60 br label %for.inc, !dbg !31
61
62 for.inc: ; preds = %for.body
63 %9 = load i32* %i, align 4, !dbg !32
64 %inc = add nsw i32 %9, 1, !dbg !32
65 store i32 %inc, i32* %i, align 4, !dbg !32
66 br label %for.cond, !dbg !32
67
68 for.end: ; preds = %for.cond
69 %10 = load i32* getelementptr inbounds ([10 x i32]* @zero_arr, i32 0, i64 9), align 4, !dbg !33
70 %cmp12 = icmp eq i32 %10, 110, !dbg !33
71 %cond = select i1 %cmp12, i32 0, i32 -1, !dbg !33
72 ret i32 %cond, !dbg !33
73 }
74
75 declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
76
77 !llvm.dbg.cu = !{!0}
78
79 !0 = metadata !{i32 720913, i32 0, i32 12, metadata !"test-common-symbols.c", metadata !"/store/store/llvm/build", metadata !"clang version 3.1 ()", i1 true, i1 false, metadata !"", i32 0, metadata !1, metadata !1, metadata !3, metadata !12} ; [ DW_TAG_compile_unit ]
80 !1 = metadata !{metadata !2}
81 !2 = metadata !{i32 0}
82 !3 = metadata !{metadata !4}
83 !4 = metadata !{metadata !5}
84 !5 = metadata !{i32 720942, i32 0, metadata !6, metadata !"main", metadata !"main", metadata !"", metadata !6, i32 6, metadata !7, i1 false, i1 true, i32 0, i32 0, null, i32 0, i1 false, i32 ()* @main, null, null, metadata !10} ; [ DW_TAG_subprogram ]
85 !6 = metadata !{i32 720937, metadata !"test-common-symbols.c", metadata !"/store/store/llvm/build", null} ; [ DW_TAG_file_type ]
86 !7 = metadata !{i32 720917, i32 0, metadata !"", i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !8, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
87 !8 = metadata !{metadata !9}
88 !9 = metadata !{i32 720932, null, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
89 !10 = metadata !{metadata !11}
90 !11 = metadata !{i32 720932} ; [ DW_TAG_base_type ]
91 !12 = metadata !{metadata !13}
92 !13 = metadata !{metadata !14, metadata !15, metadata !17}
93 !14 = metadata !{i32 720948, i32 0, null, metadata !"zero_int", metadata !"zero_int", metadata !"", metadata !6, i32 1, metadata !9, i32 0, i32 1, i32* @zero_int} ; [ DW_TAG_variable ]
94 !15 = metadata !{i32 720948, i32 0, null, metadata !"zero_double", metadata !"zero_double", metadata !"", metadata !6, i32 2, metadata !16, i32 0, i32 1, double* @zero_double} ; [ DW_TAG_variable ]
95 !16 = metadata !{i32 720932, null, metadata !"double", null, i32 0, i64 64, i64 64, i64 0, i32 0, i32 4} ; [ DW_TAG_base_type ]
96 !17 = metadata !{i32 720948, i32 0, null, metadata !"zero_arr", metadata !"zero_arr", metadata !"", metadata !6, i32 3, metadata !18, i32 0, i32 1, [10 x i32]* @zero_arr} ; [ DW_TAG_variable ]
97 !18 = metadata !{i32 720897, null, metadata !"", null, i32 0, i64 320, i64 32, i32 0, i32 0, metadata !9, metadata !19, i32 0, i32 0} ; [ DW_TAG_array_type ]
98 !19 = metadata !{metadata !20}
99 !20 = metadata !{i32 720929, i64 0, i64 9} ; [ DW_TAG_subrange_type ]
100 !21 = metadata !{i32 7, i32 5, metadata !22, null}
101 !22 = metadata !{i32 720907, metadata !5, i32 6, i32 1, metadata !6, i32 0} ; [ DW_TAG_lexical_block ]
102 !23 = metadata !{i32 9, i32 5, metadata !22, null}
103 !24 = metadata !{i32 10, i32 9, metadata !22, null}
104 !25 = metadata !{i32 721152, metadata !26, metadata !"i", metadata !6, i32 12, metadata !9, i32 0, i32 0} ; [ DW_TAG_auto_variable ]
105 !26 = metadata !{i32 720907, metadata !22, i32 12, i32 5, metadata !6, i32 1} ; [ DW_TAG_lexical_block ]
106 !27 = metadata !{i32 12, i32 14, metadata !26, null}
107 !28 = metadata !{i32 12, i32 19, metadata !26, null}
108 !29 = metadata !{i32 13, i32 9, metadata !30, null}
109 !30 = metadata !{i32 720907, metadata !26, i32 12, i32 34, metadata !6, i32 2} ; [ DW_TAG_lexical_block ]
110 !31 = metadata !{i32 14, i32 5, metadata !30, null}
111 !32 = metadata !{i32 12, i32 29, metadata !26, null}
112 !33 = metadata !{i32 15, i32 5, metadata !22, null}
0 ; RUN: llvm-jitlistener %s | FileCheck %s
1
2 ; CHECK: Method load [1]: _Z15test_parametersPfPA2_dR11char_structPPitm, Size = 165
3 ; CHECK: Method load [2]: _Z3food, Size = 39
4 ; CHECK: Method load [3]: main, Size = 146
5 ; CHECK: Method unload [1]
6 ; CHECK: Method unload [2]
7 ; CHECK: Method unload [3]
8
9 ; ModuleID = 'test-inline.bc'
10 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
11 target triple = "x86_64-unknown-linux-gnu"
12
13 %struct.char_struct = type { i8, [2 x i8] }
14
15 @compound_char = global %struct.char_struct zeroinitializer, align 1
16 @_ZZ4mainE1d = private unnamed_addr constant [2 x [2 x double]] [[2 x double] [double 0.000000e+00, double 1.000000e+00], [2 x double] [double 2.000000e+00, double 3.000000e+00]], align 16
17
18 define double @_Z15test_parametersPfPA2_dR11char_structPPitm(float* %pf, [2 x double]* %ppd, %struct.char_struct* %s, i32** %ppn, i16 zeroext %us, i64 %l) uwtable {
19 entry:
20 %pf.addr = alloca float*, align 8
21 %ppd.addr = alloca [2 x double]*, align 8
22 %s.addr = alloca %struct.char_struct*, align 8
23 %ppn.addr = alloca i32**, align 8
24 %us.addr = alloca i16, align 2
25 %l.addr = alloca i64, align 8
26 %result = alloca double, align 8
27 %result2 = alloca i32, align 4
28 store float* %pf, float** %pf.addr, align 8
29 call void @llvm.dbg.declare(metadata !{float** %pf.addr}, metadata !32), !dbg !35
30 store [2 x double]* %ppd, [2 x double]** %ppd.addr, align 8
31 call void @llvm.dbg.declare(metadata !{[2 x double]** %ppd.addr}, metadata !36), !dbg !39
32 store %struct.char_struct* %s, %struct.char_struct** %s.addr, align 8
33 call void @llvm.dbg.declare(metadata !{%struct.char_struct** %s.addr}, metadata !40), !dbg !42
34 store i32** %ppn, i32*** %ppn.addr, align 8
35 call void @llvm.dbg.declare(metadata !{i32*** %ppn.addr}, metadata !43), !dbg !46
36 store i16 %us, i16* %us.addr, align 2
37 call void @llvm.dbg.declare(metadata !{i16* %us.addr}, metadata !47), !dbg !49
38 store i64 %l, i64* %l.addr, align 8
39 call void @llvm.dbg.declare(metadata !{i64* %l.addr}, metadata !50), !dbg !53
40 call void @llvm.dbg.declare(metadata !{double* %result}, metadata !54), !dbg !56
41 %0 = load float** %pf.addr, align 8, !dbg !57
42 %arrayidx = getelementptr inbounds float* %0, i64 0, !dbg !57
43 %1 = load float* %arrayidx, !dbg !57
44 %conv = fpext float %1 to double, !dbg !57
45 %2 = load [2 x double]** %ppd.addr, align 8, !dbg !57
46 %arrayidx1 = getelementptr inbounds [2 x double]* %2, i64 1, !dbg !57
47 %arrayidx2 = getelementptr inbounds [2 x double]* %arrayidx1, i32 0, i64 1, !dbg !57
48 %3 = load double* %arrayidx2, !dbg !57
49 %mul = fmul double %conv, %3, !dbg !57
50 %4 = load %struct.char_struct** %s.addr, !dbg !57
51 %c = getelementptr inbounds %struct.char_struct* %4, i32 0, i32 0, !dbg !57
52 %5 = load i8* %c, align 1, !dbg !57
53 %conv3 = sext i8 %5 to i32, !dbg !57
54 %conv4 = sitofp i32 %conv3 to double, !dbg !57
55 %mul5 = fmul double %mul, %conv4, !dbg !57
56 %6 = load i16* %us.addr, align 2, !dbg !57
57 %conv6 = zext i16 %6 to i32, !dbg !57
58 %conv7 = sitofp i32 %conv6 to double, !dbg !57
59 %mul8 = fmul double %mul5, %conv7, !dbg !57
60 %7 = load i64* %l.addr, align 8, !dbg !57
61 %conv9 = uitofp i64 %7 to double, !dbg !57
62 %mul10 = fmul double %mul8, %conv9, !dbg !57
63 store double %mul10, double* %result, align 8, !dbg !57
64 call void @llvm.dbg.declare(metadata !{i32* %result2}, metadata !58), !dbg !59
65 %8 = load double* %result, align 8, !dbg !60
66 %call = call i32 @_Z3food(double %8), !dbg !60
67 store i32 %call, i32* %result2, align 4, !dbg !60
68 %9 = load i32* %result2, align 4, !dbg !61
69 %conv11 = sitofp i32 %9 to double, !dbg !61
70 ret double %conv11, !dbg !61
71 }
72
73 declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
74
75 define linkonce_odr i32 @_Z3food(double %input) nounwind uwtable inlinehint {
76 entry:
77 %input.addr = alloca double, align 8
78 store double %input, double* %input.addr, align 8
79 call void @llvm.dbg.declare(metadata !{double* %input.addr}, metadata !62), !dbg !63
80 %0 = load double* %input.addr, align 8, !dbg !64
81 %div = fdiv double %0, 3.000000e+00, !dbg !64
82 %add = fadd double %div, 1.000000e+00, !dbg !64
83 %conv = fptosi double %add to i32, !dbg !64
84 ret i32 %conv, !dbg !64
85 }
86
87 define i32 @main(i32 %argc, i8** %argv) uwtable {
88 entry:
89 %retval = alloca i32, align 4
90 %argc.addr = alloca i32, align 4
91 %argv.addr = alloca i8**, align 8
92 %s = alloca %struct.char_struct, align 1
93 %f = alloca float, align 4
94 %d = alloca [2 x [2 x double]], align 16
95 %result = alloca double, align 8
96 store i32 0, i32* %retval
97 store i32 %argc, i32* %argc.addr, align 4
98 call void @llvm.dbg.declare(metadata !{i32* %argc.addr}, metadata !66), !dbg !67
99 store i8** %argv, i8*** %argv.addr, align 8
100 call void @llvm.dbg.declare(metadata !{i8*** %argv.addr}, metadata !68), !dbg !71
101 call void @llvm.dbg.declare(metadata !{%struct.char_struct* %s}, metadata !72), !dbg !74
102 call void @llvm.dbg.declare(metadata !{float* %f}, metadata !75), !dbg !76
103 store float 0.000000e+00, float* %f, align 4, !dbg !77
104 call void @llvm.dbg.declare(metadata !{[2 x [2 x double]]* %d}, metadata !78), !dbg !81
105 %0 = bitcast [2 x [2 x double]]* %d to i8*, !dbg !82
106 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* bitcast ([2 x [2 x double]]* @_ZZ4mainE1d to i8*), i64 32, i32 16, i1 false), !dbg !82
107 %c = getelementptr inbounds %struct.char_struct* %s, i32 0, i32 0, !dbg !83
108 store i8 97, i8* %c, align 1, !dbg !83
109 %c2 = getelementptr inbounds %struct.char_struct* %s, i32 0, i32 1, !dbg !84
110 %arrayidx = getelementptr inbounds [2 x i8]* %c2, i32 0, i64 0, !dbg !84
111 store i8 48, i8* %arrayidx, align 1, !dbg !84
112 %c21 = getelementptr inbounds %struct.char_struct* %s, i32 0, i32 1, !dbg !85
113 %arrayidx2 = getelementptr inbounds [2 x i8]* %c21, i32 0, i64 1, !dbg !85
114 store i8 49, i8* %arrayidx2, align 1, !dbg !85
115 call void @llvm.dbg.declare(metadata !{double* %result}, metadata !86), !dbg !87
116 %arraydecay = getelementptr inbounds [2 x [2 x double]]* %d, i32 0, i32 0, !dbg !88
117 %call = call double @_Z15test_parametersPfPA2_dR11char_structPPitm(float* %f, [2 x double]* %arraydecay, %struct.char_struct* %s, i32** null, i16 zeroext 10, i64 42), !dbg !88
118 store double %call, double* %result, align 8, !dbg !88
119 %1 = load double* %result, align 8, !dbg !89
120 %cmp = fcmp oeq double %1, 0.000000e+00, !dbg !89
121 %cond = select i1 %cmp, i32 0, i32 -1, !dbg !89
122 ret i32 %cond, !dbg !89
123 }
124
125 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
126
127 !llvm.dbg.cu = !{!0}
128
129 !0 = metadata !{i32 720913, i32 0, i32 4, metadata !"test-inline.cpp", metadata !"/home/athirumurthi/dev/opencl-mc/build/RH64/Debug/backend/llvm", metadata !"clang version 3.0 (branches/release_30 36797)", i1 true, i1 false, metadata !"", i32 0, metadata !1, metadata !1, metadata !3, metadata !17} ; [ DW_TAG_compile_unit ]
130 !1 = metadata !{metadata !2}
131 !2 = metadata !{i32 0}
132 !3 = metadata !{metadata !4}
133 !4 = metadata !{metadata !5, metadata !12, metadata !16}
134 !5 = metadata !{i32 720942, i32 0, metadata !6, metadata !"test_parameters", metadata !"test_parameters", metadata !"_Z15test_parametersPfPA2_dR11char_structPPitm", metadata !6, i32 33, metadata !7, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, double (float*, [2 x double]*, %struct.char_struct*, i32**, i16, i64)* @_Z15test_parametersPfPA2_dR11char_structPPitm, null, null, metadata !10} ; [ DW_TAG_subprogram ]
135 !6 = metadata !{i32 720937, metadata !"test-inline.cpp", metadata !"/home/athirumurthi/dev/opencl-mc/build/RH64/Debug/backend/llvm", null} ; [ DW_TAG_file_type ]
136 !7 = metadata !{i32 720917, i32 0, metadata !"", i32 0, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !8, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
137 !8 = metadata !{metadata !9}
138 !9 = metadata !{i32 720932, null, metadata !"double", null, i32 0, i64 64, i64 64, i64 0, i32 0, i32 4} ; [ DW_TAG_base_type ]
139 !10 = metadata !{metadata !11}
140 !11 = metadata !{i32 720932} ; [ DW_TAG_base_type ]
141 !12 = metadata !{i32 720942, i32 0, metadata !6, metadata !"main", metadata !"main", metadata !"", metadata !6, i32 40, metadata !13, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, i32 (i32, i8**)* @main, null, null, metadata !10} ; [ DW_TAG_subprogram ]
142 !13 = metadata !{i32 720917, i32 0, metadata !"", i32 0, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !14, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
143 !14 = metadata !{metadata !15}
144 !15 = metadata !{i32 720932, null, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
145 !16 = metadata !{i32 720942, i32 0, metadata !6, metadata !"foo", metadata !"foo", metadata !"_Z3food", metadata !6, i32 28, metadata !13, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, i32 (double)* @_Z3food, null, null, metadata !10} ; [ DW_TAG_subprogram ]
146 !17 = metadata !{metadata !18}
147 !18 = metadata !{metadata !19}
148 !19 = metadata !{i32 720948, i32 0, null, metadata !"compound_char", metadata !"compound_char", metadata !"", metadata !6, i32 25, metadata !20, i32 0, i32 1, %struct.char_struct* @compound_char} ; [ DW_TAG_variable ]
149 !20 = metadata !{i32 720898, null, metadata !"char_struct", metadata !6, i32 22, i64 24, i64 8, i32 0, i32 0, null, metadata !21, i32 0, null, null} ; [ DW_TAG_class_type ]
150 !21 = metadata !{metadata !22, metadata !24, metadata !28}
151 !22 = metadata !{i32 720909, metadata !20, metadata !"c", metadata !6, i32 23, i64 8, i64 8, i64 0, i32 0, metadata !23} ; [ DW_TAG_member ]
152 !23 = metadata !{i32 720932, null, metadata !"char", null, i32 0, i64 8, i64 8, i64 0, i32 0, i32 6} ; [ DW_TAG_base_type ]
153 !24 = metadata !{i32 720909, metadata !20, metadata !"c2", metadata !6, i32 24, i64 16, i64 8, i64 8, i32 0, metadata !25} ; [ DW_TAG_member ]
154 !25 = metadata !{i32 720897, null, metadata !"", null, i32 0, i64 16, i64 8, i32 0, i32 0, metadata !23, metadata !26, i32 0, i32 0} ; [ DW_TAG_array_type ]
155 !26 = metadata !{metadata !27}
156 !27 = metadata !{i32 720929, i64 0, i64 1} ; [ DW_TAG_subrange_type ]
157 !28 = metadata !{i32 720942, i32 0, metadata !20, metadata !"char_struct", metadata !"char_struct", metadata !"", metadata !6, i32 22, metadata !29, i1 false, i1 false, i32 0, i32 0, null, i32 320, i1 false, null, null, i32 0, metadata !10} ; [ DW_TAG_subprogram ]
158 !29 = metadata !{i32 720917, i32 0, metadata !"", i32 0, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !30, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
159 !30 = metadata !{null, metadata !31}
160 !31 = metadata !{i32 720911, i32 0, metadata !"", i32 0, i32 0, i64 64, i64 64, i64 0, i32 64, metadata !20} ; [ DW_TAG_pointer_type ]
161 !32 = metadata !{i32 721153, metadata !5, metadata !"pf", metadata !6, i32 16777248, metadata !33, i32 0, i32 0} ; [ DW_TAG_arg_variable ]
162 !33 = metadata !{i32 720911, null, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !34} ; [ DW_TAG_pointer_type ]
163 !34 = metadata !{i32 720932, null, metadata !"float", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 4} ; [ DW_TAG_base_type ]
164 !35 = metadata !{i32 32, i32 31, metadata !5, null}
165 !36 = metadata !{i32 721153, metadata !5, metadata !"ppd", metadata !6, i32 33554464, metadata !37, i32 0, i32 0} ; [ DW_TAG_arg_variable ]
166 !37 = metadata !{i32 720911, null, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !38} ; [ DW_TAG_pointer_type ]
167 !38 = metadata !{i32 720897, null, metadata !"", null, i32 0, i64 128, i64 64, i32 0, i32 0, metadata !9, metadata !26, i32 0, i32 0} ; [ DW_TAG_array_type ]
168 !39 = metadata !{i32 32, i32 42, metadata !5, null}
169 !40 = metadata !{i32 721153, metadata !5, metadata !"s", metadata !6, i32 50331680, metadata !41, i32 0, i32 0} ; [ DW_TAG_arg_variable ]
170 !41 = metadata !{i32 720912, null, null, null, i32 0, i64 0, i64 0, i64 0, i32 0, metadata !20} ; [ DW_TAG_reference_type ]
171 !42 = metadata !{i32 32, i32 72, metadata !5, null}
172 !43 = metadata !{i32 721153, metadata !5, metadata !"ppn", metadata !6, i32 67108896, metadata !44, i32 0, i32 0} ; [ DW_TAG_arg_variable ]
173 !44 = metadata !{i32 720911, null, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !45} ; [ DW_TAG_pointer_type ]
174 !45 = metadata !{i32 720911, null, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !15} ; [ DW_TAG_pointer_type ]
175 !46 = metadata !{i32 32, i32 81, metadata !5, null}
176 !47 = metadata !{i32 721153, metadata !5, metadata !"us", metadata !6, i32 83886112, metadata !48, i32 0, i32 0} ; [ DW_TAG_arg_variable ]
177 !48 = metadata !{i32 720932, null, metadata !"unsigned short", null, i32 0, i64 16, i64 16, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ]
178 !49 = metadata !{i32 32, i32 105, metadata !5, null}
179 !50 = metadata !{i32 721153, metadata !5, metadata !"l", metadata !6, i32 100663328, metadata !51, i32 0, i32 0} ; [ DW_TAG_arg_variable ]
180 !51 = metadata !{i32 720934, null, metadata !"", null, i32 0, i64 0, i64 0, i64 0, i32 0, metadata !52} ; [ DW_TAG_const_type ]
181 !52 = metadata !{i32 720932, null, metadata !"long unsigned int", null, i32 0, i64 64, i64 64, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ]
182 !53 = metadata !{i32 32, i32 135, metadata !5, null}
183 !54 = metadata !{i32 721152, metadata !55, metadata !"result", metadata !6, i32 34, metadata !9, i32 0, i32 0} ; [ DW_TAG_auto_variable ]
184 !55 = metadata !{i32 720907, metadata !5, i32 33, i32 1, metadata !6, i32 0} ; [ DW_TAG_lexical_block ]
185 !56 = metadata !{i32 34, i32 10, metadata !55, null}
186 !57 = metadata !{i32 34, i32 51, metadata !55, null}
187 !58 = metadata !{i32 721152, metadata !55, metadata !"result2", metadata !6, i32 35, metadata !15, i32 0, i32 0} ; [ DW_TAG_auto_variable ]
188 !59 = metadata !{i32 35, i32 7, metadata !55, null}
189 !60 = metadata !{i32 35, i32 17, metadata !55, null}
190 !61 = metadata !{i32 36, i32 3, metadata !55, null}
191 !62 = metadata !{i32 721153, metadata !16, metadata !"input", metadata !6, i32 16777243, metadata !9, i32 0, i32 0} ; [ DW_TAG_arg_variable ]
192 !63 = metadata !{i32 27, i32 23, metadata !16, null}
193 !64 = metadata !{i32 29, i32 3, metadata !65, null}
194 !65 = metadata !{i32 720907, metadata !16, i32 28, i32 1, metadata !6, i32 2} ; [ DW_TAG_lexical_block ]
195 !66 = metadata !{i32 721153, metadata !12, metadata !"argc", metadata !6, i32 16777255, metadata !15, i32 0, i32 0} ; [ DW_TAG_arg_variable ]
196 !67 = metadata !{i32 39, i32 14, metadata !12, null}
197 !68 = metadata !{i32 721153, metadata !12, metadata !"argv", metadata !6, i32 33554471, metadata !69, i32 0, i32 0} ; [ DW_TAG_arg_variable ]
198 !69 = metadata !{i32 720911, null, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !70} ; [ DW_TAG_pointer_type ]
199 !70 = metadata !{i32 720911, null, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !23} ; [ DW_TAG_pointer_type ]
200 !71 = metadata !{i32 39, i32 26, metadata !12, null}
201 !72 = metadata !{i32 721152, metadata !73, metadata !"s", metadata !6, i32 41, metadata !20, i32 0, i32 0} ; [ DW_TAG_auto_variable ]
202 !73 = metadata !{i32 720907, metadata !12, i32 40, i32 1, metadata !6, i32 1} ; [ DW_TAG_lexical_block ]
203 !74 = metadata !{i32 41, i32 22, metadata !73, null}
204 !75 = metadata !{i32 721152, metadata !73, metadata !"f", metadata !6, i32 42, metadata !34, i32 0, i32 0} ; [ DW_TAG_auto_variable ]
205 !76 = metadata !{i32 42, i32 9, metadata !73, null}
206 !77 = metadata !{i32 42, i32 16, metadata !73, null}
207 !78 = metadata !{i32 721152, metadata !73, metadata !"d", metadata !6, i32 43, metadata !79, i32 0, i32 0} ; [ DW_TAG_auto_variable ]
208 !79 = metadata !{i32 720897, null, metadata !"", null, i32 0, i64 256, i64 64, i32 0, i32 0, metadata !9, metadata !80, i32 0, i32 0} ; [ DW_TAG_array_type ]
209 !80 = metadata !{metadata !27, metadata !27}
210 !81 = metadata !{i32 43, i32 10, metadata !73, null}
211 !82 = metadata !{i32 43, i32 38, metadata !73, null}
212 !83 = metadata !{i32 45, i32 3, metadata !73, null}
213 !84 = metadata !{i32 46, i32 3, metadata !73, null}
214 !85 = metadata !{i32 47, i32 3, metadata !73, null}
215 !86 = metadata !{i32 721152, metadata !73, metadata !"result", metadata !6, i32 49, metadata !9, i32 0, i32 0} ; [ DW_TAG_auto_variable ]
216 !87 = metadata !{i32 49, i32 10, metadata !73, null}
217 !88 = metadata !{i32 49, i32 19, metadata !73, null}
218 !89 = metadata !{i32 50, i32 3, metadata !73, null}
0 ; RUN: llvm-jitlistener %s | FileCheck %s
1
2 ; CHECK: Method load [1]: _Z15test_parametersPfPA2_dR11char_structPPitm, Size = 170
3 ; CHECK: Method load [2]: _Z3foov, Size = 3
4 ; CHECK: Method load [3]: main, Size = 146
5 ; CHECK: Method unload [1]
6 ; CHECK: Method unload [2]
7 ; CHECK: Method unload [3]
8
9 ; ModuleID = 'test-parameters.bc'
10 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
11 target triple = "x86_64-unknown-linux-gnu"
12
13 %struct.char_struct = type { i8, [2 x i8] }
14
15 @compound_char = global %struct.char_struct zeroinitializer, align 1
16 @_ZZ4mainE1d = private unnamed_addr constant [2 x [2 x double]] [[2 x double] [double 0.000000e+00, double 1.000000e+00], [2 x double] [double 2.000000e+00, double 3.000000e+00]], align 16
17
18 define i32 @_Z3foov() nounwind uwtable {
19 entry:
20 ret i32 0, !dbg !32
21 }
22
23 define double @_Z15test_parametersPfPA2_dR11char_structPPitm(float* %pf, [2 x double]* %ppd, %struct.char_struct* %s, i32** %ppn, i16 zeroext %us, i64 %l) nounwind uwtable {
24 entry:
25 %pf.addr = alloca float*, align 8
26 %ppd.addr = alloca [2 x double]*, align 8
27 %s.addr = alloca %struct.char_struct*, align 8
28 %ppn.addr = alloca i32**, align 8
29 %us.addr = alloca i16, align 2
30 %l.addr = alloca i64, align 8
31 %result = alloca double, align 8
32 store float* %pf, float** %pf.addr, align 8
33 call void @llvm.dbg.declare(metadata !{float** %pf.addr}, metadata !34), !dbg !37
34 store [2 x double]* %ppd, [2 x double]** %ppd.addr, align 8
35 call void @llvm.dbg.declare(metadata !{[2 x double]** %ppd.addr}, metadata !38), !dbg !41
36 store %struct.char_struct* %s, %struct.char_struct** %s.addr, align 8
37 call void @llvm.dbg.declare(metadata !{%struct.char_struct** %s.addr}, metadata !42), !dbg !44
38 store i32** %ppn, i32*** %ppn.addr, align 8
39 call void @llvm.dbg.declare(metadata !{i32*** %ppn.addr}, metadata !45), !dbg !48
40 store i16 %us, i16* %us.addr, align 2
41 call void @llvm.dbg.declare(metadata !{i16* %us.addr}, metadata !49), !dbg !51
42 store i64 %l, i64* %l.addr, align 8
43 call void @llvm.dbg.declare(metadata !{i64* %l.addr}, metadata !52), !dbg !55
44 call void @llvm.dbg.declare(metadata !{double* %result}, metadata !56), !dbg !58
45 %0 = load float** %pf.addr, align 8, !dbg !59
46 %arrayidx = getelementptr inbounds float* %0, i64 0, !dbg !59
47 %1 = load float* %arrayidx, !dbg !59
48 %conv = fpext float %1 to double, !dbg !59
49 %2 = load [2 x double]** %ppd.addr, align 8, !dbg !59
50 %arrayidx1 = getelementptr inbounds [2 x double]* %2, i64 1, !dbg !59
51 %arrayidx2 = getelementptr inbounds [2 x double]* %arrayidx1, i32 0, i64 1, !dbg !59
52 %3 = load double* %arrayidx2, !dbg !59
53 %mul = fmul double %conv, %3, !dbg !59
54 %4 = load %struct.char_struct** %s.addr, !dbg !59
55 %c = getelementptr inbounds %struct.char_struct* %4, i32 0, i32 0, !dbg !59
56 %5 = load i8* %c, align 1, !dbg !59
57 %conv3 = sext i8 %5 to i32, !dbg !59
58 %conv4 = sitofp i32 %conv3 to double, !dbg !59
59 %mul5 = fmul double %mul, %conv4, !dbg !59
60 %6 = load i16* %us.addr, align 2, !dbg !59
61 %conv6 = zext i16 %6 to i32, !dbg !59
62 %conv7 = sitofp i32 %conv6 to double, !dbg !59
63 %mul8 = fmul double %mul5, %conv7, !dbg !59
64 %7 = load i64* %l.addr, align 8, !dbg !59
65 %conv9 = uitofp i64 %7 to double, !dbg !59
66 %mul10 = fmul double %mul8, %conv9, !dbg !59
67 %call = call i32 @_Z3foov(), !dbg !60
68 %conv11 = sitofp i32 %call to double, !dbg !60
69 %add = fadd double %mul10, %conv11, !dbg !60
70 store double %add, double* %result, align 8, !dbg !60
71 %8 = load double* %result, align 8, !dbg !61
72 ret double %8, !dbg !61
73 }
74
75 declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
76
77 define i32 @main(i32 %argc, i8** %argv) nounwind uwtable {
78 entry:
79 %retval = alloca i32, align 4
80 %argc.addr = alloca i32, align 4
81 %argv.addr = alloca i8**, align 8
82 %s = alloca %struct.char_struct, align 1
83 %f = alloca float, align 4
84 %d = alloca [2 x [2 x double]], align 16
85 %result = alloca double, align 8
86 store i32 0, i32* %retval
87 store i32 %argc, i32* %argc.addr, align 4
88 call void @llvm.dbg.declare(metadata !{i32* %argc.addr}, metadata !62), !dbg !63
89 store i8** %argv, i8*** %argv.addr, align 8
90 call void @llvm.dbg.declare(metadata !{i8*** %argv.addr}, metadata !64), !dbg !67
91 call void @llvm.dbg.declare(metadata !{%struct.char_struct* %s}, metadata !68), !dbg !70
92 call void @llvm.dbg.declare(metadata !{float* %f}, metadata !71), !dbg !72
93 store float 0.000000e+00, float* %f, align 4, !dbg !73
94 call void @llvm.dbg.declare(metadata !{[2 x [2 x double]]* %d}, metadata !74), !dbg !77
95 %0 = bitcast [2 x [2 x double]]* %d to i8*, !dbg !78
96 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* bitcast ([2 x [2 x double]]* @_ZZ4mainE1d to i8*), i64 32, i32 16, i1 false), !dbg !78
97 %c = getelementptr inbounds %struct.char_struct* %s, i32 0, i32 0, !dbg !79
98 store i8 97, i8* %c, align 1, !dbg !79
99 %c2 = getelementptr inbounds %struct.char_struct* %s, i32 0, i32 1, !dbg !80
100 %arrayidx = getelementptr inbounds [2 x i8]* %c2, i32 0, i64 0, !dbg !80
101 store i8 48, i8* %arrayidx, align 1, !dbg !80
102 %c21 = getelementptr inbounds %struct.char_struct* %s, i32 0, i32 1, !dbg !81
103 %arrayidx2 = getelementptr inbounds [2 x i8]* %c21, i32 0, i64 1, !dbg !81
104 store i8 49, i8* %arrayidx2, align 1, !dbg !81
105 call void @llvm.dbg.declare(metadata !{double* %result}, metadata !82), !dbg !83
106 %arraydecay = getelementptr inbounds [2 x [2 x double]]* %d, i32 0, i32 0, !dbg !84
107 %call = call double @_Z15test_parametersPfPA2_dR11char_structPPitm(float* %f, [2 x double]* %arraydecay, %struct.char_struct* %s, i32** null, i16 zeroext 10, i64 42), !dbg !84
108 store double %call, double* %result, align 8, !dbg !84
109 %1 = load double* %result, align 8, !dbg !85
110 %cmp = fcmp oeq double %1, 0.000000e+00, !dbg !85
111 %cond = select i1 %cmp, i32 0, i32 -1, !dbg !85
112 ret i32 %cond, !dbg !85
113 }
114
115 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
116
117 !llvm.dbg.cu = !{!0}
118
119 !0 = metadata !{i32 720913, i32 0, i32 4, metadata !"test-parameters.cpp", metadata !"/home/athirumurthi/dev/opencl-mc/build/RH64/Debug/backend/llvm", metadata !"clang version 3.0 (branches/release_30 36797)", i1 true, i1 false, metadata !"", i32 0, metadata !1, metadata !1, metadata !3, metadata !17} ; [ DW_TAG_compile_unit ]
120 !1 = metadata !{metadata !2}
121 !2 = metadata !{i32 0}
122 !3 = metadata !{metadata !4}
123 !4 = metadata !{metadata !5, metadata !12, metadata !16}
124 !5 = metadata !{i32 720942, i32 0, metadata !6, metadata !"foo", metadata !"foo", metadata !"_Z3foov", metadata !6, i32 28, metadata !7, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, i32 ()* @_Z3foov, null, null, metadata !10} ; [ DW_TAG_subprogram ]
125 !6 = metadata !{i32 720937, metadata !"test-parameters.cpp", metadata !"/home/athirumurthi/dev/opencl-mc/build/RH64/Debug/backend/llvm", null} ; [ DW_TAG_file_type ]
126 !7 = metadata !{i32 720917, i32 0, metadata !"", i32 0, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !8, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
127 !8 = metadata !{metadata !9}
128 !9 = metadata !{i32 720932, null, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
129 !10 = metadata !{metadata !11}
130 !11 = metadata !{i32 720932} ; [ DW_TAG_base_type ]
131 !12 = metadata !{i32 720942, i32 0, metadata !6, metadata !"test_parameters", metadata !"test_parameters", metadata !"_Z15test_parametersPfPA2_dR11char_structPPitm", metadata !6, i32 33, metadata !13, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, double (float*, [2 x double]*, %struct.char_struct*, i32**, i16, i64)* @_Z15test_parametersPfPA2_dR11char_structPPitm, null, null, metadata !10} ; [ DW_TAG_subprogram ]
132 !13 = metadata !{i32 720917, i32 0, metadata !"", i32 0, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !14, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
133 !14 = metadata !{metadata !15}
134 !15 = metadata !{i32 720932, null, metadata !"double", null, i32 0, i64 64, i64 64, i64 0, i32 0, i32 4} ; [ DW_TAG_base_type ]
135 !16 = metadata !{i32 720942, i32 0, metadata !6, metadata !"main", metadata !"main", metadata !"", metadata !6, i32 39, metadata !7, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, i32 (i32, i8**)* @main, null, null, metadata !10} ; [ DW_TAG_subprogram ]
136 !17 = metadata !{metadata !18}
137 !18 = metadata !{metadata !19}
138 !19 = metadata !{i32 720948, i32 0, null, metadata !"compound_char", metadata !"compound_char", metadata !"", metadata !6, i32 25, metadata !20, i32 0, i32 1, %struct.char_struct* @compound_char} ; [ DW_TAG_variable ]
139 !20 = metadata !{i32 720898, null, metadata !"char_struct", metadata !6, i32 22, i64 24, i64 8, i32 0, i32 0, null, metadata !21, i32 0, null, null} ; [ DW_TAG_class_type ]
140 !21 = metadata !{metadata !22, metadata !24, metadata !28}
141 !22 = metadata !{i32 720909, metadata !20, metadata !"c", metadata !6, i32 23, i64 8, i64 8, i64 0, i32 0, metadata !23} ; [ DW_TAG_member ]
142 !23 = metadata !{i32 720932, null, metadata !"char", null, i32 0, i64 8, i64 8, i64 0, i32 0, i32 6} ; [ DW_TAG_base_type ]
143 !24 = metadata !{i32 720909, metadata !20, metadata !"c2", metadata !6, i32 24, i64 16, i64 8, i64 8, i32 0, metadata !25} ; [ DW_TAG_member ]
144 !25 = metadata !{i32 720897, null, metadata !"", null, i32 0, i64 16, i64 8, i32 0, i32 0, metadata !23, metadata !26, i32 0, i32 0} ; [ DW_TAG_array_type ]
145 !26 = metadata !{metadata !27}
146 !27 = metadata !{i32 720929, i64 0, i64 1} ; [ DW_TAG_subrange_type ]
147 !28 = metadata !{i32 720942, i32 0, metadata !20, metadata !"char_struct", metadata !"char_struct", metadata !"", metadata !6, i32 22, metadata !29, i1 false, i1 false, i32 0, i32 0, null, i32 320, i1 false, null, null, i32 0, metadata !10} ; [ DW_TAG_subprogram ]
148 !29 = metadata !{i32 720917, i32 0, metadata !"", i32 0, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !30, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
149 !30 = metadata !{null, metadata !31}
150 !31 = metadata !{i32 720911, i32 0, metadata !"", i32 0, i32 0, i64 64, i64 64, i64 0, i32 64, metadata !20} ; [ DW_TAG_pointer_type ]
151 !32 = metadata !{i32 29, i32 3, metadata !33, null}
152 !33 = metadata !{i32 720907, metadata !5, i32 28, i32 1, metadata !6, i32 0} ; [ DW_TAG_lexical_block ]
153 !34 = metadata !{i32 721153, metadata !12, metadata !"pf", metadata !6, i32 16777248, metadata !35, i32 0, i32 0} ; [ DW_TAG_arg_variable ]
154 !35 = metadata !{i32 720911, null, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !36} ; [ DW_TAG_pointer_type ]
155 !36 = metadata !{i32 720932, null, metadata !"float", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 4} ; [ DW_TAG_base_type ]
156 !37 = metadata !{i32 32, i32 31, metadata !12, null}
157 !38 = metadata !{i32 721153, metadata !12, metadata !"ppd", metadata !6, i32 33554464, metadata !39, i32 0, i32 0} ; [ DW_TAG_arg_variable ]
158 !39 = metadata !{i32 720911, null, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !40} ; [ DW_TAG_pointer_type ]
159 !40 = metadata !{i32 720897, null, metadata !"", null, i32 0, i64 128, i64 64, i32 0, i32 0, metadata !15, metadata !26, i32 0, i32 0} ; [ DW_TAG_array_type ]
160 !41 = metadata !{i32 32, i32 42, metadata !12, null}
161 !42 = metadata !{i32 721153, metadata !12, metadata !"s", metadata !6, i32 50331680, metadata !43, i32 0, i32 0} ; [ DW_TAG_arg_variable ]
162 !43 = metadata !{i32 720912, null, null, null, i32 0, i64 0, i64 0, i64 0, i32 0, metadata !20} ; [ DW_TAG_reference_type ]
163 !44 = metadata !{i32 32, i32 72, metadata !12, null}
164 !45 = metadata !{i32 721153, metadata !12, metadata !"ppn", metadata !6, i32 67108896, metadata !46, i32 0, i32 0} ; [ DW_TAG_arg_variable ]
165 !46 = metadata !{i32 720911, null, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !47} ; [ DW_TAG_pointer_type ]
166 !47 = metadata !{i32 720911, null, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !9} ; [ DW_TAG_pointer_type ]
167 !48 = metadata !{i32 32, i32 81, metadata !12, null}
168 !49 = metadata !{i32 721153, metadata !12, metadata !"us", metadata !6, i32 83886112, metadata !50, i32 0, i32 0} ; [ DW_TAG_arg_variable ]
169 !50 = metadata !{i32 720932, null, metadata !"unsigned short", null, i32 0, i64 16, i64 16, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ]
170 !51 = metadata !{i32 32, i32 105, metadata !12, null}
171 !52 = metadata !{i32 721153, metadata !12, metadata !"l", metadata !6, i32 100663328, metadata !53, i32 0, i32 0} ; [ DW_TAG_arg_variable ]
172 !53 = metadata !{i32 720934, null, metadata !"", null, i32 0, i64 0, i64 0, i64 0, i32 0, metadata !54} ; [ DW_TAG_const_type ]
173 !54 = metadata !{i32 720932, null, metadata !"long unsigned int", null, i32 0, i64 64, i64 64, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ]
174 !55 = metadata !{i32 32, i32 135, metadata !12, null}
175 !56 = metadata !{i32 721152, metadata !57, metadata !"result", metadata !6, i32 34, metadata !15, i32 0, i32 0} ; [ DW_TAG_auto_variable ]
176 !57 = metadata !{i32 720907, metadata !12, i32 33, i32 1, metadata !6, i32 1} ; [ DW_TAG_lexical_block ]
177 !58 = metadata !{i32 34, i32 10, metadata !57, null}
178 !59 = metadata !{i32 34, i32 59, metadata !57, null}
179 !60 = metadata !{i32 34, i32 54, metadata !57, null}
180 !61 = metadata !{i32 35, i32 3, metadata !57, null}
181 !62 = metadata !{i32 721153, metadata !16, metadata !"argc", metadata !6, i32 16777254, metadata !9, i32 0, i32 0} ; [ DW_TAG_arg_variable ]
182 !63 = metadata !{i32 38, i32 14, metadata !16, null}
183 !64 = metadata !{i32 721153, metadata !16, metadata !"argv", metadata !6, i32 33554470, metadata !65, i32 0, i32 0} ; [ DW_TAG_arg_variable ]
184 !65 = metadata !{i32 720911, null, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !66} ; [ DW_TAG_pointer_type ]
185 !66 = metadata !{i32 720911, null, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !23} ; [ DW_TAG_pointer_type ]
186 !67 = metadata !{i32 38, i32 26, metadata !16, null}
187 !68 = metadata !{i32 721152, metadata !69, metadata !"s", metadata !6, i32 40, metadata !20, i32 0, i32 0} ; [ DW_TAG_auto_variable ]
188 !69 = metadata !{i32 720907, metadata !16, i32 39, i32 1, metadata !6, i32 2} ; [ DW_TAG_lexical_block ]
189 !70 = metadata !{i32 40, i32 22, metadata !69, null}
190 !71 = metadata !{i32 721152, metadata !69, metadata !"f", metadata !6, i32 41, metadata !36, i32 0, i32 0} ; [ DW_TAG_auto_variable ]
191 !72 = metadata !{i32 41, i32 9, metadata !69, null}
192 !73 = metadata !{i32 41, i32 16, metadata !69, null}
193 !74 = metadata !{i32 721152, metadata !69, metadata !"d", metadata !6, i32 42, metadata !75, i32 0, i32 0} ; [ DW_TAG_auto_variable ]
194 !75 = metadata !{i32 720897, null, metadata !"", null, i32 0, i64 256, i64 64, i32 0, i32 0, metadata !15, metadata !76, i32 0, i32 0} ; [ DW_TAG_array_type ]
195 !76 = metadata !{metadata !27, metadata !27}
196 !77 = metadata !{i32 42, i32 10, metadata !69, null}
197 !78 = metadata !{i32 42, i32 38, metadata !69, null}
198 !79 = metadata !{i32 44, i32 3, metadata !69, null}
199 !80 = metadata !{i32 45, i32 3, metadata !69, null}
200 !81 = metadata !{i32 46, i32 3, metadata !69, null}
201 !82 = metadata !{i32 721152, metadata !69, metadata !"result", metadata !6, i32 48, metadata !15, i32 0, i32 0} ; [ DW_TAG_auto_variable ]
202 !83 = metadata !{i32 48, i32 10, metadata !69, null}
203 !84 = metadata !{i32 48, i32 19, metadata !69, null}
204 !85 = metadata !{i32 49, i32 3, metadata !69, null}
196196 r"\bllvm-bcanalyzer\b", r"\bllvm-config\b",
197197 r"\bllvm-cov\b", r"\bllvm-diff\b",
198198 r"\bllvm-dis\b", r"\bllvm-dwarfdump\b",
199 r"\bllvm-extract\b",
199 r"\bllvm-extract\b", r"\bllvm-jistlistener\b",
200200 r"\bllvm-link\b", r"\bllvm-mc\b",
201201 r"\bllvm-nm\b", r"\bllvm-objdump\b",
202202 r"\bllvm-prof\b", r"\bllvm-ranlib\b",
1515 config.llvm_bindings = "@LLVM_BINDINGS@"
1616 config.host_os = "@HOST_OS@"
1717 config.host_arch = "@HOST_ARCH@"
18 config.llvm_use_intel_jitevents = "@LLVM_USE_INTEL_JITEVENTS@"
1819
1920 # Support substitution of the tools_dir with user parameters. This is
2021 # used when we can't determine the tool dir at configuration time.
3030 add_subdirectory(llvm-readobj)
3131 add_subdirectory(llvm-rtdyld)
3232 add_subdirectory(llvm-dwarfdump)
33 if( LLVM_USE_INTEL_JITEVENTS )
34 add_subdirectory(llvm-jitlistener)
35 endif( LLVM_USE_INTEL_JITEVENTS )
3336
3437 add_subdirectory(bugpoint)
3538 add_subdirectory(bugpoint-passes)
1515 ;===------------------------------------------------------------------------===;
1616
1717 [common]
18 subdirectories = bugpoint llc lli llvm-ar llvm-as llvm-bcanalyzer llvm-cov llvm-diff llvm-dis llvm-dwarfdump llvm-extract llvm-link llvm-mc llvm-nm llvm-objdump llvm-prof llvm-ranlib llvm-rtdyld llvm-size macho-dump opt llvm-mcmarkup
18 subdirectories = bugpoint llc lli llvm-ar llvm-as llvm-bcanalyzer llvm-cov llvm-diff llvm-dis llvm-dwarfdump llvm-extract llvm-jitlistener llvm-link llvm-mc llvm-nm llvm-objdump llvm-prof llvm-ranlib llvm-rtdyld llvm-size macho-dump opt llvm-mcmarkup
1919
2020 [component_0]
2121 type = Group
3232 lli llvm-extract llvm-mc \
3333 bugpoint llvm-bcanalyzer \
3434 llvm-diff macho-dump llvm-objdump llvm-readobj \
35 llvm-rtdyld llvm-dwarfdump llvm-cov \
35 llvm-rtdyld llvm-dwarfdump llvm-cov llvm-jitlistener \
3636 llvm-size llvm-stress llvm-mcmarkup \
3737 llvm-symbolizer
3838
0 # This tool is excluded from the CMake build if Intel JIT events are disabled.
1
2 link_directories( ${LLVM_INTEL_JITEVENTS_LIBDIR} )
3 include_directories( ${LLVM_INTEL_JITEVENTS_INCDIR} )
4
5 set(LLVM_LINK_COMPONENTS
6 asmparser
7 bitreader
8 inteljitevents
9 interpreter
10 jit
11 mcjit
12 nativecodegen
13 object
14 selectiondag
15 )
16
17 add_llvm_tool(llvm-jitlistener
18 llvm-jitlistener.cpp
19 )
0 ;===- ./tools/llvm-jitlistener/LLVMBuild.txt -------------------*- Conf -*--===;
1 ;
2 ; The LLVM Compiler Infrastructure
3 ;
4 ; This file is distributed under the University of Illinois Open Source
5 ; License. See LICENSE.TXT for details.
6 ;
7 ;===------------------------------------------------------------------------===;
8 ;
9 ; This is an LLVMBuild description file for the components in this subdirectory.
10 ;
11 ; For more information on the LLVMBuild system, please see:
12 ;
13 ; http://llvm.org/docs/LLVMBuild.html
14 ;
15 ;===------------------------------------------------------------------------===;
16
17 [component_0]
18 type = Tool
19 name = llvm-jitlistener
20 parent = Tools
21 required_libraries = AsmParser BitReader Interpreter JIT MCJIT NativeCodeGen Object SelectionDAG Native
0 ##===- tools/llvm-jitlistener/Makefile ---------------------*- Makefile -*-===##
1 #
2 # The LLVM Compiler Infrastructure
3 #
4 # This file is distributed under the University of Illinois Open Source
5 # License. See LICENSE.TXT for details.
6 #
7 ##===----------------------------------------------------------------------===##
8
9 LEVEL := ../..
10 TOOLNAME := llvm-jitlistener
11
12 include $(LEVEL)/Makefile.config
13
14 LINK_COMPONENTS := mcjit jit interpreter nativecodegen bitreader asmparser selectiondag Object
15
16 # If Intel JIT Events support is configured, link against the LLVM Intel JIT
17 # Events interface library. If not, this tool will do nothing useful, but it
18 # will build correctly.
19 ifeq ($(USE_INTEL_JITEVENTS), 1)
20 LINK_COMPONENTS += inteljitevents
21 endif
22
23 # This tool has no plugins, optimize startup time.
24 TOOL_NO_EXPORTS := 1
25
26 include $(LLVM_SRC_ROOT)/Makefile.rules
0 //===-- llvm-jitlistener.cpp - Utility for testing MCJIT event listener ---===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This program is a used by lit tests to verify the MCJIT JITEventListener
10 // interface. It registers a mock JIT event listener, generates a module from
11 // an input IR file and dumps the reported event information to stdout.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #include "llvm/ADT/OwningPtr.h"
16 #include "llvm/ADT/Triple.h"
17 #include "../../lib/ExecutionEngine/IntelJITEvents/IntelJITEventsWrapper.h"
18 #include "llvm/ExecutionEngine/JITEventListener.h"
19 #include "llvm/ExecutionEngine/JITMemoryManager.h"
20 #include "llvm/ExecutionEngine/MCJIT.h"
21 #include "llvm/ExecutionEngine/ObjectImage.h"
22 #include "llvm/LLVMContext.h"
23 #include "llvm/Module.h"
24 #include "llvm/Support/CommandLine.h"
25 #include "llvm/Support/Host.h"
26 #include "llvm/Support/IRReader.h"
27 #include "llvm/Support/ManagedStatic.h"
28 #include "llvm/Support/MemoryBuffer.h"
29 #include "llvm/Support/PrettyStackTrace.h"
30 #include "llvm/Support/Signals.h"
31 #include "llvm/Support/SourceMgr.h"
32 #include "llvm/Support/TargetSelect.h"
33 #include
34
35 using namespace llvm;
36
37 namespace {
38
39 typedef std::vector > SourceLocations;
40 typedef std::map NativeCodeMap;
41
42 NativeCodeMap ReportedDebugFuncs;
43
44 int NotifyEvent(iJIT_JVM_EVENT EventType, void *EventSpecificData) {
45 switch (EventType) {
46 case iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED: {
47 if (!EventSpecificData) {
48 errs() <<
49 "Error: The JIT event listener did not provide a event data.";
50 return -1;
51 }
52 iJIT_Method_Load* msg = static_cast(EventSpecificData);
53
54 ReportedDebugFuncs[msg->method_id];
55
56 outs() << "Method load [" << msg->method_id << "]: " << msg->method_name
57 << ", Size = " << msg->method_size << "\n";
58
59 for(unsigned int i = 0; i < msg->line_number_size; ++i) {
60 if (!msg->line_number_table) {
61 errs() << "A function with a non-zero line count had no line table.";
62 return -1;
63 }
64 std::pair loc(
65 std::string(msg->source_file_name),
66 msg->line_number_table[i].LineNumber);
67 ReportedDebugFuncs[msg->method_id].push_back(loc);
68 outs() << " Line info @ " << msg->line_number_table[i].Offset
69 << ": " << msg->source_file_name
70 << ", line " << msg->line_number_table[i].LineNumber << "\n";
71 }
72 outs() << "\n";
73 }
74 break;
75 case iJVM_EVENT_TYPE_METHOD_UNLOAD_START: {
76 if (!EventSpecificData) {
77 errs() <<
78 "Error: The JIT event listener did not provide a event data.";
79 return -1;
80 }
81 unsigned int UnloadId
82 = *reinterpret_cast(EventSpecificData);
83 assert(1 == ReportedDebugFuncs.erase(UnloadId));
84 outs() << "Method unload [" << UnloadId << "]\n";
85 }
86 break;
87 default:
88 break;
89 }
90 return 0;
91 }
92
93 iJIT_IsProfilingActiveFlags IsProfilingActive(void) {
94 // for testing, pretend we have an Intel Parallel Amplifier XE 2011
95 // instance attached
96 return iJIT_SAMPLING_ON;
97 }
98
99 unsigned int GetNewMethodID(void) {
100 static unsigned int id = 0;
101 return ++id;
102 }
103
104 class JitEventListenerTest {
105 protected:
106 void InitEE(const std::string &IRFile) {
107 LLVMContext &Context = getGlobalContext();
108
109 // If we have a native target, initialize it to ensure it is linked in and
110 // usable by the JIT.
111 InitializeNativeTarget();
112 InitializeNativeTargetAsmPrinter();
113
114 // Parse the bitcode...
115 SMDiagnostic Err;
116 TheModule = ParseIRFile(IRFile, Err, Context);
117 if (!TheModule) {
118 errs() << Err.getMessage();
119 return;
120 }
121
122 // FIXME: This is using the default legacy JITMemoryManager because it
123 // supports poison memory. At some point, we'll need to update this to
124 // use an MCJIT-specific memory manager. It might be nice to have the
125 // poison memory option there too.
126 JITMemoryManager *MemMgr = JITMemoryManager::CreateDefaultMemManager();
127 if (!MemMgr) {
128 errs() << "Unable to create memory manager.";
129 return;
130 }
131
132 // Tell the memory manager to poison freed memory so that accessing freed
133 // memory is more easily tested.
134 MemMgr->setPoisonMemory(true);
135
136 // Override the triple to generate ELF on Windows since that's supported
137 Triple Tuple(TheModule->getTargetTriple());
138 if (Tuple.getTriple().empty())
139 Tuple.setTriple(LLVM_HOSTTRIPLE);
140
141 if (Tuple.isOSWindows() && Triple::ELF != Tuple.getEnvironment()) {
142 Tuple.setEnvironment(Triple::ELF);
143 TheModule->setTargetTriple(Tuple.getTriple());
144 }
145
146 // Compile the IR
147 std::string Error;
148 TheJIT.reset(EngineBuilder(TheModule)
149 .setEngineKind(EngineKind::JIT)
150 .setErrorStr(&Error)
151 .setJITMemoryManager(MemMgr)
152 .setUseMCJIT(true)
153 .create());
154 if (Error.empty() == false)
155 errs() << Error;
156 }
157
158 void DestroyEE() {
159 TheJIT.reset();
160 }
161
162 LLVMContext Context; // Global ownership
163 Module *TheModule; // Owned by ExecutionEngine.
164 JITMemoryManager *JMM; // Owned by ExecutionEngine.
165 OwningPtr TheJIT;
166
167 public:
168 void ProcessInput(const std::string &Filename) {
169 InitEE(Filename);
170
171 llvm::OwningPtr Listener(JITEventListener::createIntelJITEventListener(
172 new IntelJITEventsWrapper(NotifyEvent, 0,
173 IsProfilingActive, 0, 0,
174 GetNewMethodID)));
175
176 TheJIT->RegisterJITEventListener(Listener.get());
177
178 TheJIT->finalizeObject();
179
180 // Destroy the JIT engine instead of unregistering to get unload events.
181 DestroyEE();
182 }
183 };
184
185
186
187 } // end anonymous namespace
188
189 static cl::opt
190 InputFilename(cl::Positional, cl::desc(""),
191 cl::Required);
192
193 int main(int argc, char **argv) {
194 // Print a stack trace if we signal out.
195 sys::PrintStackTraceOnErrorSignal();
196 PrettyStackTraceProgram X(argc, argv);
197 llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
198
199 cl::ParseCommandLineOptions(argc, argv, "llvm jit event listener test utility\n");
200
201 JitEventListenerTest Test;
202
203 Test.ProcessInput(InputFilename);
204
205 return 0;
206 }