[clang] [clang][bytecode][HLSL] Complete the HLSL aggregate splat and elementwise cast implementations, and enable the new constant interpreter on all HLSL tests with static asserts (PR #189126)
Finn Plummer via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 7 14:24:24 PDT 2026
================
@@ -423,6 +423,29 @@ class Compiler : public ConstStmtVisitor<Compiler<Emitter>, bool>,
const QualType DerivedType);
bool emitLambdaStaticInvokerBody(const CXXMethodDecl *MD);
bool emitBuiltinBitCast(const CastExpr *E);
+
+ bool emitHLSLAggregateSplat(PrimType SrcT, unsigned SrcOffset,
+ QualType DestType, const Expr *E);
+
+ /// A scalar element extracted during HLSL aggregate flattening.
+ struct HLSLFlatElement {
+ unsigned LocalOffset;
+ PrimType Type;
+ };
+ unsigned countHLSLFlatElements(QualType Ty);
+ bool emitHLSLFlattenAggregate(QualType SrcType, unsigned SrcPtrOffset,
+ SmallVectorImpl<HLSLFlatElement> &Elements,
+ unsigned MaxElements, const Expr *E);
+ bool emitHLSLConstructAggregate(QualType DestType,
+ ArrayRef<HLSLFlatElement> Elements,
+ unsigned &ElemIdx, const Expr *E);
----------------
inbelic wrote:
nit: I think the use of a worklist over a recursive approach might avoid the need for this `unsigned &ElemIdx`, which I am not a big fan of. But I won't block on it.
https://github.com/llvm/llvm-project/pull/189126
More information about the cfe-commits
mailing list