brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.1 KiB · b6eddff Raw
128 lines · plain
1## Test mips32:2# RUN: llc -emit-call-site-info -start-after=machineverifier -filetype=obj -mtriple=mips-linux-gnu %s -o -| llvm-dwarfdump -| FileCheck %s3## Test mipsel:4# RUN: llc -emit-call-site-info -start-after=machineverifier -filetype=obj -mtriple=mipsel-linux-gnu %s -o -| llvm-dwarfdump -| FileCheck %s5 6## Built from source:7## extern int __attribute__((noinline)) sum(int a, int b);8## void __attribute__((noinline)) set(int *adr, int val) {9##   val++;10##   *adr = val + sum(val, val);11## }12## Using command:13## clang -g -O2 -target mips-linux-gnu m.c -c -mllvm -stop-before=machineverifier14## Check that call site interpretation analysis can interpret calls with delay slot and15## parameters set outside and inside of the call delay slot.16 17## Test mips32:18# CHECK:        DW_TAG_GNU_call_site19# CHECK-NEXT:     DW_AT_abstract_origin {{.*}} "sum"20# CHECK-NEXT:     DW_AT_low_pc21# CHECK-EMPTY:22## Parameter forwarding register A1_64 is set in call delay slot.23# CHECK-NEXT:     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_breg17 S1_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_breg17 S1_64+0)30 31--- |32  ; ModuleID = 'm.ll'33  source_filename = "m.c"34  target datalayout = "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"35  target triple = "mips-unknown-linux-gnu"36  ; Function Attrs: noinline nounwind37  define dso_local void @set(ptr nocapture %adr, i32 signext %val) local_unnamed_addr !dbg !12 {38  entry:39    call void @llvm.dbg.value(metadata ptr %adr, metadata !17, metadata !DIExpression()), !dbg !1940    call void @llvm.dbg.value(metadata i32 %val, metadata !18, metadata !DIExpression()), !dbg !1941    %inc = add nsw i32 %val, 1, !dbg !1942    call void @llvm.dbg.value(metadata i32 %inc, metadata !18, metadata !DIExpression()), !dbg !1943    %call = tail call i32 @sum(i32 signext %inc, i32 signext %inc), !dbg !1944    %add = add nsw i32 %call, %inc, !dbg !1945    store i32 %add, ptr %adr, align 4, !dbg !1946    ret void47  }48  declare !dbg !4 dso_local i32 @sum(i32 signext, i32 signext) local_unnamed_addr49  ; Function Attrs: nounwind readnone speculatable willreturn50  declare void @llvm.dbg.value(metadata, metadata, metadata)51  52  !llvm.dbg.cu = !{!0}53  !llvm.module.flags = !{!8, !9, !10}54  !llvm.ident = !{!11}55  56  !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)57  !1 = !DIFile(filename: "m.c", directory: "/dir")58  !2 = !{}59  !3 = !{!4}60  !4 = !DISubprogram(name: "sum", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)61  !5 = !DISubroutineType(types: !6)62  !6 = !{!7, !7, !7}63  !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)64  !8 = !{i32 7, !"Dwarf Version", i32 4}65  !9 = !{i32 2, !"Debug Info Version", i32 3}66  !10 = !{i32 1, !"wchar_size", i32 4}67  !11 = !{!"clang version 11.0.0"}68  !12 = distinct !DISubprogram(name: "set", scope: !1, file: !1, line: 2, type: !13, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !16)69  !13 = !DISubroutineType(types: !14)70  !14 = !{null, !15, !7}71  !15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 32)72  !16 = !{!17, !18}73  !17 = !DILocalVariable(name: "adr", arg: 1, scope: !12, file: !1, line: 2, type: !15)74  !18 = !DILocalVariable(name: "val", arg: 2, scope: !12, file: !1, line: 2, type: !7)75  !19 = !DILocation(line: 0, scope: !12)76 77...78---79name:            set80alignment:       481stack:82  - { id: 0, name: '', type: spill-slot, offset: -4, size: 4, alignment: 4, 83      stack-id: default, callee-saved-register: '$ra', callee-saved-restored: true, 84      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }85  - { id: 1, name: '', type: spill-slot, offset: -8, size: 4, alignment: 4, 86      stack-id: default, callee-saved-register: '$s1', callee-saved-restored: true, 87      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }88  - { id: 2, name: '', type: spill-slot, offset: -12, size: 4, alignment: 4, 89      stack-id: default, callee-saved-register: '$s0', callee-saved-restored: true, 90      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }91callSites:92  - { bb: 0, offset: 16, fwdArgRegs: 93      - { arg: 0, reg: '$a0' }94      - { arg: 1, reg: '$a1' } }95body:             |96  bb.0.entry:97    DBG_VALUE $a0, $noreg, !17, !DIExpression(), debug-location !1998    DBG_VALUE $a1, $noreg, !18, !DIExpression(), debug-location !1999    DBG_VALUE $a1, $noreg, !18, !DIExpression(), debug-location !19100    $sp = ADDiu $sp, -32101    CFI_INSTRUCTION def_cfa_offset 32102    SW killed $ra, $sp, 28 :: (store (s32) into %stack.0)103    SW killed $s1, $sp, 24 :: (store (s32) into %stack.1)104    SW killed $s0, $sp, 20 :: (store (s32) into %stack.2)105    CFI_INSTRUCTION offset $ra_64, -4106    CFI_INSTRUCTION offset $s1_64, -8107    CFI_INSTRUCTION offset $s0_64, -12108    $s0 = OR $a0, $zero109    DBG_VALUE $s0, $noreg, !17, !DIExpression(), debug-location !19110    renamable $s1 = nsw ADDiu killed renamable $a1, 1, debug-location !19111    DBG_VALUE $s1, $noreg, !18, !DIExpression(), debug-location !19112    $a0 = OR $s1, $zero, debug-location !19113    JAL @sum, csr_o32, implicit-def dead $ra, implicit $a0, implicit $a1, implicit-def $sp, implicit-def $v0, debug-location !19 {114      $a1 = OR $s1, $zero, debug-location !19115    }116    renamable $at = nsw ADDu killed renamable $v0, killed renamable $s1, debug-location !19117    SW killed renamable $at, killed renamable $s0, 0, debug-location !19 :: (store (s32) into %ir.adr)118    $s0 = LW $sp, 20119    DBG_VALUE $a0, $noreg, !17, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !19120    $s1 = LW $sp, 24121    $ra = LW $sp, 28122    PseudoReturn undef $ra {123      $sp = ADDiu $sp, 32124    }125 126...127 128