[clang] [HLSL] Implement HLSL Flat casting (excluding splat cases) (PR #118842)
Justin Bogner via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 4 00:13:16 PST 2025
================
@@ -6358,3 +6359,81 @@ RValue CodeGenFunction::EmitPseudoObjectRValue(const PseudoObjectExpr *E,
LValue CodeGenFunction::EmitPseudoObjectLValue(const PseudoObjectExpr *E) {
return emitPseudoObjectExpr(*this, E, true, AggValueSlot::ignored()).LV;
}
+
+void CodeGenFunction::FlattenAccessAndType(
+ Address Addr, QualType AddrType,
+ SmallVectorImpl<std::pair<Address, llvm::Value *>> &AccessList,
+ SmallVectorImpl<QualType> &FlatTypes) {
+ // WorkList is list of type we are processing + the Index List to access
+ // the field of that type in Addr for use in a GEP
+ llvm::SmallVector<std::pair<QualType, llvm::SmallVector<llvm::Value *, 4>>,
+ 16>
+ WorkList;
+ llvm::IntegerType *IdxTy = llvm::IntegerType::get(getLLVMContext(), 32);
+ WorkList.push_back(
+ {AddrType,
+ {llvm::ConstantInt::get(
+ IdxTy,
+ 0)}}); // Addr should be a pointer so we need to 'dereference' it
----------------
bogner wrote:
nit: clang-format struggles with comments at the end of a line like this, I'd probably write this like:
```suggestion
// Addr should be a pointer so we need to 'dereference' it
WorkList.push_back({AddrType, {llvm::ConstantInt::get(IdxTy, 0)}});
```
https://github.com/llvm/llvm-project/pull/118842
More information about the cfe-commits
mailing list