[clang] [HLSL] Codegen for indexing of sub-arrays of multi-dimensional resource arrays (PR #154248)
Alex Sepkowski via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 28 16:29:10 PDT 2025
================
@@ -190,6 +192,71 @@ static void createResourceCtorArgs(CodeGenModule &CGM, CXXConstructorDecl *CD,
Args.add(RValue::get(NameStr), AST.getPointerType(AST.CharTy.withConst()));
}
+// Initializes local resource array variable. For multi-dimensional arrays it
+// calls itself recursively to initialize its sub-arrays. The Index used in the
+// resource constructor calls will begin at StartIndex and will be incremented
+// for each array element. The last used resource Index is returned to the
+// caller.
+static Value *initializeLocalResourceArray(
+ CodeGenFunction &CGF, AggValueSlot &ValueSlot,
+ const ConstantArrayType *ArrayTy, CXXConstructorDecl *CD,
+ llvm::Value *Range, llvm::Value *StartIndex, StringRef ResourceName,
+ HLSLResourceBindingAttr *RBA, HLSLVkBindingAttr *VkBinding,
+ ArrayRef<llvm::Value *> PrevGEPIndices, SourceLocation ArraySubsExprLoc) {
+
+ llvm::IntegerType *IntTy = CGF.CGM.IntTy;
+ llvm::Value *Index = StartIndex;
+ llvm::Value *One = llvm::ConstantInt::get(IntTy, 1);
+ uint64_t ArraySize = ArrayTy->getSExtSize();
----------------
alsepkow wrote:
nit: const
https://github.com/llvm/llvm-project/pull/154248
More information about the cfe-commits
mailing list