2014-08-19 10:09:57 +08:00
; RUN: llc < %s -mcpu=generic -mtriple=i386-apple-darwin -no-integrated-as
2016-12-22 08:45:21 +08:00
source_filename = "test/CodeGen/X86/fpstack-debuginstr-kill.ll"
2014-08-19 10:09:57 +08:00
2016-12-22 08:45:21 +08:00
@g1 = global double 0.000000e+00 , align 8 , !dbg !0
@g2 = global i32 0 , align 4 , !dbg !7
define void @_Z16fpuop_arithmeticjj ( i32 , i32 ) !dbg !16 {
2014-08-19 10:09:57 +08:00
entry:
switch i32 undef , label %sw.bb.i1921 [
]
2016-12-22 08:45:21 +08:00
sw.bb261: ; No predecessors!
2014-08-19 10:09:57 +08:00
unreachable
2016-12-22 08:45:21 +08:00
sw.bb.i1921: ; preds = %entry
2014-08-19 10:09:57 +08:00
switch i32 undef , label %if.end511 [
i32 1 , label %sw.bb27.i
]
sw.bb27.i: ; preds = %sw.bb.i1921
%conv.i.i1923 = fpext float undef to x86_fp80
br label %if.end511
2016-12-22 08:45:21 +08:00
if.end511: ; preds = %sw.bb27.i, %sw.bb.i1921
2014-08-19 10:09:57 +08:00
%src.sroa.0.0.src.sroa.0.0.2280 = phi x86_fp80 [ %conv.i.i1923 , %sw.bb27.i ] , [ undef , %sw.bb.i1921 ]
switch i32 undef , label %sw.bb992 [
i32 3 , label %sw.bb735
i32 18 , label %if.end41.i2210
]
sw.bb735: ; preds = %if.end511
%2 = call x86_fp80 asm sideeffect "frndint" , "={st},0,~{dirflag},~{fpsr},~{flags}" ( x86_fp80 %src.sroa.0.0.src.sroa.0.0.2280 )
unreachable
if.end41.i2210: ; preds = %if.end511
2016-12-22 08:45:21 +08:00
call void @llvm.dbg.value ( metadata x86_fp80 %src.sroa.0.0.src.sroa.0.0.2280 , i64 0 , metadata !25 , metadata !26 ) , !dbg !27
2014-08-19 10:09:57 +08:00
unreachable
sw.bb992: ; preds = %if.end511
ret void
}
2016-12-22 08:45:21 +08:00
; Function Attrs: nounwind readnone
declare void @llvm.dbg.value ( metadata , i64 , metadata , metadata ) #0
attributes #0 = { nounwind readnone }
!llvm.dbg.cu = ! { !10 }
!llvm.module.flags = ! { !14 , !15 }
2017-08-31 02:06:51 +08:00
!0 = !DIGlobalVariableExpression ( var: !1 , expr: !DIExpression ( ) )
2016-12-22 08:45:21 +08:00
!1 = !DIGlobalVariable ( name: "g1" , scope: null , file: !2 , line: 5 , type: !3 , isLocal: false , isDefinition: true )
!2 = !DIFile ( filename: "f1.cpp" , directory: "x87stackifier" )
!3 = !DIDerivedType ( tag: D W _ T A G _ t y p e d e f , name: "fpu_extended" , file: !2 , line: 3 , baseType: !4 )
!4 = !DIDerivedType ( tag: D W _ T A G _ t y p e d e f , name: "fpu_register" , file: !2 , line: 2 , baseType: !5 )
!5 = !DIDerivedType ( tag: D W _ T A G _ t y p e d e f , name: "uae_f64" , file: !2 , line: 1 , baseType: !6 )
!6 = !DIBasicType ( name: "long double" , size: 128 , align: 128 , encoding: D W _ A T E _ float )
2017-08-31 02:06:51 +08:00
!7 = !DIGlobalVariableExpression ( var: !8 , expr: !DIExpression ( ) )
2016-12-22 08:45:21 +08:00
!8 = !DIGlobalVariable ( name: "g2" , scope: null , file: !2 , line: 6 , type: !9 , isLocal: false , isDefinition: true )
!9 = !DIBasicType ( name: "int" , size: 32 , align: 32 , encoding: D W _ A T E _ s i g n e d )
2019-01-16 00:18:52 +08:00
!10 = distinct !DICompileUnit ( language: D W _ L A N G _ C _ p l u s _ p l u s , file: !11 , producer: "clang version 3.6.0" , isOptimized: true , runtimeVersion: 0 , emissionKind: F u l l D e b u g , enums: !12 , retainedTypes: !12 , globals: !13 , imports: !12 )
2016-12-22 08:45:21 +08:00
!11 = !DIFile ( filename: "fpu_ieee.cpp" , directory: "x87stackifier" )
!12 = ! { }
!13 = ! { !0 , !7 }
!14 = ! { i32 2 , !"Dwarf Version" , i32 2 }
!15 = ! { i32 2 , !"Debug Info Version" , i32 3 }
[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
!16 = distinct !DISubprogram ( name: "fpuop_arithmetic" , linkageName: "_Z16fpuop_arithmeticjj" , scope: !2 , file: !2 , line: 11 , type: !17 , isLocal: false , isDefinition: true , scopeLine: 13 , virtualIndex: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , unit: !10 , retainedNodes: !20 )
2016-12-22 08:45:21 +08:00
!17 = !DISubroutineType ( types: !18 )
!18 = ! { null , !19 , !19 }
!19 = !DIBasicType ( name: "unsigned int" , size: 32 , align: 32 , encoding: D W _ A T E _ u n s i g n e d )
!20 = ! { !21 , !22 , !23 , !24 , !25 }
!21 = !DILocalVariable ( arg: 1 , scope: !16 , file: !2 , line: 11 , type: !19 )
!22 = !DILocalVariable ( arg: 2 , scope: !16 , file: !2 , line: 11 , type: !19 )
!23 = !DILocalVariable ( name: "x" , scope: !16 , file: !2 , line: 14 , type: !3 )
!24 = !DILocalVariable ( name: "a" , scope: !16 , file: !2 , line: 15 , type: !9 )
!25 = !DILocalVariable ( name: "value" , scope: !16 , file: !2 , line: 16 , type: !3 )
!26 = !DIExpression ( )
!27 = !DILocation ( line: 0 , scope: !16 )
2014-08-19 10:09:57 +08:00