[llvm-branch-commits] [clang] [llvm] [HLSL] Remove old resource annotations (PR #130338)
Helena Kotas via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Mar 7 13:52:19 PST 2025
================
@@ -11,59 +11,9 @@
//===----------------------------------------------------------------------===//
#include "llvm/Frontend/HLSL/HLSLResource.h"
-#include "llvm/IR/IRBuilder.h"
-#include "llvm/IR/Metadata.h"
using namespace llvm;
using namespace llvm::hlsl;
-GlobalVariable *FrontendResource::getGlobalVariable() {
- return cast<GlobalVariable>(
- cast<ConstantAsMetadata>(Entry->getOperand(0))->getValue());
-}
-
-ResourceKind FrontendResource::getResourceKind() {
- return static_cast<ResourceKind>(
- cast<ConstantInt>(
- cast<ConstantAsMetadata>(Entry->getOperand(1))->getValue())
- ->getLimitedValue());
-}
-ElementType FrontendResource::getElementType() {
- return static_cast<ElementType>(
- cast<ConstantInt>(
- cast<ConstantAsMetadata>(Entry->getOperand(2))->getValue())
- ->getLimitedValue());
-}
-bool FrontendResource::getIsROV() {
- return cast<ConstantInt>(
- cast<ConstantAsMetadata>(Entry->getOperand(3))->getValue())
- ->getLimitedValue();
-}
-uint32_t FrontendResource::getResourceIndex() {
- return cast<ConstantInt>(
- cast<ConstantAsMetadata>(Entry->getOperand(4))->getValue())
- ->getLimitedValue();
-}
-uint32_t FrontendResource::getSpace() {
- return cast<ConstantInt>(
- cast<ConstantAsMetadata>(Entry->getOperand(5))->getValue())
- ->getLimitedValue();
-}
-
-FrontendResource::FrontendResource(MDNode *E) : Entry(E) {
- assert(Entry->getNumOperands() == 6 && "Unexpected metadata shape");
-}
-
-FrontendResource::FrontendResource(GlobalVariable *GV, ResourceKind RK,
- ElementType ElTy, bool IsROV,
- uint32_t ResIndex, uint32_t Space) {
- auto &Ctx = GV->getContext();
- IRBuilder<> B(Ctx);
- Entry = MDNode::get(
- Ctx, {ValueAsMetadata::get(GV),
- ConstantAsMetadata::get(B.getInt32(static_cast<int>(RK))),
- ConstantAsMetadata::get(B.getInt32(static_cast<int>(ElTy))),
- ConstantAsMetadata::get(B.getInt1(IsROV)),
- ConstantAsMetadata::get(B.getInt32(ResIndex)),
- ConstantAsMetadata::get(B.getInt32(Space))});
-}
+// Intentionally empty; this file can be removed when more cpp files are added
----------------
hekota wrote:
HLSLResource.cpp is currently the only file in the FrontendHLSL library. If I remove it the library is empty, and the compiler/linker is not happy about that. I don't want to remove the whole library because I know more changes are coming in here soon (https://github.com/llvm/llvm-project/pull/125131), so I have decided to just leave it in with a comment.
https://github.com/llvm/llvm-project/pull/130338
More information about the llvm-branch-commits
mailing list