diff options
author | Helena Kotas <hekotas@microsoft.com> | 2024-08-29 21:42:20 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-29 21:42:20 -0700 |
commit | e00e9a3f8294c9b96cb0328bf136fab72aeec749 (patch) | |
tree | f1f5ad97d6fc6172b0deb17c9e1e341a8f22b1b7 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | e004566547bb13386ee30c78176dd7988c42860a (diff) | |
download | llvm-e00e9a3f8294c9b96cb0328bf136fab72aeec749.zip llvm-e00e9a3f8294c9b96cb0328bf136fab72aeec749.tar.gz llvm-e00e9a3f8294c9b96cb0328bf136fab72aeec749.tar.bz2 |
[HLSL] Add HLSLAttributedResourceType (#106181)
Introducing `HLSLAttributedResourceType` - a new type that is similar to
`AttributedType` but with additional data specific to HLSL resources.
`AttributeType` currently only stores an attribute kind and no
additional data from the type attribute parameters. This does not really
work for HLSL resources since its type attributes contain non-boolean
values that need to be retained as well.
For example:
```
template <typename T> class RWBuffer {
__hlsl_resource_t [[hlsl::resource_class(uav)]] [[hlsl::is_rov]] handle;
};
```
The data `HLSLAttributedResourceType` needs to eventually store are:
- resource class (SRV, UAV, CBuffer, Sampler)
- texture dimension(1-3)
- flags is_rov, is_array, is_feedback and is_multisample
- contained type
All of these values except contained type will be stored in
`HLSLAttributedResourceType::Attributes` struct and accessed
individually via the fields. There is also `Data` alias that covers all
of these values as a `unsigned` which is used for hashing and the AST
type serialization.
During type attribute processing all HLSL type attributes will be
validated and collected by SemaHLSL (by
`SemaHLSL::handleResourceTypeAttr`) and in the end combined into a
single `HLSLAttributedResourceType` instance (in
`SemaHLSL::ProcessResourceTypeAttributes`). `SemaHLSL` will also need to
short-term store the `TypeLoc` information for the new type that will be
grabbed by `TypeSpecLocFiller` soon after the type is created.
Part 1/2 of #104861
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index a574728..fae26d1 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -2493,6 +2493,7 @@ void CodeGenFunction::EmitVariablyModifiedType(QualType type) { case Type::UnaryTransform: case Type::Attributed: case Type::BTFTagAttributed: + case Type::HLSLAttributedResource: case Type::SubstTemplateTypeParm: case Type::MacroQualified: case Type::CountAttributed: |