11721c14eSJohn Brawn; RUN: llc -mtriple=x86_64-unknown-linux-gnu %s -o %t -filetype=obj 21721c14eSJohn Brawn; RUN: llvm-dwarfdump --debug-info %t | FileCheck %s 31721c14eSJohn Brawn 41721c14eSJohn Brawn%struct.struct_t = type { i8 } 51721c14eSJohn Brawn 61721c14eSJohn Brawn@g = dso_local global %struct.struct_t zeroinitializer, align 1, !dbg !0 71721c14eSJohn Brawn 81721c14eSJohn Brawn; CHECK-LABEL: DW_TAG_subprogram 91721c14eSJohn Brawn; CHECK: DW_AT_name ("test1") 101721c14eSJohn Brawn; CHECK: DW_TAG_variable 11*1cbddcebSJohn Brawn; CHECK: DW_AT_location (DW_OP_fbreg -1, DW_OP_deref_size 0x1, DW_OP_constu 0x3d, DW_OP_shl, DW_OP_constu 0x3d, DW_OP_shr, DW_OP_stack_value) 121721c14eSJohn Brawn; CHECK: DW_AT_name ("x") 131721c14eSJohn Brawn; CHECK: DW_TAG_variable 14*1cbddcebSJohn Brawn; CHECK: DW_AT_location (DW_OP_fbreg -1, DW_OP_deref_size 0x1, DW_OP_constu 0x39, DW_OP_shl, DW_OP_constu 0x3c, DW_OP_shra, DW_OP_stack_value) 151721c14eSJohn Brawn; CHECK: DW_AT_name ("y") 161721c14eSJohn Brawn 171721c14eSJohn Brawndefine i32 @test1() !dbg !13 { 181721c14eSJohn Brawnentry: 191721c14eSJohn Brawn %0 = alloca %struct.struct_t, align 1 201721c14eSJohn Brawn tail call void @llvm.dbg.declare(metadata ptr %0, metadata !16, metadata !DIExpression(DW_OP_LLVM_extract_bits_zext, 0, 3)), !dbg !17 211721c14eSJohn Brawn tail call void @llvm.dbg.declare(metadata ptr %0, metadata !18, metadata !DIExpression(DW_OP_LLVM_extract_bits_sext, 3, 4)), !dbg !17 221721c14eSJohn Brawn ret i32 0, !dbg !17 231721c14eSJohn Brawn} 241721c14eSJohn Brawn 251721c14eSJohn Brawn; CHECK-LABEL: DW_TAG_subprogram 261721c14eSJohn Brawn; CHECK: DW_AT_name ("test2") 271721c14eSJohn Brawn; CHECK: DW_TAG_variable 281721c14eSJohn Brawn; CHECK: DW_AT_location (DW_OP_breg0 {{R[^+]+}}+0, DW_OP_constu 0xff, DW_OP_and, DW_OP_constu 0x3d, DW_OP_shl, DW_OP_constu 0x3d, DW_OP_shr, DW_OP_stack_value) 291721c14eSJohn Brawn; CHECK: DW_AT_name ("x") 301721c14eSJohn Brawn; CHECK: DW_TAG_variable 311721c14eSJohn Brawn; CHECK: DW_AT_location (DW_OP_breg0 {{R[^+]+}}+0, DW_OP_constu 0xff, DW_OP_and, DW_OP_constu 0x39, DW_OP_shl, DW_OP_constu 0x3c, DW_OP_shra, DW_OP_stack_value) 321721c14eSJohn Brawn; CHECK: DW_AT_name ("y") 331721c14eSJohn Brawn 341721c14eSJohn Brawndefine i8 @test2() !dbg !20 { 351721c14eSJohn Brawnentry: 361721c14eSJohn Brawn %0 = load i8, ptr @g, align 1 371721c14eSJohn Brawn tail call void @llvm.dbg.value(metadata i8 %0, metadata !21, metadata !DIExpression(DW_OP_LLVM_extract_bits_zext, 0, 3)), !dbg !22 381721c14eSJohn Brawn tail call void @llvm.dbg.value(metadata i8 %0, metadata !23, metadata !DIExpression(DW_OP_LLVM_extract_bits_sext, 3, 4)), !dbg !22 391721c14eSJohn Brawn ret i8 %0, !dbg !22 401721c14eSJohn Brawn} 411721c14eSJohn Brawn 421721c14eSJohn Brawn; CHECK-LABEL: DW_TAG_subprogram 431721c14eSJohn Brawn; CHECK: DW_AT_name ("test3") 441721c14eSJohn Brawn; CHECK: DW_TAG_variable 451721c14eSJohn Brawn; CHECK: DW_AT_location (DW_OP_breg0 {{R[^+]+}}+0, DW_OP_constu 0x3f, DW_OP_shr, DW_OP_stack_value) 461721c14eSJohn Brawn; CHECK: DW_AT_name ("x") 471721c14eSJohn Brawn; CHECK: DW_TAG_variable 481721c14eSJohn Brawn; CHECK: DW_AT_location (DW_OP_breg0 {{R[^+]+}}+0, DW_OP_constu 0x3f, DW_OP_shra, DW_OP_stack_value) 491721c14eSJohn Brawn; CHECK: DW_AT_name ("y") 501721c14eSJohn Brawn 511721c14eSJohn Brawndefine i64 @test3(ptr %p) !dbg !24 { 521721c14eSJohn Brawnentry: 531721c14eSJohn Brawn %0 = load i64, ptr %p, align 8 541721c14eSJohn Brawn tail call void @llvm.dbg.value(metadata i64 %0, metadata !25, metadata !DIExpression(DW_OP_LLVM_extract_bits_zext, 63, 1)), !dbg !26 551721c14eSJohn Brawn tail call void @llvm.dbg.value(metadata i64 %0, metadata !27, metadata !DIExpression(DW_OP_LLVM_extract_bits_sext, 63, 1)), !dbg !26 561721c14eSJohn Brawn ret i64 %0, !dbg !26 571721c14eSJohn Brawn} 581721c14eSJohn Brawn 59*1cbddcebSJohn Brawn; CHECK-LABEL: DW_TAG_subprogram 60*1cbddcebSJohn Brawn; CHECK: DW_AT_name ("test4") 61*1cbddcebSJohn Brawn; CHECK: DW_TAG_variable 62*1cbddcebSJohn Brawn; CHECK: DW_AT_location (DW_OP_fbreg -4, DW_OP_deref_size 0x4, DW_OP_constu 0x20, DW_OP_shl, DW_OP_constu 0x3f, DW_OP_shr, DW_OP_stack_value) 63*1cbddcebSJohn Brawn; CHECK: DW_AT_name ("x") 64*1cbddcebSJohn Brawn; CHECK: DW_TAG_variable 65*1cbddcebSJohn Brawn; CHECK: DW_AT_location (DW_OP_fbreg -4, DW_OP_deref_size 0x4, DW_OP_constu 0x20, DW_OP_shl, DW_OP_constu 0x21, DW_OP_shra, DW_OP_stack_value) 66*1cbddcebSJohn Brawn; CHECK: DW_AT_name ("y") 67*1cbddcebSJohn Brawn; CHECK: DW_TAG_variable 68*1cbddcebSJohn Brawn; CHECK: DW_AT_location (DW_OP_fbreg -4, DW_OP_plus_uconst 0x3, DW_OP_deref_size 0x1, DW_OP_constu 0x38, DW_OP_shl, DW_OP_constu 0x39, DW_OP_shr, DW_OP_stack_value) 69*1cbddcebSJohn Brawn; CHECK: DW_AT_name ("z") 70*1cbddcebSJohn Brawn 71*1cbddcebSJohn Brawndefine i32 @test4() !dbg !28 { 72*1cbddcebSJohn Brawnentry: 73*1cbddcebSJohn Brawn %0 = alloca i32, align 4 74*1cbddcebSJohn Brawn tail call void @llvm.dbg.declare(metadata ptr %0, metadata !29, metadata !DIExpression(DW_OP_LLVM_extract_bits_zext, 31, 1)), !dbg !30 75*1cbddcebSJohn Brawn tail call void @llvm.dbg.declare(metadata ptr %0, metadata !31, metadata !DIExpression(DW_OP_LLVM_extract_bits_sext, 1, 31)), !dbg !30 76*1cbddcebSJohn Brawn tail call void @llvm.dbg.declare(metadata ptr %0, metadata !32, metadata !DIExpression(DW_OP_plus_uconst, 3, DW_OP_LLVM_extract_bits_zext, 1, 7)), !dbg !30 77*1cbddcebSJohn Brawn ret i32 0, !dbg !30 78*1cbddcebSJohn Brawn} 79*1cbddcebSJohn Brawn 801721c14eSJohn Brawndeclare void @llvm.dbg.declare(metadata, metadata, metadata) 811721c14eSJohn Brawndeclare void @llvm.dbg.value(metadata, metadata, metadata) 821721c14eSJohn Brawn 831721c14eSJohn Brawn!llvm.dbg.cu = !{!2} 841721c14eSJohn Brawn!llvm.module.flags = !{!11, !12} 851721c14eSJohn Brawn 861721c14eSJohn Brawn!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 871721c14eSJohn Brawn!1 = distinct !DIGlobalVariable(name: "g", scope: !2, file: !3, type: !5, isLocal: false, isDefinition: true) 881721c14eSJohn Brawn!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None) 891721c14eSJohn Brawn!3 = !DIFile(filename: "DW_OP_bit_piece.cpp", directory: "./") 901721c14eSJohn Brawn!4 = !{!0} 911721c14eSJohn Brawn!5 = !DIDerivedType(tag: DW_TAG_typedef, name: "struct_t", file: !3, baseType: !6) 921721c14eSJohn Brawn!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !3, size: 8, flags: DIFlagTypePassByValue, elements: !7, identifier: "_ZTS8struct_t") 931721c14eSJohn Brawn!7 = !{!8, !10} 941721c14eSJohn Brawn!8 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !6, file: !3, baseType: !9, size: 3, flags: DIFlagBitField, extraData: i64 0) 951721c14eSJohn Brawn!9 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned) 961721c14eSJohn Brawn!10 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !6, file: !3, baseType: !9, size: 4, offset: 3, flags: DIFlagBitField, extraData: i64 0) 971721c14eSJohn Brawn!11 = !{i32 7, !"Dwarf Version", i32 5} 981721c14eSJohn Brawn!12 = !{i32 2, !"Debug Info Version", i32 3} 991721c14eSJohn Brawn!13 = distinct !DISubprogram(name: "test1", linkageName: "test1", scope: !3, file: !3, type: !14, spFlags: DISPFlagDefinition, unit: !2) 1001721c14eSJohn Brawn!14 = !DISubroutineType(types: !15) 1011721c14eSJohn Brawn!15 = !{!9} 1021721c14eSJohn Brawn!16 = !DILocalVariable(name: "x", scope: !13, file: !3, type: !9) 1031721c14eSJohn Brawn!17 = !DILocation(line: 0, scope: !13) 1041721c14eSJohn Brawn!18 = !DILocalVariable(name: "y", scope: !13, file: !3, type: !19) 1051721c14eSJohn Brawn!19 = !DIBasicType(name: "signed int", size: 32, encoding: DW_ATE_signed) 1061721c14eSJohn Brawn!20 = distinct !DISubprogram(name: "test2", linkageName: "test2", scope: !3, file: !3, type: !14, spFlags: DISPFlagDefinition, unit: !2) 1071721c14eSJohn Brawn!21 = !DILocalVariable(name: "x", scope: !20, file: !3, type: !9) 1081721c14eSJohn Brawn!22 = !DILocation(line: 0, scope: !20) 1091721c14eSJohn Brawn!23 = !DILocalVariable(name: "y", scope: !20, file: !3, type: !19) 1101721c14eSJohn Brawn!24 = distinct !DISubprogram(name: "test3", linkageName: "test3", scope: !3, file: !3, type: !14, spFlags: DISPFlagDefinition, unit: !2) 1111721c14eSJohn Brawn!25 = !DILocalVariable(name: "x", scope: !24, file: !3, type: !9) 1121721c14eSJohn Brawn!26 = !DILocation(line: 0, scope: !24) 1131721c14eSJohn Brawn!27 = !DILocalVariable(name: "y", scope: !24, file: !3, type: !19) 114*1cbddcebSJohn Brawn!28 = distinct !DISubprogram(name: "test4", linkageName: "test4", scope: !3, file: !3, type: !14, spFlags: DISPFlagDefinition, unit: !2) 115*1cbddcebSJohn Brawn!29 = !DILocalVariable(name: "x", scope: !28, file: !3, type: !9) 116*1cbddcebSJohn Brawn!30 = !DILocation(line: 0, scope: !28) 117*1cbddcebSJohn Brawn!31 = !DILocalVariable(name: "y", scope: !28, file: !3, type: !19) 118*1cbddcebSJohn Brawn!32 = !DILocalVariable(name: "z", scope: !28, file: !3, type: !9) 119