This repository contains source code for the LLVM/SPIR-V Bi-Directional Translator, a library and tool for translation between LLVM IR and SPIR-V.
The LLVM/SPIR-V Bi-Directional Translator is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt.
The files/directories related to the translator:
- include/SPIRV.h - header file
- lib/SPIRV - library for SPIR-V in-memory representation, decoder/encoder and LLVM/SPIR-V translator
- tools/llvm-spirv - command line utility for translating between LLVM bitcode and SPIR-V binary
TBD
All tests related to the translator are placed in the test directory.
Execute the following command to run translator tests:
llvm-lit test
To translate between LLVM IR and SPIR-V:
-
Execute the following command to translate
input.bc
toinput.spv
llvm-spirv input.bc
-
Execute the following command to translate
input.spv
toinput.bc
llvm-spirv -r input.spv
-
Other options accepted by
llvm-spirv
-o file_name
- to specify output name-spirv-debug
- output debugging information-spirv-text
- read/write SPIR-V in an internal textual format for debugging purpose. The textual format is not defined by SPIR-V spec.-help
- to see full list of options