[clang] [HLSL] Constant buffers codegen (PR #124886)

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 18 15:48:17 PST 2025


================
@@ -0,0 +1,39 @@
+//===- HLSLTargetInfo.h ---------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "ABIInfoImpl.h"
+#include "TargetInfo.h"
+
+using namespace clang;
+using namespace clang::CodeGen;
+
+//===----------------------------------------------------------------------===//
+// Target codegen info implementation common between DirectX and SPIR/SPIR-V.
+//===----------------------------------------------------------------------===//
+
+class CommonHLSLTargetCodeGenInfo : public TargetCodeGenInfo {
----------------
bogner wrote:

I worry a little bit about the composability of interposing this class between TargetCodeGenInfo and the DirectX and SPIRV targets. Imagine if we added a second language-specific codegeninfo - how would a backend be able to opt-in to supporting both?

I guess it would be better to make this a CRTP mixin, or to have `createHLSLBufferLayoutType` as a free function with a callback for `getHLSLLayoutType`.

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


More information about the cfe-commits mailing list