brintos

brintos / llvm-project-archived public Read only

0
0
Text · 10.0 KiB · 054c349 Raw
253 lines · plain
1# RUN: llc -start-after=prologepilog -filetype=obj -O0 %s -o - -experimental-debug-variable-locations=true | llvm-readobj --codeview - | FileCheck %s2 3# Offsets are now CFA, or VFRAME, relative. Both the NRVO sret pointer and the4# string* parameter are on the stack, NRVO at offset 4 (after RA), and Str at5# offset 8 (next slot). The stack size is 4, so the DW_OP_plus_uconst math6# works out.7 8# (DW_OP_plus_uconst 12)9# CHECK: LocalSym {10# CHECK-NEXT:   Kind: S_LOCAL (0x113E)11# CHECK-NEXT:   Type: string* (0x12# CHECK-NEXT:   Flags [ (0x0)13# CHECK-NEXT:   ]14# CHECK-NEXT:   VarName: Str15# CHECK-NEXT: }16# CHECK-NEXT: DefRangeFramePointerRelSym {17# CHECK-NEXT:   Kind: S_DEFRANGE_FRAMEPOINTER_REL (0x1142)18# CHECK-NEXT:   Offset: 1219# CHECK-NEXT:   LocalVariableAddrRange {20# CHECK-NEXT:     OffsetStart:21# CHECK-NEXT:     ISectStart:22# CHECK-NEXT:     Range:23# CHECK-NEXT:   }24# CHECK-NEXT: }25# (DW_OP_plus_uconst, 8, DW_OP_deref)26# CHECK: LocalSym {27# CHECK-NEXT:   Kind: S_LOCAL (0x113E)28# CHECK-NEXT:   Type: string& (0x29# CHECK-NEXT:   Flags [ (0x0)30# CHECK-NEXT:   ]31# CHECK-NEXT:   VarName: Result32# CHECK-NEXT: }33# CHECK-NEXT: DefRangeFramePointerRelSym {34# CHECK-NEXT:   Kind: S_DEFRANGE_FRAMEPOINTER_REL (0x1142)35# CHECK-NEXT:   Offset: 836# CHECK-NEXT:   LocalVariableAddrRange {37# CHECK-NEXT:     OffsetStart: .text+0x538# CHECK-NEXT:     ISectStart: 0x039# CHECK-NEXT:     Range: 0x1840# CHECK-NEXT:   }41# CHECK-NEXT: }42# (DW_OP_constu, 4, DW_OP_minus)43# CHECK: LocalSym {44# CHECK-NEXT:   Kind: S_LOCAL (0x113E)45# CHECK-NEXT:   Type: long (0x12)46# CHECK-NEXT:   Flags [ (0x0)47# CHECK-NEXT:   ]48# CHECK-NEXT:   VarName: Bytes49# CHECK-NEXT: }50# CHECK-NEXT: DefRangeRegisterRelSym {51# CHECK-NEXT:   Kind: S_DEFRANGE_REGISTER_REL (0x1145)52# CHECK-NEXT:   BaseRegister:53# CHECK-NEXT:   HasSpilledUDTMember: No54# CHECK-NEXT:   OffsetInParent: 055# CHECK-NEXT:   BasePointerOffset: -456# CHECK-NEXT:   LocalVariableAddrRange {57# CHECK-NEXT:     OffsetStart:58# CHECK-NEXT:     ISectStart:59# CHECK-NEXT:     Range:60# CHECK-NEXT:   }61# CHECK-NEXT: }62--- |63  ; ModuleID = '<stdin>'64  source_filename = "<stdin>"65  target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"66  target triple = "i386-pc-windows-msvc19.0.24215"67 68  %struct.string = type { i32, i32, ptr }69 70  define void @fun(ptr noalias sret(%struct.string) %agg.result, ptr noalias %str) !dbg !12 {71  entry:72    call void @llvm.dbg.value(metadata ptr %agg.result, metadata !23, metadata !24), !dbg !2573    call void @llvm.dbg.value(metadata ptr %str, metadata !26, metadata !28), !dbg !2574    %call = call dereferenceable(12) ptr @getString(), !dbg !2975    %0 = bitcast ptr %agg.result to ptr, !dbg !2976    %1 = bitcast ptr %call to ptr, !dbg !2977    call void @llvm.memcpy.p0.p0.i32(ptr %0, ptr %1, i32 12, i32 4, i1 false), !dbg !2978    ret void, !dbg !3079  }80 81  define i32 @len(ptr %s, i32 %acc) !dbg !31 {82  entry:83    %0 = bitcast ptr %s to ptr84    %bytes = load i32, ptr %0, !dbg !3485    call void @llvm.dbg.value(metadata i32 %bytes, metadata !35, metadata !28), !dbg !3486    %1 = add i32 %bytes, %acc, !dbg !3687    ret i32 %1, !dbg !3688  }89 90  ; Function Attrs: nounwind readnone speculatable91  declare void @llvm.dbg.declare(metadata, metadata, metadata) #092 93  ; Function Attrs: nounwind readnone speculatable94  declare void @llvm.dbg.value(metadata, metadata, metadata) #095 96  declare dereferenceable(12) ptr @getString()97 98  ; Function Attrs: argmemonly nounwind99  declare void @llvm.memcpy.p0.p0.i32(ptr nocapture writeonly, ptr nocapture readonly, i32, i32, i1) #1100 101  ; Function Attrs: nounwind102  declare void @llvm.stackprotector(ptr, ptr) #2103 104  attributes #0 = { nounwind readnone speculatable }105  attributes #1 = { argmemonly nounwind }106  attributes #2 = { nounwind }107 108  !llvm.dbg.cu = !{!0}109  !llvm.linker.options = !{!3, !4}110  !llvm.module.flags = !{!5, !6, !7, !8}111  !llvm.ident = !{!9}112 113  !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 6.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)114  !1 = !DIFile(filename: "diexpr.ll", directory: "C:\5Csrc", checksumkind: CSK_MD5, checksum: "c547c362c610fa79e7abaddc76e1efe7")115  !2 = !{}116  !3 = !{!"/DEFAULTLIB:libcmt.lib"}117  !4 = !{!"/DEFAULTLIB:oldnames.lib"}118  !5 = !{i32 1, !"NumRegisterParameters", i32 0}119  !6 = !{i32 2, !"CodeView", i32 1}120  !7 = !{i32 2, !"Debug Info Version", i32 3}121  !8 = !{i32 1, !"wchar_size", i32 2}122  !9 = !{!"clang version 6.0.0 "}123  !10 = !DIExpression(DW_OP_plus_uconst, 12)124  !11 = !DIExpression(DW_OP_plus_uconst, 8, DW_OP_deref)125  !12 = distinct !DISubprogram(name: "fun", linkageName: "fun", scope: !1, file: !1, line: 9, type: !13, isLocal: false, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)126  !13 = !DISubroutineType(types: !14)127  !14 = !{!15}128  !15 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "string", file: !1, line: 1, size: 96, elements: !16, identifier: ".?AUstring@@")129  !16 = !{!17, !19, !20}130  !17 = !DIDerivedType(tag: DW_TAG_member, name: "length", scope: !15, file: !1, line: 2, baseType: !18, size: 32)131  !18 = !DIBasicType(name: "long", size: 32, encoding: DW_ATE_signed)132  !19 = !DIDerivedType(tag: DW_TAG_member, name: "size", scope: !15, file: !1, line: 3, baseType: !18, size: 32, offset: 32)133  !20 = !DIDerivedType(tag: DW_TAG_member, name: "data", scope: !15, file: !1, line: 4, baseType: !21, size: 32, offset: 64)134  !21 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !22, size: 32)135  !22 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)136  !23 = !DILocalVariable(name: "Result", scope: !12, file: !1, line: 10, type: !15)137  !24 = !DIExpression(DW_OP_deref)138  !25 = !DILocation(line: 10, scope: !12)139  !26 = !DILocalVariable(name: "Str", scope: !12, file: !1, line: 10, type: !27)140  !27 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !15, size: 32)141  !28 = !DIExpression(DW_OP_constu, 4, DW_OP_minus)142  !29 = !DILocation(line: 11, scope: !12)143  !30 = !DILocation(line: 12, scope: !12)144  !31 = distinct !DISubprogram(name: "len", linkageName: "len", scope: !1, file: !1, line: 14, type: !32, isLocal: false, isDefinition: true, scopeLine: 14, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)145  !32 = !DISubroutineType(types: !33)146  !33 = !{!18}147  !34 = !DILocation(line: 15, scope: !31)148  !35 = !DILocalVariable(name: "Bytes", scope: !31, file: !1, line: 15, type: !18)149  !36 = !DILocation(line: 16, scope: !31)150 151...152---153name:            fun154alignment:       16155exposesReturnsTwice: false156legalized:       false157regBankSelected: false158selected:        false159tracksRegLiveness: true160registers:161liveins:162frameInfo:163  isFrameAddressTaken: false164  isReturnAddressTaken: false165  hasStackMap:     false166  hasPatchPoint:   false167  stackSize:       4168  offsetAdjustment: 0169  maxAlignment:    4170  adjustsStack:    true171  hasCalls:        true172  stackProtector:  ''173  maxCallFrameSize: 0174  hasOpaqueSPAdjustment: false175  hasVAStart:      false176  hasMustTailInVarArgFunc: false177  savePoint:       []178  restorePoint:    []179fixedStack:180  - { id: 0, type: spill-slot, offset: -8, size: 4, alignment: 4, stack-id: default,181      callee-saved-register: '$esi' }182  - { id: 1, type: default, offset: 4, size: 4, alignment: 4, stack-id: default,183      isImmutable: true, isAliased: false, callee-saved-register: '' }184  - { id: 2, type: default, offset: 0, size: 4, alignment: 4, stack-id: default,185      isImmutable: true, isAliased: false, callee-saved-register: '' }186stack:187constants:188body:             |189  bb.0.entry:190    liveins: $esi191 192    frame-setup PUSH32r killed $esi, implicit-def $esp, implicit $esp193    CFI_INSTRUCTION def_cfa_offset 8194    CFI_INSTRUCTION offset $esi, -8195    $esi = MOV32rm $esp, 1, _, 8, _ :: (load (s32) from %fixed-stack.2)196    DBG_VALUE $esp, 0, !26, !10, debug-location !25197    DBG_VALUE $esp, 0, !23, !DIExpression(DW_OP_plus_uconst, 8, DW_OP_deref), debug-location !25198    CALLpcrel32 @getString, csr_32, implicit $esp, implicit-def $esp, implicit-def $eax, debug-location !29199    $ecx = MOV32rm $eax, 1, _, 0, _, debug-location !29 :: (dereferenceable load (s32) from %ir.1)200    $edx = MOV32rm $eax, 1, _, 4, _, debug-location !29 :: (dereferenceable load (s32) from %ir.1 + 4)201    MOV32mr $esi, 1, _, 0, _, killed $ecx, debug-location !29 :: (store (s32) into %ir.0)202    MOV32mr $esi, 1, _, 4, _, killed $edx, debug-location !29 :: (store (s32) into %ir.0 + 4)203    $eax = MOV32rm killed $eax, 1, _, 8, _, debug-location !29 :: (dereferenceable load (s32) from %ir.1 + 8)204    MOV32mr $esi, 1, _, 8, _, killed $eax, debug-location !29 :: (store (s32) into %ir.0 + 8)205    $eax = COPY killed $esi, debug-location !30206    $esi = POP32r implicit-def $esp, implicit $esp, debug-location !30207    RET 0, $eax, debug-location !30208 209...210---211name:            len212alignment:       16213exposesReturnsTwice: false214legalized:       false215regBankSelected: false216selected:        false217tracksRegLiveness: true218registers:219liveins:220frameInfo:221  isFrameAddressTaken: false222  isReturnAddressTaken: false223  hasStackMap:     false224  hasPatchPoint:   false225  stackSize:       0226  offsetAdjustment: 0227  maxAlignment:    4228  adjustsStack:    false229  hasCalls:        false230  stackProtector:  ''231  maxCallFrameSize: 0232  hasOpaqueSPAdjustment: false233  hasVAStart:      false234  hasMustTailInVarArgFunc: false235  savePoint:       []236  restorePoint:    []237fixedStack:238  - { id: 0, type: default, offset: 4, size: 4, alignment: 4, stack-id: default,239      isImmutable: true, isAliased: false, callee-saved-register: '' }240  - { id: 1, type: default, offset: 0, size: 4, alignment: 4, stack-id: default,241      isImmutable: true, isAliased: false, callee-saved-register: '' }242stack:243constants:244body:             |245  bb.0.entry:246    $eax = MOV32rm $esp, 1, _, 4, _ :: (load (s32) from %fixed-stack.1)247    $eax = MOV32rm killed $eax, 1, _, 0, _, debug-location !34 :: (load (s32) from %ir.0)248    DBG_VALUE $eax, 0, !35, !DIExpression(DW_OP_constu, 4, DW_OP_minus), debug-location !34249    $eax = ADD32rm killed $eax, $esp, 1, _, 8, _, implicit-def dead $eflags, debug-location !36 :: (load (s32) from %fixed-stack.0)250    RET 0, $eax, debug-location !36251 252...253