1 //===- HLSLResource.h - HLSL Resource helper objects ----------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 /// 9 /// \file This file contains helper objects for working with HLSL Resources. 10 /// 11 //===----------------------------------------------------------------------===// 12 13 #ifndef LLVM_FRONTEND_HLSL_HLSLRESOURCE_H 14 #define LLVM_FRONTEND_HLSL_HLSLRESOURCE_H 15 16 #include "llvm/ADT/StringRef.h" 17 #include "llvm/Support/DXILABI.h" 18 19 namespace llvm { 20 class GlobalVariable; 21 class MDNode; 22 23 namespace hlsl { 24 25 // For now we use DXIL ABI enum values directly. This may change in the future. 26 using dxil::ResourceClass; 27 using dxil::ElementType; 28 using dxil::ResourceKind; 29 30 class FrontendResource { 31 MDNode *Entry; 32 33 public: 34 FrontendResource(MDNode *E); 35 FrontendResource(GlobalVariable *GV, ResourceKind RK, ElementType ElTy, 36 bool IsROV, uint32_t ResIndex, uint32_t Space); 37 38 GlobalVariable *getGlobalVariable(); 39 StringRef getSourceType(); 40 ResourceKind getResourceKind(); 41 ElementType getElementType(); 42 bool getIsROV(); 43 uint32_t getResourceIndex(); 44 uint32_t getSpace(); 45 MDNode *getMetadata() { return Entry; } 46 }; 47 } // namespace hlsl 48 } // namespace llvm 49 50 #endif // LLVM_FRONTEND_HLSL_HLSLRESOURCE_H 51