2016-06-09 04:34:29 +08:00
; RUN: llc < %s -filetype=obj -o %t
2017-09-12 07:05:20 +08:00
; RUN: llvm-dwarfdump -v %t | FileCheck %s
2016-06-09 04:34:29 +08:00
; C++ source to regenerate:
; $ cat t.cpp
; struct A {
; void thiscallcc();
; };
; void A::thiscallcc() {}
; void cdeclcc() {}
; void __fastcall fastcallcc() {}
; void __stdcall stdcallcc() {}
; void __vectorcall vectorcallcc() {}
; $ clang -g t.cpp -emit-llvm -S -o t.ll -O1
; CHECK: .debug_abbrev contents:
; CHECK: [[subroutine_abbrev:\[[0-9]+\]]] DW_TAG_subroutine_type DW_CHILDREN_yes
; CHECK-NEXT: DW_AT_type DW_FORM_ref4
; CHECK-NEXT: DW_AT_calling_convention DW_FORM_data1
; CHECK: .debug_info contents:
; CHECK: DW_TAG_subroutine_type [[subroutine_abbrev]] *
; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] {{.*}}
; CHECK-NEXT: DW_AT_calling_convention [DW_FORM_data1] (DW_CC_BORLAND_msfastcall)
; CHECK: DW_TAG_subprogram [{{.*}}] *
; CHECK: DW_AT_low_pc
; CHECK: DW_AT_high_pc
; CHECK: DW_AT_frame_base
; CHECK: DW_AT_linkage_name
; CHECK: DW_AT_name
; CHECK: DW_AT_decl_file
; CHECK: DW_AT_decl_line
; CHECK: DW_AT_calling_convention [DW_FORM_data1] (DW_CC_BORLAND_msfastcall)
; CHECK: DW_AT_type
; CHECK: DW_AT_external
; ModuleID = 't.cpp'
source_filename = "t.cpp"
target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
target triple = "i386-pc-windows-msvc19.0.23918"
2016-12-22 08:45:21 +08:00
@"\01?fptr@@3P6IHHH@ZA" = global i32 ( i32 , i32 ) * @"\01?f@@YIHHH@Z" , align 4 , !dbg !0
2016-06-09 04:34:29 +08:00
; Function Attrs: nounwind readnone
2016-12-22 08:45:21 +08:00
define x86_fastcallcc i32 @"\01?f@@YIHHH@Z" ( i32 inreg %a , i32 inreg %b ) #0 !dbg !13 {
2016-06-09 04:34:29 +08:00
entry:
2017-07-29 04:21:02 +08:00
tail call void @llvm.dbg.value ( metadata i32 %b , metadata !15 , metadata !17 ) , !dbg !18
tail call void @llvm.dbg.value ( metadata i32 %a , metadata !16 , metadata !17 ) , !dbg !19
2016-12-22 08:45:21 +08:00
%add = add nsw i32 %b , %a , !dbg !20
ret i32 %add , !dbg !21
2016-06-09 04:34:29 +08:00
}
; Function Attrs: nounwind readnone
2017-07-29 04:21:02 +08:00
declare void @llvm.dbg.value ( metadata , metadata , metadata ) #1
2016-06-09 04:34:29 +08:00
attributes #0 = { nounwind readnone "disable-tail-calls" = "false" "less-precise-fpmad" = "false" "no-frame-pointer-elim" = "false" "no-infs-fp-math" = "false" "no-jump-tables" = "false" "no-nans-fp-math" = "false" "stack-protector-buffer-size" = "8" "target-cpu" = "pentium4" "target-features" = "+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math" = "false" "use-soft-float" = "false" }
attributes #1 = { nounwind readnone }
2016-12-22 08:45:21 +08:00
!llvm.dbg.cu = ! { !2 }
!llvm.module.flags = ! { !10 , !11 }
!llvm.ident = ! { !12 }
2017-08-31 02:06:51 +08:00
!0 = distinct !DIGlobalVariableExpression ( var: !1 , expr: !DIExpression ( ) )
2016-12-22 08:45:21 +08:00
!1 = !DIGlobalVariable ( name: "fptr" , linkageName: "\01?fptr@@3P6IHHH@ZA" , scope: !2 , file: !3 , line: 2 , type: !6 , isLocal: false , isDefinition: true )
!2 = distinct !DICompileUnit ( language: D W _ L A N G _ C _ p l u s _ p l u s , file: !3 , producer: "clang version 3.9.0 (trunk 272067)" , isOptimized: true , runtimeVersion: 0 , emissionKind: F u l l D e b u g , enums: !4 , globals: !5 )
!3 = !DIFile ( filename: "t.cpp" , directory: "D:\5Csrc\5Cllvm\5Cbuild" )
!4 = ! { }
!5 = ! { !0 }
!6 = !DIDerivedType ( tag: D W _ T A G _ p o i n t e r _ type , baseType: !7 , size: 32 , align: 32 )
!7 = !DISubroutineType ( cc: D W _ C C _ B O R L A N D _ m s f a s t call , types: !8 )
!8 = ! { !9 , !9 , !9 }
!9 = !DIBasicType ( name: "int" , size: 32 , align: 32 , encoding: D W _ A T E _ s i g n e d )
!10 = ! { i32 2 , !"Dwarf Version" , i32 4 }
!11 = ! { i32 2 , !"Debug Info Version" , i32 3 }
!12 = ! { !"clang version 3.9.0 (trunk 272067)" }
!13 = distinct !DISubprogram ( name: "f" , linkageName: "\01?f@@YIHHH@Z" , scope: !3 , file: !3 , line: 1 , type: !7 , isLocal: false , isDefinition: true , scopeLine: 1 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , unit: !2 , variables: !14 )
!14 = ! { !15 , !16 }
!15 = !DILocalVariable ( name: "b" , arg: 2 , scope: !13 , file: !3 , line: 1 , type: !9 )
!16 = !DILocalVariable ( name: "a" , arg: 1 , scope: !13 , file: !3 , line: 1 , type: !9 )
!17 = !DIExpression ( )
!18 = !DILocation ( line: 1 , column: 29 , scope: !13 )
!19 = !DILocation ( line: 1 , column: 22 , scope: !13 )
!20 = !DILocation ( line: 1 , column: 43 , scope: !13 )
!21 = !DILocation ( line: 1 , column: 34 , scope: !13 )
2016-06-09 04:34:29 +08:00