Clean up the debug line info tracking and generation.

- Correctly populate the field `currentFileId` with the presence of include directive
- Support lazy OpLine/OpDebugLine generation only when a real instruction is added instead of a debug location is set
- Improve the debug location tracking to per-block instead of just per-builder
- A few bug fixes related to debug source info
This commit is contained in:
Qingyuan Zheng 2024-02-09 10:27:40 -08:00 committed by GitHub
parent b1f7affe94
commit 30661abd9c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 8844 additions and 8834 deletions

View file

@ -1,16 +1,16 @@
spv.debuginfo.const_params.glsl.comp
// Module Version 10000
// Generated by (magic number): 8000b
// Id's are bound by 70
// Id's are bound by 71
Capability Shader
Extension "SPV_KHR_non_semantic_info"
2: ExtInstImport "NonSemantic.Shader.DebugInfo.100"
1: ExtInstImport "NonSemantic.Shader.DebugInfo.100"
3: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint GLCompute 14 "main"
ExecutionMode 14 LocalSize 1 1 1
1: String ""
2: String ""
8: String "uint"
17: String "float"
35: String "function"
@ -22,7 +22,7 @@ spv.debuginfo.const_params.glsl.comp
// OpModuleProcessed entry-point main
#line 1
"
45: String "f"
43: String "f"
49: String "f2"
52: String "f3"
55: String "f4"
@ -39,60 +39,59 @@ spv.debuginfo.const_params.glsl.comp
10: 7(int) Constant 32
11: 7(int) Constant 6
12: 7(int) Constant 0
9: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 8 10 11 12
9: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 8 10 11 12
13: 7(int) Constant 3
6: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 13 4
6: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 13 4
16: TypeFloat 32
18: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 17 10 13 12
18: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 17 10 13 12
19: TypeVector 16(float) 2
20: 7(int) Constant 2
21: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 18 20
21: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 18 20
22: TypeVector 16(float) 3
23: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 18 13
23: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 18 13
24: TypeVector 16(float) 4
25: 7(int) Constant 4
26: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 18 25
26: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(DebugTypeVector) 18 25
27: TypeFunction 4 16(float) 19(fvec2) 22(fvec3) 24(fvec4)
28: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 13 4 18 21 23 26
37: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 35(DebugSource) 1 38
28: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 13 4 18 21 23 26
37: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(DebugSource) 2 38
39: 7(int) Constant 7
41: 7(int) Constant 1
40: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 41 25 37 20
36: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 35 28 37 39 12 40 35 13 39
44: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 45 18 37 39 12 36 25 41
47: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression)
48: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 49 21 37 39 12 36 25 20
51: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 52 23 37 39 12 36 25 13
54: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 55 26 37 39 12 36 25 25
40: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 41 25 37 20
36: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 35 28 37 39 12 40 35 13 39
42: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 43 18 37 39 12 36 25 41
45: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(DebugExpression)
48: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 49 21 37 39 12 36 25 20
51: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 52 23 37 39 12 36 25 13
54: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 55 26 37 39 12 36 25 25
59: 7(int) Constant 11
58: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 57 6 37 59 12 40 57 13 59
64: 7(int) Constant 13
65: 16(float) Constant 0
66: 19(fvec2) ConstantComposite 65 65
67: 22(fvec3) ConstantComposite 65 65 65
68: 24(fvec4) ConstantComposite 65 65 65 65
Line 1 11 11
58: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 57 6 37 59 12 40 57 13 59
64: 16(float) Constant 0
65: 19(fvec2) ConstantComposite 64 64
66: 22(fvec3) ConstantComposite 64 64 64
67: 24(fvec4) ConstantComposite 64 64 64 64
70: 7(int) Constant 13
14(main): 4 Function None 5
15: Label
61: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 58 14(main)
62: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 58
63: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 37 64 64 12 12
69: 4 FunctionCall 33(function(f1;vf2;vf3;vf4;) 65 66 67 68
62: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 58
63: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 37 59 59 12 12
61: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 58 14(main)
69: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 37 70 70 12 12
68: 4 FunctionCall 33(function(f1;vf2;vf3;vf4;) 64 65 66 67
Return
FunctionEnd
Line 1 7 18
33(function(f1;vf2;vf3;vf4;): 4 Function None 27
29(f): 16(float) FunctionParameter
30(f2): 19(fvec2) FunctionParameter
31(f3): 22(fvec3) FunctionParameter
32(f4): 24(fvec4) FunctionParameter
34: Label
42: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 36
43: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 37 39 39 12 12
46: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 29(DebugValue) 44 29(f) 47
50: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 29(DebugValue) 48 30(f2) 47
53: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 29(DebugValue) 51 31(f3) 47
56: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 29(DebugValue) 54 32(f4) 47
60: 4 ExtInst 2(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 36 33(function(f1;vf2;vf3;vf4;)
46: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 36
47: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 37 39 39 12 12
44: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(DebugValue) 42 29(f) 45
50: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(DebugValue) 48 30(f2) 45
53: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(DebugValue) 51 31(f3) 45
56: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(DebugValue) 54 32(f4) 45
60: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 36 33(function(f1;vf2;vf3;vf4;)
Return
FunctionEnd