@@ -89,6 +89,52 @@ leverage LLVM's current bitcode libraries to do a lot of the work, but
89
89
it's possible that at some point in the future it will need to be
90
90
completely separate as modern LLVM bitcode evolves.
91
91
92
+ DirectX Backend Flow
93
+ --------------------
94
+
95
+ The code generation flow for DXIL is broken into a series of passes. The passes
96
+ are grouped into two flows:
97
+
98
+ #. Generating DXIL IR.
99
+ #. Generating DXIL Binary.
100
+
101
+ The passes to generate DXIL IR follow the flow:
102
+
103
+ DXILOpLowering -> DXILPrepare -> DXILTranslateMetadata
104
+
105
+ Each of these passes has a defined responsibility:
106
+
107
+ #. DXILOpLowering translates LLVM intrinsic calls to dx.op calls.
108
+ #. DXILPrepare transforms the DXIL IR to be compatible with LLVM 3.7, and
109
+ inserts bitcasts to allow typed pointers to be inserted.
110
+ #. DXILTranslateMetadata emits the DXIL Metadata structures.
111
+
112
+ The passes to encode DXIL to binary in the DX Container follow the flow:
113
+
114
+ DXILEmbedder -> DXContainerGlobals -> AsmPrinter
115
+
116
+ Each of these passes have the following defined responsibilities:
117
+
118
+ #. DXILEmbedder runs the DXIL bitcode writer to generate a bitcode stream and
119
+ embeds the binary data inside a global in the original module.
120
+ #. DXContainerGlobals generates binary data globals for the other DX Container
121
+ parts based on computed analysis passes.
122
+ #. AsmPrinter is the standard LLVM infrastructure for emitting object files.
123
+
124
+ When emitting DXIL into a DX Container file the MC layer is used in a similar
125
+ way to how the Clang ``-fembed-bitcode `` option operates. The DX Container
126
+ object writer knows how to construct the headers and structural fields of the
127
+ container, and reads global variables from the module to fill in the remaining
128
+ part data.
129
+
130
+ DirectX Container
131
+ -----------------
132
+
133
+ The DirectX container format is treated in LLVM as an object file format.
134
+ Reading is implemented between the BinaryFormat and Object libraries, and
135
+ writing is implemented in the MC layer. Additional testing and inspection
136
+ support are implemented in the ObjectYAML library and tools.
137
+
92
138
Testing
93
139
=======
94
140
0 commit comments