================
@@ -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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to