You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
6.2 KiB

## Test mips64:
# RUN: llc -emit-call-site-info -start-after=machineverifier -filetype=obj -mtriple=mips64-linux-gnu %s -o -| llvm-dwarfdump -| FileCheck %s
## Test mips64el:
# RUN: llc -emit-call-site-info -start-after=machineverifier -filetype=obj -mtriple=mips64el-linux-gnu %s -o -| llvm-dwarfdump -| FileCheck %s
## Built from source:
## extern int __attribute__((noinline)) sum(int a, int b);
## void __attribute__((noinline)) set(int *adr, int val) {
## val++;
## *adr = val + sum(val, val);
## }
## Using command:
## clang -g -O2 -target mips64-linux-gnu m.c -c -mllvm -stop-before=machineverifier
## Check that call site interpretation analysis can interpret calls with delay slot and
## parameters set outside and inside of the call delay slot.
## Test mips64:
# CHECK: DW_TAG_GNU_call_site
# CHECK-NEXT: DW_AT_abstract_origin {{.*}} "sum"
# CHECK-NEXT: DW_AT_low_pc
# CHECK-EMPTY:
## Parameter forwarding register A1_64 is set in call delay slot.
# CHECK-NEXT: DW_TAG_GNU_call_site_parameter
# CHECK-NEXT: DW_AT_location (DW_OP_reg5 A1_64)
# CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_breg17 S1_64+0)
# CHECK-EMPTY:
# CHECK-NEXT: DW_TAG_GNU_call_site_parameter
# CHECK-NEXT: DW_AT_location (DW_OP_reg4 A0_64)
# CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_breg17 S1_64+0)
--- |
; ModuleID = 'm.ll'
source_filename = "m.c"
target datalayout = "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128"
target triple = "mips64-unknown-linux-gnu"
; Function Attrs: noinline nounwind
define void @set(i32* nocapture %adr, i32 signext %val) local_unnamed_addr !dbg !13 {
entry:
call void @llvm.dbg.value(metadata i32* %adr, metadata !18, metadata !DIExpression()), !dbg !20
call void @llvm.dbg.value(metadata i32 %val, metadata !19, metadata !DIExpression()), !dbg !20
%inc = add nsw i32 %val, 1, !dbg !20
call void @llvm.dbg.value(metadata i32 %inc, metadata !19, metadata !DIExpression()), !dbg !20
%call = tail call signext i32 @sum(i32 signext %inc, i32 signext %inc), !dbg !20
%add = add nsw i32 %call, %inc, !dbg !20
store i32 %add, i32* %adr, align 4, !dbg !20
ret void
}
declare !dbg !4 signext i32 @sum(i32 signext, i32 signext) local_unnamed_addr
; Function Attrs: nounwind readnone speculatable willreturn
declare void @llvm.dbg.value(metadata, metadata, metadata)
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!8, !9, !10, !11}
!llvm.ident = !{!12}
!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)
!1 = !DIFile(filename: "m.c", directory: "/dir")
!2 = !{}
!3 = !{!4}
!4 = !DISubprogram(name: "sum", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
!5 = !DISubroutineType(types: !6)
!6 = !{!7, !7, !7}
!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!8 = !{i32 7, !"Dwarf Version", i32 4}
!9 = !{i32 2, !"Debug Info Version", i32 3}
!10 = !{i32 1, !"wchar_size", i32 4}
!11 = !{i32 7, !"PIC Level", i32 1}
!12 = !{!"clang version 11.0.0"}
!13 = distinct !DISubprogram(name: "set", scope: !1, file: !1, line: 2, type: !14, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !17)
!14 = !DISubroutineType(types: !15)
!15 = !{null, !16, !7}
!16 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64)
!17 = !{!18, !19}
!18 = !DILocalVariable(name: "adr", arg: 1, scope: !13, file: !1, line: 2, type: !16)
!19 = !DILocalVariable(name: "val", arg: 2, scope: !13, file: !1, line: 2, type: !7)
!20 = !DILocation(line: 0, scope: !13)
...
---
name: set
alignment: 8
stack:
- { id: 0, name: '', type: spill-slot, offset: -8, size: 8, alignment: 8,
stack-id: default, callee-saved-register: '$ra_64', callee-saved-restored: true,
debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
- { id: 1, name: '', type: spill-slot, offset: -16, size: 8, alignment: 8,
stack-id: default, callee-saved-register: '$s1_64', callee-saved-restored: true,
debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
- { id: 2, name: '', type: spill-slot, offset: -24, size: 8, alignment: 8,
stack-id: default, callee-saved-register: '$s0_64', callee-saved-restored: true,
debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
callSites:
- { bb: 0, offset: 17, fwdArgRegs:
- { arg: 0, reg: '$a0_64' }
- { arg: 1, reg: '$a1_64' } }
body: |
bb.0.entry:
DBG_VALUE $a0_64, $noreg, !18, !DIExpression(), debug-location !20
DBG_VALUE $a1_64, $noreg, !19, !DIExpression(), debug-location !20
DBG_VALUE $a1_64, $noreg, !19, !DIExpression(), debug-location !20
$sp_64 = DADDiu $sp_64, -32
CFI_INSTRUCTION def_cfa_offset 32
SD killed $ra_64, $sp_64, 24 :: (store 8 into %stack.0)
SD killed $s1_64, $sp_64, 16 :: (store 8 into %stack.1)
SD killed $s0_64, $sp_64, 8 :: (store 8 into %stack.2)
CFI_INSTRUCTION offset $ra_64, -8
CFI_INSTRUCTION offset $s1_64, -16
CFI_INSTRUCTION offset $s0_64, -24
$s0_64 = OR64 $a0_64, $zero_64
DBG_VALUE $a1, $noreg, !19, !DIExpression(), debug-location !20
DBG_VALUE $s0_64, $noreg, !18, !DIExpression(), debug-location !20
renamable $s1 = ADDiu renamable $a1, 1, implicit killed $a1_64, implicit-def $s1_64, debug-location !20
DBG_VALUE $s1, $noreg, !19, !DIExpression(), debug-location !20
$a0_64 = OR64 $s1_64, $zero_64, debug-location !20
JAL @sum, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $a1_64, implicit-def $sp, implicit-def $v0, debug-location !20 {
$a1_64 = OR64 $s1_64, $zero_64, debug-location !20
}
renamable $at = nsw ADDu killed renamable $v0, renamable $s1, implicit killed $s1_64, debug-location !20
SW killed renamable $at, killed renamable $s0_64, 0
$s0_64 = LD $sp_64, 8
$s1_64 = LD $sp_64, 16
$ra_64 = LD $sp_64, 24
PseudoReturn64 undef $ra_64 {
$sp_64 = DADDiu $sp_64, 32
}
...