2015-10-20 01:46:01 +08:00
; RUN: llc -march=hexagon -enable-misched=false < %s | FileCheck %s
; This testcase causes the scheduler to crash for some reason. Disable
; it for now.
target datalayout = "e-m:e-p:32:32-i64:64-a:0-v32:32-n16:32"
target triple = "hexagon-unknown--elf"
; Check that allocframe was packetized with the two adds.
; CHECK: foo:
; CHECK: {
; CHECK-DAG: allocframe
; CHECK-DAG: add
; CHECK-DAG: add
; CHECK: }
; CHECK: dealloc_return
; CHECK: }
; Function Attrs: nounwind
2015-11-06 06:03:56 +08:00
define i32 @foo ( i32 %x , i32 %y ) #0 !dbg !4 {
2015-10-20 01:46:01 +08:00
entry:
tail call void @llvm.dbg.value ( metadata i32 %x , i64 0 , metadata !9 , metadata !14 ) , !dbg !15
tail call void @llvm.dbg.value ( metadata i32 %y , i64 0 , metadata !10 , metadata !14 ) , !dbg !16
%add = add nsw i32 %x , 1 , !dbg !17
%add1 = add nsw i32 %y , 1 , !dbg !18
%call = tail call i32 @bar ( i32 %add , i32 %add1 ) #3 , !dbg !19
%add2 = add nsw i32 %call , 1 , !dbg !20
ret i32 %add2 , !dbg !21
}
declare i32 @bar ( i32 , i32 ) #1
; Function Attrs: nounwind readnone
declare void @llvm.dbg.value ( metadata , i64 , metadata , metadata ) #2
2018-10-20 01:31:11 +08:00
attributes #0 = { nounwind "target-cpu" = "hexagonv5" }
attributes #1 = { "target-cpu" = "hexagonv5" }
2015-10-20 01:46:01 +08:00
attributes #2 = { nounwind readnone }
attributes #3 = { nounwind }
!llvm.dbg.cu = ! { !0 }
!llvm.module.flags = ! { !11 , !12 }
!llvm.ident = ! { !13 }
2019-01-16 00:18:52 +08:00
!0 = distinct !DICompileUnit ( language: D W _ L A N G _ C 99 , file: !1 , producer: "clang version 3.8.0" , isOptimized: true , runtimeVersion: 0 , emissionKind: F u l l D e b u g , enums: !2 )
2015-10-20 01:46:01 +08:00
!1 = !DIFile ( filename: "cfi-late.c" , directory: "/test" )
!2 = ! { }
[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is
!DILabel(scope: !1, name: "foo", file: !2, line: 3)
We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is
llvm.dbg.label(metadata !1)
It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.
We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.
Differential Revision: https://reviews.llvm.org/D45024
Patch by Hsiangkai Wang.
llvm-svn: 331841
2018-05-09 10:40:45 +08:00
!4 = distinct !DISubprogram ( name: "foo" , scope: !1 , file: !1 , line: 3 , type: !5 , isLocal: false , isDefinition: true , scopeLine: 3 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , unit: !0 , retainedNodes: !8 )
2015-10-20 01:46:01 +08:00
!5 = !DISubroutineType ( types: !6 )
!6 = ! { !7 , !7 , !7 }
!7 = !DIBasicType ( name: "int" , size: 32 , align: 32 , encoding: D W _ A T E _ s i g n e d )
!8 = ! { !9 , !10 }
!9 = !DILocalVariable ( name: "x" , arg: 1 , scope: !4 , file: !1 , line: 3 , type: !7 )
!10 = !DILocalVariable ( name: "y" , arg: 2 , scope: !4 , file: !1 , line: 3 , type: !7 )
!11 = ! { i32 2 , !"Dwarf Version" , i32 4 }
!12 = ! { i32 2 , !"Debug Info Version" , i32 3 }
2019-01-16 00:18:52 +08:00
!13 = ! { !"clang version 3.8.0" }
2015-10-20 01:46:01 +08:00
!14 = !DIExpression ( )
!15 = !DILocation ( line: 3 , column: 13 , scope: !4 )
!16 = !DILocation ( line: 3 , column: 20 , scope: !4 )
!17 = !DILocation ( line: 4 , column: 15 , scope: !4 )
!18 = !DILocation ( line: 4 , column: 20 , scope: !4 )
!19 = !DILocation ( line: 4 , column: 10 , scope: !4 )
!20 = !DILocation ( line: 4 , column: 24 , scope: !4 )
!21 = !DILocation ( line: 4 , column: 3 , scope: !4 )