brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.7 KiB · 8092709 Raw
112 lines · plain
1; RUN: llc -filetype=obj %s -o - | llvm-dwarfdump -  | FileCheck %s2 3; Test that byval args get correct DWARF debug locations.4; These end up in the callee as Wasm locals, which is atypical.5 6; From C code:7 8; typedef union {	int x; float y; } u;9; typedef struct { int x;	float y; } s;10; int some_func(int x, u some_union, s some_struct, int a[3]) {11;     return x + some_union.x + some_struct.x + a[0];12; }13 14 15; ModuleID = 't.c'16source_filename = "t.c"17target triple = "wasm32-unknown-unknown"18 19%union.u = type { i32 }20%struct.s = type { i32, float }21 22; Function Attrs: noinline nounwind optnone23define hidden i32 @some_func(i32 %x, ptr byval(%union.u) align 4 %some_union, ptr byval(%struct.s) align 4 %some_struct, ptr %a) #0 !dbg !7 {24entry:25  %x.addr = alloca i32, align 426  %a.addr = alloca ptr, align 427  store i32 %x, ptr %x.addr, align 428  call void @llvm.dbg.declare(metadata ptr %x.addr, metadata !23, metadata !DIExpression()), !dbg !2429  call void @llvm.dbg.declare(metadata ptr %some_union, metadata !25, metadata !DIExpression()), !dbg !2630  call void @llvm.dbg.declare(metadata ptr %some_struct, metadata !27, metadata !DIExpression()), !dbg !2831  store ptr %a, ptr %a.addr, align 432  call void @llvm.dbg.declare(metadata ptr %a.addr, metadata !29, metadata !DIExpression()), !dbg !3033  %0 = load i32, ptr %x.addr, align 4, !dbg !3134  %1 = load i32, ptr %some_union, align 4, !dbg !3235  %add = add nsw i32 %0, %1, !dbg !3336  %2 = load i32, ptr %some_struct, align 4, !dbg !3437  %add3 = add nsw i32 %add, %2, !dbg !3538  %3 = load ptr, ptr %a.addr, align 4, !dbg !3639  %4 = load i32, ptr %3, align 4, !dbg !3640  %add4 = add nsw i32 %add3, %4, !dbg !3741  ret i32 %add4, !dbg !3842}43 44; Function Attrs: nofree nosync nounwind readnone speculatable willreturn45declare void @llvm.dbg.declare(metadata, metadata, metadata) #146 47attributes #0 = { noinline nounwind optnone "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }48attributes #1 = { nofree nosync nounwind readnone speculatable willreturn }49 50!llvm.dbg.cu = !{!0}51!llvm.module.flags = !{!3, !4, !5}52!llvm.ident = !{!6}53 54!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 12.0.0 (https://github.com/llvm/llvm-project.git eccc734a69c0c012ae3160887b65a535b35ead3e)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)55!1 = !DIFile(filename: "t.c", directory: "C:\\src\\llvm")56!2 = !{}57!3 = !{i32 7, !"Dwarf Version", i32 4}58!4 = !{i32 2, !"Debug Info Version", i32 3}59!5 = !{i32 1, !"wchar_size", i32 4}60!6 = !{!"clang version 12.0.0 (https://github.com/llvm/llvm-project.git eccc734a69c0c012ae3160887b65a535b35ead3e)"}61!7 = distinct !DISubprogram(name: "some_func", scope: !1, file: !1, line: 11, type: !8, scopeLine: 11, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)62!8 = !DISubroutineType(types: !9)63!9 = !{!10, !10, !11, !17, !22}64!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)65!11 = !DIDerivedType(tag: DW_TAG_typedef, name: "u", file: !1, line: 4, baseType: !12)66!12 = distinct !DICompositeType(tag: DW_TAG_union_type, file: !1, line: 1, size: 32, elements: !13)67!13 = !{!14, !15}68!14 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !12, file: !1, line: 2, baseType: !10, size: 32)69!15 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !12, file: !1, line: 3, baseType: !16, size: 32)70!16 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)71!17 = !DIDerivedType(tag: DW_TAG_typedef, name: "s", file: !1, line: 9, baseType: !18)72!18 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !1, line: 6, size: 64, elements: !19)73!19 = !{!20, !21}74!20 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !18, file: !1, line: 7, baseType: !10, size: 32)75!21 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !18, file: !1, line: 8, baseType: !16, size: 32, offset: 32)76!22 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 32)77!23 = !DILocalVariable(name: "x", arg: 1, scope: !7, file: !1, line: 11, type: !10)78!24 = !DILocation(line: 11, column: 19, scope: !7)79!25 = !DILocalVariable(name: "some_union", arg: 2, scope: !7, file: !1, line: 11, type: !11)80!26 = !DILocation(line: 11, column: 24, scope: !7)81!27 = !DILocalVariable(name: "some_struct", arg: 3, scope: !7, file: !1, line: 11, type: !17)82!28 = !DILocation(line: 11, column: 38, scope: !7)83!29 = !DILocalVariable(name: "a", arg: 4, scope: !7, file: !1, line: 11, type: !22)84!30 = !DILocation(line: 11, column: 55, scope: !7)85!31 = !DILocation(line: 12, column: 12, scope: !7)86!32 = !DILocation(line: 12, column: 27, scope: !7)87!33 = !DILocation(line: 12, column: 14, scope: !7)88!34 = !DILocation(line: 12, column: 43, scope: !7)89!35 = !DILocation(line: 12, column: 29, scope: !7)90!36 = !DILocation(line: 12, column: 47, scope: !7)91!37 = !DILocation(line: 12, column: 45, scope: !7)92!38 = !DILocation(line: 12, column: 5, scope: !7)93 94 95 96 97; CHECK-LABEL:  DW_TAG_formal_parameter98; CHECK-NEXT:     DW_AT_location        (DW_OP_fbreg +12)99; CHECK-NEXT:     DW_AT_name    ("x")100 101; CHECK-LABEL:  DW_TAG_formal_parameter102; CHECK-NEXT:     DW_AT_location        (DW_OP_WASM_location 0x0 0x1)103; CHECK-NEXT:     DW_AT_name    ("some_union")104 105; CHECK-LABEL:  DW_TAG_formal_parameter106; CHECK-NEXT:     DW_AT_location        (DW_OP_WASM_location 0x0 0x2)107; CHECK-NEXT:     DW_AT_name    ("some_struct")108 109; CHECK-LABEL:  DW_TAG_formal_parameter110; CHECK-NEXT:     DW_AT_location        (DW_OP_fbreg +8)111; CHECK-NEXT:     DW_AT_name    ("a")112