[PATCH] D130131: [HLSL] CodeGen hlsl cbuffer/tbuffer.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 22 05:02:19 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/lib/CodeGen/CGHLSLRuntime.cpp:81-83
+    auto *GV = Const.first;
+    Const.second = EltTys.size();
+    auto *Ty = GV->getValueType();
----------------
Please spell out these types.


================
Comment at: clang/lib/CodeGen/CGHLSLRuntime.cpp:101-102
+  for (auto &Const : Buf.Constants) {
+    auto *EltTy = Buf.LayoutStruct->getElementType(Const.second);
+    auto *GV = Const.first;
+    unsigned Offset = Const.second;
----------------
Please spell out these types.


================
Comment at: clang/lib/CodeGen/CGHLSLRuntime.cpp:108
+
+    auto *GVTy = GV->getValueType();
+    assert(EltTy == GVTy && "constant type mismatch");
----------------
Same here


================
Comment at: clang/lib/CodeGen/CGHLSLRuntime.cpp:151
+  for (Decl *it : DC->decls()) {
+    if (VarDecl *ConstDecl = dyn_cast<VarDecl>(it)) {
+      addConstant(ConstDecl, CB);
----------------



================
Comment at: clang/lib/CodeGen/CGHLSLRuntime.cpp:153-156
+    } else if (isa<EmptyDecl>(*it)) {
+      // Nothing to do for this declaration.
+    } else if (isa<CXXRecordDecl>(it)) {
+      // Nothing to do for this declaration.
----------------



================
Comment at: clang/lib/CodeGen/CGHLSLRuntime.cpp:181
+
+  auto &DL = M.getDataLayout();
+
----------------
Please spell out the type.


================
Comment at: clang/lib/CodeGen/CGHLSLRuntime.h:51
+  struct Buffer {
+    Buffer(HLSLBufferDecl *D);
+    llvm::StringRef Name;
----------------



================
Comment at: clang/lib/CodeGen/CGHLSLRuntime.h:76
 
+  void addBuffer(HLSLBufferDecl *D);
   void finishCodeGen();
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130131/new/

https://reviews.llvm.org/D130131



More information about the cfe-commits mailing list