The primary goal of this series is to enable CLOn12 to support SPIR and SPIR-V, including specialization constants. The secondary goal is some cleanup.
This series accomplishes the following:
- Fix the name of the compiler binary produced. I had aspirations of sharing compiler infrastructure between OpenCL and OpenGL, but I doubt that's going to happen in the long run, so let's just fix the name and drop "GL".
- Rename some entrypoints and structures to be more specific about what they do/are (e.g. "compile C to SPIR-V" instead of just "compile"). This helps reduce ambiguity when adding support for SPIR. Split SPIR-V binary data and metadata into two separate structs, and make metadata parsing explicit rather than part of linking.
- Since this is already going to be an API/ABI break, clean up some ugliness - since SPIR-V, metadata, and DXIL are already transparent structs, don't have the compiler DLL heap-allocated them, let the caller allocate them how they want (e.g. embedded in a larger object).
- Support serializing/deserializing LLVM IR (SPIR) to support
- Support parsing externally-provided SPIR-V, including parsing specialization constants and providing that as output metadata, and handle/report errors from parsing (which never should've happened previously since we generated it ourselves).
- Support specializing SPIR-V, either during translation to NIR, or as an explicit specialize step (needed to support independent compilation and linking with spec constants).
The corresponding OpenCLOn12 change is https://github.com/microsoft/OpenCLOn12/pull/21. This adds SPIR-V IL support and not yet SPIR, but that'll be coming as well.