@@ -93,6 +93,34 @@ Building clang from sources takes time and resources and it can be avoided:
93
93
moment, see [ KhronosGroup/SPIRV-LLVM-Translator #477 ] ( https://github.com/KhronosGroup/SPIRV-LLVM-Translator/issues/477 )
94
94
to track progress, discuss and contribute.
95
95
96
+ ### Build with SPIRV-Tools
97
+
98
+ The translator can use [ SPIRV-Tools] ( https://github.com/KhronosGroup/SPIRV-Tools ) to generate assembly with widely adopted syntax.
99
+ If SPIRV-Tools have been installed prior to the build it will be detected and
100
+ used automatically. However it is also possible to enable use of SPIRV-Tools
101
+ from a custom location using the following instructions:
102
+
103
+ 1 . Checkout, build and install SPIRV-Tools using
104
+ [ the following instructions] ( https://github.com/KhronosGroup/SPIRV-Tools#build ) .
105
+ Example using CMake with Ninja:
106
+ ```
107
+ cmake -G Ninja <SPIRV-Tools source location> -DCMAKE_INSTALL_PREFIX=<SPIRV-Tools installation location>
108
+ ninja install
109
+ ```
110
+ 2 . Point pkg-config to the SPIR-V tools installation when configuring the translator by setting
111
+ ` PKG_CONFIG_PATH=<SPIRV-Tools installation location>/lib/pkgconfig/ ` variable
112
+ before the cmake line invocation.
113
+ Example:
114
+ ```
115
+ PKG_CONFIG_PATH=<SPIRV-Tools installation location>/lib/pkgconfig/ cmake <other options>
116
+ ```
117
+
118
+ To verify the SPIR-V Tools integration in the translator build, run the following line
119
+ ```
120
+ llvm-spirv --spirv-tools-dis input.bc -o -
121
+ ```
122
+ The output should be printed in the standard assembly syntax.
123
+
96
124
## Configuring SPIR-V Headers
97
125
98
126
The translator build is dependent on the official Khronos header file
@@ -153,6 +181,7 @@ To translate between LLVM IR and SPIR-V:
153
181
* `-o file_name` - to specify output name
154
182
* `-spirv-debug` - output debugging information
155
183
* `-spirv-text` - read/write SPIR-V in an internal textual format for debugging purpose. The textual format is not defined by SPIR-V spec.
184
+ * `--spirv-tools-dis` - print SPIR-V assembly in SPIRV-Tools format. Only available on [builds with SPIRV-Tools](#build-with-spirv-tools).
156
185
* `-help` - to see full list of options
157
186
158
187
Translation from LLVM IR to SPIR-V and then back to LLVM IR is not guaranteed to
0 commit comments