diff options
author | Justin Bogner <mail@justinbogner.com> | 2023-12-07 22:24:49 -0800 |
---|---|---|
committer | Justin Bogner <mail@justinbogner.com> | 2023-12-08 15:38:09 -0800 |
commit | 18f0da26b292341f84f91d4ce731b046315cd0a1 (patch) | |
tree | 5e3ef2f885fdf9606fced7ea1241ae2862cb0c81 | |
parent | 3791b3fca6eac5e403b91550ed0f774866cf3ede (diff) | |
download | llvm-18f0da26b292341f84f91d4ce731b046315cd0a1.zip llvm-18f0da26b292341f84f91d4ce731b046315cd0a1.tar.gz llvm-18f0da26b292341f84f91d4ce731b046315cd0a1.tar.bz2 |
[HLSL][DirectX] Avoid some unnecessary casting. NFC
-rw-r--r-- | llvm/include/llvm/Frontend/HLSL/HLSLResource.h | 2 | ||||
-rw-r--r-- | llvm/lib/Frontend/HLSL/HLSLResource.cpp | 9 | ||||
-rw-r--r-- | llvm/lib/Target/DirectX/DXILResource.cpp | 5 |
3 files changed, 8 insertions, 8 deletions
diff --git a/llvm/include/llvm/Frontend/HLSL/HLSLResource.h b/llvm/include/llvm/Frontend/HLSL/HLSLResource.h index ba08ee5..997ddcc 100644 --- a/llvm/include/llvm/Frontend/HLSL/HLSLResource.h +++ b/llvm/include/llvm/Frontend/HLSL/HLSLResource.h @@ -67,7 +67,7 @@ public: GlobalVariable *getGlobalVariable(); StringRef getSourceType(); - uint32_t getResourceKind(); + ResourceKind getResourceKind(); uint32_t getResourceIndex(); uint32_t getSpace(); MDNode *getMetadata() { return Entry; } diff --git a/llvm/lib/Frontend/HLSL/HLSLResource.cpp b/llvm/lib/Frontend/HLSL/HLSLResource.cpp index 59f730d..a3a7d0b 100644 --- a/llvm/lib/Frontend/HLSL/HLSLResource.cpp +++ b/llvm/lib/Frontend/HLSL/HLSLResource.cpp @@ -27,10 +27,11 @@ StringRef FrontendResource::getSourceType() { return cast<MDString>(Entry->getOperand(1))->getString(); } -uint32_t FrontendResource::FrontendResource::getResourceKind() { - return cast<ConstantInt>( - cast<ConstantAsMetadata>(Entry->getOperand(2))->getValue()) - ->getLimitedValue(); +ResourceKind FrontendResource::getResourceKind() { + return static_cast<ResourceKind>( + cast<ConstantInt>( + cast<ConstantAsMetadata>(Entry->getOperand(2))->getValue()) + ->getLimitedValue()); } uint32_t FrontendResource::getResourceIndex() { return cast<ConstantInt>( diff --git a/llvm/lib/Target/DirectX/DXILResource.cpp b/llvm/lib/Target/DirectX/DXILResource.cpp index 0390a3f..041b8fa 100644 --- a/llvm/lib/Target/DirectX/DXILResource.cpp +++ b/llvm/lib/Target/DirectX/DXILResource.cpp @@ -233,9 +233,8 @@ void ResourceBase::print(raw_ostream &OS, StringRef IDPrefix, } UAVResource::UAVResource(uint32_t I, FrontendResource R) - : ResourceBase(I, R), - Shape(static_cast<ResourceBase::Kinds>(R.getResourceKind())), - GloballyCoherent(false), HasCounter(false), IsROV(false), ExtProps() { + : ResourceBase(I, R), Shape(R.getResourceKind()), GloballyCoherent(false), + HasCounter(false), IsROV(false), ExtProps() { parseSourceType(R.getSourceType()); } |