[clang] [clang][SPIRV] Add builtin for OpGenericCastToPtrExplicit and its SPIR-V friendly binding (PR #137805)
Victor Lomuller via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 29 07:09:33 PDT 2025
================
@@ -35,8 +35,10 @@ static constexpr Builtin::Info BuiltinInfos[] = {
static_assert(std::size(BuiltinInfos) == NumBuiltins);
llvm::SmallVector<Builtin::InfosShard>
-SPIRVTargetInfo::getTargetBuiltins() const {
- return {{&BuiltinStrings, BuiltinInfos}};
+BaseSPIRTargetInfo::getTargetBuiltins() const {
+ if (getTriple().isSPIRV())
+ return {{&BuiltinStrings, BuiltinInfos}};
----------------
Naghasan wrote:
I had a few thought about this, but there is a bit more to it:
1. Vulkan vs OpenCL environment (and for which target version)
2. Enabled vs disabled extensions
3. SPIR-V version
each will have an impact on the set of enabled builtins. A split between common, Vk env (`spirv`) and OpenCL env (`spirv32` / `spirv64`) builtins is probably a good step towards answering (1) by construction. What I don't like though is you'll end up with an "unknown builtin" rather than a clear message.
For the rest, I wanted to create an RFC to suggest the use of target features as there is plenty of existing infrastructure for this job.
https://github.com/llvm/llvm-project/pull/137805
More information about the cfe-commits
mailing list