2017-08-18 00:57:13 +08:00
|
|
|
; RUN: llc -O0 -mtriple=x86_64-unknown-linux-gnu -stop-before="regallocfast" -o - %s | FileCheck %s
|
|
|
|
;
|
|
|
|
; We check that all the instructions in bb4 now have a debug-location
|
|
|
|
; annotation, and that the annotation is identical to the one on e.g.,
|
|
|
|
; the jmp to bb4.
|
|
|
|
;
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: JMP{{.*}}%bb.4, debug-location ![[JUMPLOC:[0-9]+]]
|
2017-08-18 00:57:13 +08:00
|
|
|
; CHECK: bb.4.entry:
|
|
|
|
; CHECK: successors:
|
[X86] Merge the different Jcc instructions for each condition code into single instructions that store the condition code as an operand.
Summary:
This avoids needing an isel pattern for each condition code. And it removes translation switches for converting between Jcc instructions and condition codes.
Now the printer, encoder and disassembler take care of converting the immediate. We use InstAliases to handle the assembly matching. But we print using the asm string in the instruction definition. The instruction itself is marked IsCodeGenOnly=1 to hide it from the assembly parser.
Reviewers: spatel, lebedev.ri, courbet, gchatelet, RKSimon
Reviewed By: RKSimon
Subscribers: MatzeB, qcolombet, eraman, hiraditya, arphaman, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60228
llvm-svn: 357802
2019-04-06 03:28:09 +08:00
|
|
|
; CHECK: JCC{{.*}}debug-location ![[JUMPLOC]]
|
2017-08-18 00:57:13 +08:00
|
|
|
; CHECK: JMP{{.*}}debug-location ![[JUMPLOC]]
|
|
|
|
|
|
|
|
define i32 @main() !dbg !12 {
|
|
|
|
entry:
|
|
|
|
%add = add nsw i32 undef, 1, !dbg !16
|
|
|
|
switch i32 %add, label %sw.epilog [
|
|
|
|
i32 1, label %sw.bb
|
|
|
|
i32 2, label %sw.bb2
|
|
|
|
], !dbg !17
|
|
|
|
|
|
|
|
sw.bb: ; preds = %entry
|
|
|
|
br label %sw.epilog, !dbg !20
|
|
|
|
|
|
|
|
sw.bb2: ; preds = %entry
|
|
|
|
br label %sw.epilog, !dbg !22
|
|
|
|
|
|
|
|
sw.epilog: ; preds = %sw.bb2, %sw.bb, %entry
|
|
|
|
ret i32 4711, !dbg !23
|
|
|
|
}
|
|
|
|
!llvm.dbg.cu = !{!2}
|
|
|
|
!llvm.module.flags = !{!8, !9}
|
|
|
|
!llvm.ident = !{!11}
|
|
|
|
|
|
|
|
!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, emissionKind: FullDebug, enums: !4)
|
|
|
|
!3 = !DIFile(filename: "foo.c", directory: ".")
|
|
|
|
!4 = !{}
|
|
|
|
!7 = !DIBasicType(name: "int", size: 16, encoding: DW_ATE_signed)
|
|
|
|
!8 = !{i32 2, !"Dwarf Version", i32 4}
|
|
|
|
!9 = !{i32 2, !"Debug Info Version", i32 3}
|
|
|
|
!11 = !{!"clang"}
|
[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
|
|
|
!12 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 4, type: !13, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false, unit: !2, retainedNodes: !4)
|
2017-08-18 00:57:13 +08:00
|
|
|
!13 = !DISubroutineType(types: !14)
|
|
|
|
!14 = !{!7}
|
|
|
|
!16 = !DILocation(line: 6, column: 13, scope: !12)
|
|
|
|
!17 = !DILocation(line: 6, column: 3, scope: !12)
|
|
|
|
!19 = distinct !DILexicalBlock(scope: !12, file: !3, line: 7, column: 5)
|
|
|
|
!20 = !DILocation(line: 10, column: 7, scope: !19)
|
|
|
|
!22 = !DILocation(line: 13, column: 7, scope: !19)
|
|
|
|
!23 = !DILocation(line: 24, column: 1, scope: !12)
|