2017-08-31 04:51:20 +08:00
|
|
|
; RUN: llc -filetype=asm %s -o - | FileCheck %s
|
|
|
|
; Test large integral function arguments passed in multiple registers.
|
|
|
|
;
|
|
|
|
; Generated from (-Os):
|
|
|
|
;
|
|
|
|
; signed long long g;
|
|
|
|
; void write(signed long long offset);
|
|
|
|
; signed long long foo(signed long long offset) {
|
|
|
|
; if (offset != g)
|
|
|
|
; write(offset);
|
|
|
|
; return offset;
|
|
|
|
; }
|
|
|
|
source_filename = "test.ii"
|
|
|
|
target datalayout = "e-m:o-p:32:32-i64:64-a:0:32-n32-S128"
|
|
|
|
target triple = "thumbv7k-apple-watchos2.0.0"
|
|
|
|
|
|
|
|
@g = local_unnamed_addr global i64 0, align 8, !dbg !0
|
|
|
|
|
|
|
|
; Function Attrs: optsize ssp
|
|
|
|
define i64 @_Z3foox(i64 returned) local_unnamed_addr #0 !dbg !13 {
|
|
|
|
tail call void @llvm.dbg.value(metadata i64 %0, metadata !17, metadata !DIExpression()), !dbg !18
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK: @DEBUG_VALUE: foo:offset <- [DW_OP_LLVM_fragment 0 32] $r5
|
|
|
|
; CHECK: @DEBUG_VALUE: foo:offset <- [DW_OP_LLVM_fragment 32 32] $r4
|
2017-08-31 04:51:20 +08:00
|
|
|
|
|
|
|
%2 = load i64, i64* @g, align 8, !dbg !19, !tbaa !21
|
|
|
|
%3 = icmp eq i64 %2, %0, !dbg !19
|
|
|
|
br i1 %3, label %5, label %4, !dbg !25
|
|
|
|
|
|
|
|
; <label>:4: ; preds = %1
|
|
|
|
tail call void @_Z5writex(i64 %0) #3, !dbg !26
|
|
|
|
br label %5, !dbg !26
|
|
|
|
|
|
|
|
; <label>:5: ; preds = %1, %4
|
|
|
|
ret i64 %0, !dbg !27
|
|
|
|
}
|
|
|
|
|
|
|
|
; Function Attrs: optsize
|
|
|
|
declare void @_Z5writex(i64) local_unnamed_addr #1
|
|
|
|
|
|
|
|
; Function Attrs: nounwind readnone speculatable
|
|
|
|
declare void @llvm.dbg.value(metadata, metadata, metadata) #2
|
|
|
|
|
|
|
|
attributes #0 = { optsize ssp }
|
|
|
|
attributes #1 = { optsize }
|
|
|
|
attributes #2 = { nounwind readnone speculatable }
|
|
|
|
attributes #3 = { optsize }
|
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!2}
|
|
|
|
!llvm.module.flags = !{!7, !8, !9, !10, !11}
|
|
|
|
|
|
|
|
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
|
|
|
|
!1 = distinct !DIGlobalVariable(name: "g", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)
|
|
|
|
!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 6.0.0 (trunk 312148) (llvm/trunk 312165)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
|
|
|
|
!3 = !DIFile(filename: "test.ii", directory: "/")
|
|
|
|
!4 = !{}
|
|
|
|
!5 = !{!0}
|
|
|
|
!6 = !DIBasicType(name: "long long int", size: 64, encoding: DW_ATE_signed)
|
|
|
|
!7 = !{i32 2, !"Dwarf Version", i32 4}
|
|
|
|
!8 = !{i32 2, !"Debug Info Version", i32 3}
|
|
|
|
!9 = !{i32 1, !"wchar_size", i32 4}
|
|
|
|
!10 = !{i32 1, !"min_enum_size", i32 4}
|
|
|
|
!11 = !{i32 7, !"PIC Level", i32 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
|
|
|
!13 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foox", scope: !3, file: !3, line: 3, type: !14, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !2, retainedNodes: !16)
|
2017-08-31 04:51:20 +08:00
|
|
|
!14 = !DISubroutineType(types: !15)
|
|
|
|
!15 = !{!6, !6}
|
|
|
|
!16 = !{!17}
|
|
|
|
!17 = !DILocalVariable(name: "offset", arg: 1, scope: !13, file: !3, line: 3, type: !6)
|
|
|
|
!18 = !DILocation(line: 3, scope: !13)
|
|
|
|
!19 = !DILocation(line: 4, scope: !20)
|
|
|
|
!20 = distinct !DILexicalBlock(scope: !13, file: !3, line: 4)
|
|
|
|
!21 = !{!22, !22, i64 0}
|
|
|
|
!22 = !{!"long long", !23, i64 0}
|
|
|
|
!23 = !{!"omnipotent char", !24, i64 0}
|
|
|
|
!24 = !{!"Simple C++ TBAA"}
|
|
|
|
!25 = !DILocation(line: 4, scope: !13)
|
|
|
|
!26 = !DILocation(line: 5, scope: !20)
|
|
|
|
!27 = !DILocation(line: 6, scope: !13)
|