blob: 220cb137b42088f16559bb5311303240373d9ca6 [file] [log] [blame]
Evan Cheng7fae11b2011-12-14 02:11:42 +00001; RUN: llc < %s | FileCheck %s
Devang Patelbe221312011-04-21 20:16:43 +00002; Radar 9309221
3; Test dwarf reg no for d16
4;CHECK: DW_OP_regx
5;CHECK-NEXT: 272
6
7target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32"
8target triple = "thumbv7-apple-darwin10"
9
10@.str = private unnamed_addr constant [11 x i8] c"%p %lf %c\0A\00", align 4
11@.str1 = private unnamed_addr constant [6 x i8] c"point\00", align 4
12
13define i32 @inlineprinter(i8* %ptr, double %val, i8 zeroext %c) nounwind optsize {
14entry:
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000015 tail call void @llvm.dbg.value(metadata i8* %ptr, i64 0, metadata !19, metadata !MDExpression()), !dbg !26
16 tail call void @llvm.dbg.value(metadata double %val, i64 0, metadata !20, metadata !MDExpression()), !dbg !26
17 tail call void @llvm.dbg.value(metadata i8 %c, i64 0, metadata !21, metadata !MDExpression()), !dbg !26
Devang Patelbe221312011-04-21 20:16:43 +000018 %0 = zext i8 %c to i32, !dbg !27
David Blaikief72d05b2015-03-13 18:20:45 +000019 %1 = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i32 0, i32 0), i8* %ptr, double %val, i32 %0) nounwind, !dbg !27
Devang Patelbe221312011-04-21 20:16:43 +000020 ret i32 0, !dbg !29
21}
22
23define i32 @printer(i8* %ptr, double %val, i8 zeroext %c) nounwind optsize noinline {
24entry:
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000025 tail call void @llvm.dbg.value(metadata i8* %ptr, i64 0, metadata !16, metadata !MDExpression()), !dbg !30
26 tail call void @llvm.dbg.value(metadata double %val, i64 0, metadata !17, metadata !MDExpression()), !dbg !30
27 tail call void @llvm.dbg.value(metadata i8 %c, i64 0, metadata !18, metadata !MDExpression()), !dbg !30
Devang Patelbe221312011-04-21 20:16:43 +000028 %0 = zext i8 %c to i32, !dbg !31
David Blaikief72d05b2015-03-13 18:20:45 +000029 %1 = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i32 0, i32 0), i8* %ptr, double %val, i32 %0) nounwind, !dbg !31
Devang Patelbe221312011-04-21 20:16:43 +000030 ret i32 0, !dbg !33
31}
32
33declare i32 @printf(i8* nocapture, ...) nounwind
34
Adrian Prantl87b7eb92014-10-01 18:55:02 +000035declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
Devang Patelbe221312011-04-21 20:16:43 +000036
37define i32 @main(i32 %argc, i8** nocapture %argv) nounwind optsize {
38entry:
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000039 tail call void @llvm.dbg.value(metadata i32 %argc, i64 0, metadata !22, metadata !MDExpression()), !dbg !34
40 tail call void @llvm.dbg.value(metadata i8** %argv, i64 0, metadata !23, metadata !MDExpression()), !dbg !34
Devang Patelbe221312011-04-21 20:16:43 +000041 %0 = sitofp i32 %argc to double, !dbg !35
42 %1 = fadd double %0, 5.555552e+05, !dbg !35
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000043 tail call void @llvm.dbg.value(metadata double %1, i64 0, metadata !24, metadata !MDExpression()), !dbg !35
David Blaikief72d05b2015-03-13 18:20:45 +000044 %2 = tail call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str1, i32 0, i32 0)) nounwind, !dbg !36
David Blaikie79e6c742015-02-27 19:29:02 +000045 %3 = getelementptr inbounds i8, i8* bitcast (i32 (i32, i8**)* @main to i8*), i32 %argc, !dbg !37
Devang Patelbe221312011-04-21 20:16:43 +000046 %4 = trunc i32 %argc to i8, !dbg !37
47 %5 = add i8 %4, 97, !dbg !37
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000048 tail call void @llvm.dbg.value(metadata i8* %3, i64 0, metadata !19, metadata !MDExpression()) nounwind, !dbg !38
49 tail call void @llvm.dbg.value(metadata double %1, i64 0, metadata !20, metadata !MDExpression()) nounwind, !dbg !38
50 tail call void @llvm.dbg.value(metadata i8 %5, i64 0, metadata !21, metadata !MDExpression()) nounwind, !dbg !38
Devang Patelbe221312011-04-21 20:16:43 +000051 %6 = zext i8 %5 to i32, !dbg !39
David Blaikief72d05b2015-03-13 18:20:45 +000052 %7 = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i32 0, i32 0), i8* %3, double %1, i32 %6) nounwind, !dbg !39
Devang Patelbe221312011-04-21 20:16:43 +000053 %8 = tail call i32 @printer(i8* %3, double %1, i8 zeroext %5) nounwind, !dbg !40
54 ret i32 0, !dbg !41
55}
56
57declare i32 @puts(i8* nocapture) nounwind
58
David Blaikiee5a2f702013-03-08 00:23:31 +000059!llvm.dbg.cu = !{!2}
Manman Ren409558f2013-11-22 21:49:45 +000060!llvm.module.flags = !{!48}
Devang Patelbe221312011-04-21 20:16:43 +000061
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000062!0 = !MDSubprogram(name: "printer", linkageName: "printer", line: 12, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 12, file: !46, scope: !1, type: !3, function: i32 (i8*, double, i8)* @printer, variables: !43)
63!1 = !MDFile(filename: "a.c", directory: "/tmp/")
64!2 = !MDCompileUnit(language: DW_LANG_C89, producer: "(LLVM build 00)", isOptimized: true, emissionKind: 1, file: !46, enums: !47, retainedTypes: !47, subprograms: !42, imports: null)
65!3 = !MDSubroutineType(types: !4)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000066!4 = !{!5, !6, !7, !8}
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000067!5 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
68!6 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, file: !46, scope: !1, baseType: null)
69!7 = !MDBasicType(tag: DW_TAG_base_type, name: "double", size: 64, align: 32, encoding: DW_ATE_float)
70!8 = !MDBasicType(tag: DW_TAG_base_type, name: "unsigned char", size: 8, align: 8, encoding: DW_ATE_unsigned_char)
71!9 = !MDSubprogram(name: "inlineprinter", linkageName: "inlineprinter", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 5, file: !46, scope: !1, type: !3, function: i32 (i8*, double, i8)* @inlineprinter, variables: !44)
72!10 = !MDSubprogram(name: "main", linkageName: "main", line: 18, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 18, file: !46, scope: !1, type: !11, function: i32 (i32, i8**)* @main, variables: !45)
73!11 = !MDSubroutineType(types: !12)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000074!12 = !{!5, !5, !13}
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000075!13 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, file: !46, scope: !1, baseType: !14)
76!14 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, file: !46, scope: !1, baseType: !15)
77!15 = !MDBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
78!16 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "ptr", line: 11, arg: 0, scope: !0, file: !1, type: !6)
79!17 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "val", line: 11, arg: 0, scope: !0, file: !1, type: !7)
80!18 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "c", line: 11, arg: 0, scope: !0, file: !1, type: !8)
81!19 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "ptr", line: 4, arg: 0, scope: !9, file: !1, type: !6)
82!20 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "val", line: 4, arg: 0, scope: !9, file: !1, type: !7)
83!21 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "c", line: 4, arg: 0, scope: !9, file: !1, type: !8)
84!22 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "argc", line: 17, arg: 0, scope: !10, file: !1, type: !5)
85!23 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "argv", line: 17, arg: 0, scope: !10, file: !1, type: !13)
86!24 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "dval", line: 19, scope: !25, file: !1, type: !7)
87!25 = distinct !MDLexicalBlock(line: 18, column: 0, file: !46, scope: !10)
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +000088!26 = !MDLocation(line: 4, scope: !9)
89!27 = !MDLocation(line: 6, scope: !28)
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000090!28 = distinct !MDLexicalBlock(line: 5, column: 0, file: !46, scope: !9)
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +000091!29 = !MDLocation(line: 7, scope: !28)
92!30 = !MDLocation(line: 11, scope: !0)
93!31 = !MDLocation(line: 13, scope: !32)
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000094!32 = distinct !MDLexicalBlock(line: 12, column: 0, file: !46, scope: !0)
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +000095!33 = !MDLocation(line: 14, scope: !32)
96!34 = !MDLocation(line: 17, scope: !10)
97!35 = !MDLocation(line: 19, scope: !25)
98!36 = !MDLocation(line: 20, scope: !25)
99!37 = !MDLocation(line: 21, scope: !25)
100!38 = !MDLocation(line: 4, scope: !9, inlinedAt: !37)
101!39 = !MDLocation(line: 6, scope: !28, inlinedAt: !37)
102!40 = !MDLocation(line: 22, scope: !25)
103!41 = !MDLocation(line: 23, scope: !25)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000104!42 = !{!0, !9, !10}
105!43 = !{!16, !17, !18}
106!44 = !{!19, !20, !21}
107!45 = !{!22, !23, !24}
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +0000108!46 = !MDFile(filename: "a.c", directory: "/tmp/")
Duncan P. N. Exon Smith988a7f82015-03-27 20:46:33 +0000109!47 = !{}
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +0000110!48 = !{i32 1, !"Debug Info Version", i32 3}