-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathembed-ildb.ll
More file actions
98 lines (85 loc) · 3.8 KB
/
embed-ildb.ll
File metadata and controls
98 lines (85 loc) · 3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
; RUN: opt %s -dxil-embed -dxil-globals -S -o - | FileCheck %s
; RUN: llc %s --filetype=obj -o %t.bc
; RUN: obj2yaml %t.bc | FileCheck %s --check-prefix=YAML
; RUN: llvm-objcopy --dump-section=ILDB=%t.ildb %t.bc
; RUN: llvm-objcopy --dump-section=DXIL=%t.dxil %t.bc
; RUN: llvm-dis %t.ildb -o - | FileCheck %s --check-prefix=ILDB-DIS
; RUN: llvm-dis %t.dxil -o - | FileCheck %s --check-prefix=DXIL-DIS
target triple = "dxil-unknown-shadermodel6.5-library"
; CHECK: target triple = "dxil-unknown-shadermodel6.5-library"
define i32 @add(i32 %a, i32 %b) {
%sum = add i32 %a, %b
ret i32 %sum
}
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4}
!dx.source.contents = !{!5}
!dx.source.defines = !{!6}
!dx.source.mainFileName = !{!7}
!dx.source.args = !{!8}
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "Some Compiler", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "hlsl.hlsl", directory: "/some-path")
!2 = !{}
!3 = !{i32 7, !"Dwarf Version", i32 2}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{!"hlsl.hlsl", !"int add(int a, int b) { return a + b; }"}
!6 = !{}
!7 = !{!"hlsl.hlsl"}
!8 = !{!"-T", !"lib_6_5", !"-g", !"hlsl.hlsl"}
; Check that both parts are emitted as a GV and used by the compiler.
; CHECK: @dx.ildb = private constant [[BC_TYPE:\[[0-9]+ x i8\]]] c"BC\C0\DE{{[^"]+}}", section "ILDB", align 4
; CHECK: @dx.dxil = private constant [[BC_TYPE:\[[0-9]+ x i8\]]] c"BC\C0\DE{{[^"]+}}", section "DXIL", align 4
; CHECK: @llvm.compiler.used = appending global {{\[[0-9]+ x ptr\]}} [ptr @dx.ildb, ptr @dx.dxil
; This is using regex matches on some sizes, offsets and fields. These are all
; going to change as the DirectX backend continues to evolve and implement more
; features. Rather than extending this test to cover those future features, this
; test's matches are extremely fuzzy so that it won't break.
; YAML: --- !dxcontainer
; YAML-NEXT: Header:
; YAML-NEXT: Hash: [ 0x0, 0x0, 0x0,
; YAML: Version:
; YAML-NEXT: Major: 1
; YAML-NEXT: Minor: 0
; YAML-NEXT: FileSize: [[#]]
; YAML-NEXT: PartCount: [[#]]
; YAML-NEXT: PartOffsets: [ {{[0-9, ]+}}
; YAML: Parts:
; In verifying the DXIL and ILDB parts, this test captures the size of the part,
; and derives the program header and dxil size fields from the part's size.
; YAML: - Name: ILDB
; YAML-NEXT: Size: [[#ILDBSIZE:]]
; YAML-NEXT: Program:
; YAML-NEXT: MajorVersion: 6
; YAML-NEXT: MinorVersion: 5
; YAML-NEXT: ShaderKind: 6
; YAML-NEXT: Size: [[#div(ILDBSIZE,4)]]
; YAML-NEXT: DXILMajorVersion: 1
; YAML-NEXT: DXILMinorVersion: 5
; YAML-NEXT: DXILSize: [[#ILDBSIZE - 24]]
; YAML-NEXT: DXIL: [ 0x42, 0x43, 0xC0, 0xDE,
; YAML: - Name: DXIL
; YAML-NEXT: Size: [[#DXILSIZE:]]
; YAML-NEXT: Program:
; YAML-NEXT: MajorVersion: 6
; YAML-NEXT: MinorVersion: 5
; YAML-NEXT: ShaderKind: 6
; YAML-NEXT: Size: [[#div(DXILSIZE,4)]]
; YAML-NEXT: DXILMajorVersion: 1
; YAML-NEXT: DXILMinorVersion: 5
; YAML-NEXT: DXILSize: [[#DXILSIZE - 24]]
; YAML-NEXT: DXIL: [ 0x42, 0x43, 0xC0, 0xDE,
; Check that ILDB has the debug info, and DXIL does not:
; ILDB-DIS: define i32 @add(i32 %a, i32 %b)
; ILDB-DIS: !llvm.dbg.cu
; ILDB-DIS: !DICompileUnit
; ILDB-DIS: !DIFile
; ILDB-DIS: !"Dwarf Version"
; ILDB-DIS: !"Debug Info Version"
; DXIL-DIS: define i32 @add(i32 %a, i32 %b)
; DXIL-DIS-NOT: !llvm.dbg.cu
; DXIL-DIS-NOT: !dx.source
; DXIL-DIS-NOT: !DICompileUnit
; DXIL-DIS-NOT: !DIFile
; DXIL-DIS-NOT: !"Dwarf Version"
; DXIL-DIS-NOT: !"Debug Info Version"
; DXIL-DIS-NOT: "hlsl.hlsl"