[clang] [clang][SPIRV] Add builtin for OpGenericCastToPtrExplicit and its SPIR-V friendly binding (PR #137805)

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 29 08:23:42 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}};
----------------
farzonl wrote:

What if we had a `BuiltinsSPIRVCore.td` `BuiltinsSPIRVVK.td` and a `BuiltinsSPIRVCL.td` The stuff shared between CL and VK could live in Core and the VK and CL builtins will include the Core one. That should let us have seperate `SPIRVTargetInfo` and `SPIRV64TargetInfo`/`SPIRV32TargetInfo`. You won't have an unknown builtin if we do it this way because we would never expose the builtins that aren't valid for the target.

https://github.com/llvm/llvm-project/pull/137805


More information about the cfe-commits mailing list