brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.3 KiB · 66fa095 Raw
136 lines · plain
1## Test mips64:2# RUN: llc -mtriple mips64-linux-gnu -emit-call-site-info -start-after=machineverifier -filetype=obj %s -o -| llvm-dwarfdump -| FileCheck %s3## Test mips64el:4# RUN: llc -mtriple mips64el-linux-gnu -emit-call-site-info -start-after=machineverifier -filetype=obj %s -o -| llvm-dwarfdump -| FileCheck %s5 6## Following code is used for producing this test case.7##8## extern int fn1(long,long,long);9## extern void clobber();10## int fn2(long a) {11##   clobber();12##   int local = fn1(44, a, a+10);13##   if (local > 10)14##     return local + 10;15##   return local;16## }17## Check that parameters value loaded by instruction ADDiu/DADDiu is18## interpreted correctly.19 20## Test mips64:21# CHECK: DW_TAG_GNU_call_site22# CHECK-NEXT: DW_AT_abstract_origin {{.*}} "fn1"23# CHECK: DW_TAG_GNU_call_site_parameter24# CHECK-NEXT:   DW_AT_location      (DW_OP_reg5 A1_64)25# CHECK-NEXT:   DW_AT_GNU_call_site_value   (DW_OP_breg16 S0_64+0)26# CHECK-EMPTY: 27# CHECK-NEXT: DW_TAG_GNU_call_site_parameter28# CHECK-NEXT:   DW_AT_location      (DW_OP_reg4 A0_64)29# CHECK-NEXT:   DW_AT_GNU_call_site_value   (DW_OP_constu 0x2c)30# CHECK-EMPTY: 31# CHECK-NEXT: DW_TAG_GNU_call_site_parameter32# CHECK-NEXT:   DW_AT_location      (DW_OP_reg6 A2_64)33# CHECK-NEXT:   DW_AT_GNU_call_site_value   (DW_OP_breg16 S0_64+10)34--- |35  ; ModuleID = 'mips64.ll'36  source_filename = "m64.c"37  target datalayout = "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128"38  target triple = "mips64-unknown-linux-gnu"39  40  ; Function Attrs: nounwind41  define signext i32 @fn2(i64 signext %a) local_unnamed_addr !dbg !14 {42  entry:43    call void @llvm.dbg.value(metadata i64 %a, metadata !18, metadata !DIExpression()), !dbg !2044    tail call void @clobber(), !dbg !2045    %add = add nsw i64 %a, 10, !dbg !2046    %call = tail call signext i32 @fn1(i64 signext 44, i64 signext %a, i64 signext %add), !dbg !2047    call void @llvm.dbg.value(metadata i32 %call, metadata !19, metadata !DIExpression()), !dbg !2048    %cmp = icmp sgt i32 %call, 10, !dbg !2449    %add1 = add nsw i32 %call, 10, !dbg !2050    %retval.0 = select i1 %cmp, i32 %add1, i32 %call, !dbg !2051    ret i32 %retval.0, !dbg !2052  }53  54  declare void @clobber(...) local_unnamed_addr55  56  declare !dbg !4 signext i32 @fn1(i64 signext, i64 signext, i64 signext) local_unnamed_addr57  58  ; Function Attrs: nounwind readnone speculatable willreturn59  declare void @llvm.dbg.value(metadata, metadata, metadata)60  61  !llvm.dbg.cu = !{!0}62  !llvm.module.flags = !{!9, !10, !11, !12}63  !llvm.ident = !{!13}64  65  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, splitDebugInlining: false, nameTableKind: None)66  !1 = !DIFile(filename: "m.c", directory: "/dir")67  !2 = !{}68  !3 = !{!4}69  !4 = !DISubprogram(name: "fn1", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)70  !5 = !DISubroutineType(types: !6)71  !6 = !{!7, !8, !8, !8}72  !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)73  !8 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed)74  !9 = !{i32 7, !"Dwarf Version", i32 4}75  !10 = !{i32 2, !"Debug Info Version", i32 3}76  !11 = !{i32 1, !"wchar_size", i32 4}77  !12 = !{i32 7, !"PIC Level", i32 1}78  !13 = !{!"clang version 11.0.0"}79  !14 = distinct !DISubprogram(name: "fn2", scope: !1, file: !1, line: 3, type: !15, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !17)80  !15 = !DISubroutineType(types: !16)81  !16 = !{!7, !8}82  !17 = !{!18, !19}83  !18 = !DILocalVariable(name: "a", arg: 1, scope: !14, file: !1, line: 3, type: !8)84  !19 = !DILocalVariable(name: "local", scope: !14, file: !1, line: 5, type: !7)85  !20 = !DILocation(line: 0, scope: !14)86  !24 = !DILocation(line: 6, column: 14, scope: !25)87  !25 = distinct !DILexicalBlock(scope: !14, file: !1, line: 6, column: 8)88 89...90---91name:            fn292alignment:       893liveins:94  - { reg: '$a0_64', virtual-reg: '' }95stack:96  - { id: 0, name: '', type: spill-slot, offset: -8, size: 8, alignment: 8, 97      stack-id: default, callee-saved-register: '$ra_64', callee-saved-restored: true, 98      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }99  - { id: 1, name: '', type: spill-slot, offset: -16, size: 8, alignment: 8, 100      stack-id: default, callee-saved-register: '$s0_64', callee-saved-restored: true, 101      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }102callSites:103  - { bb: 0, offset: 8, fwdArgRegs: [] }104  - { bb: 0, offset: 12, fwdArgRegs: 105      - { arg: 0, reg: '$a0_64' }106      - { arg: 1, reg: '$a1_64' }107      - { arg: 2, reg: '$a2_64' } }108body:             |109  bb.0.entry:110    DBG_VALUE $a0_64, $noreg, !18, !DIExpression(), debug-location !20111    $sp_64 = DADDiu $sp_64, -16112    CFI_INSTRUCTION def_cfa_offset 16113    SD killed $ra_64, $sp_64, 8 :: (store (s64) into %stack.0)114    SD killed $s0_64, $sp_64, 0 :: (store (s64) into %stack.1)115    CFI_INSTRUCTION offset $ra_64, -8116    CFI_INSTRUCTION offset $s0_64, -16117    DBG_VALUE $s0_64, $noreg, !18, !DIExpression(), debug-location !20118    JAL @clobber, csr_n64, implicit-def dead $ra, implicit-def $sp, debug-location !20 {119      $s0_64 = OR64 $a0_64, $zero_64120    }121    renamable $a2_64 = nsw DADDiu renamable $s0_64, 10, debug-location !20122    $a0_64 = DADDiu $zero_64, 44, debug-location !20123    JAL @fn1, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit killed $a1_64, implicit $a2_64, implicit-def $sp, implicit-def $v0, debug-location !20 {124      $a1_64 = OR64 killed $s0_64, $zero_64, debug-location !20125    }126    DBG_VALUE $v0, $noreg, !19, !DIExpression(), debug-location !20127    renamable $at = SLTi renamable $v0, 11, debug-location !20128    renamable $v1 = nsw ADDiu renamable $v0, 10, debug-location !20129    renamable $v0 = MOVZ_I_I killed renamable $v1, killed renamable $at, killed renamable $v0, debug-location !20130    renamable $v0_64 = SLL64_32 killed renamable $v0, debug-location !20131    $s0_64 = LD $sp_64, 0, debug-location !20 :: (load (s64) from %stack.1)132    $ra_64 = LD $sp_64, 8, debug-location !20 :: (load (s64) from %stack.0)133    PseudoReturn64 undef $ra_64, implicit $v0_64, debug-location !20 {134      $sp_64 = DADDiu $sp_64, 16135    }136