DxilLinker.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // //
  3. // DxilLinker.h //
  4. // Copyright (C) Microsoft Corporation. All rights reserved. //
  5. // This file is distributed under the University of Illinois Open Source //
  6. // License. See LICENSE.TXT for details. //
  7. // //
  8. // Representation of HLSL Linker. //
  9. // //
  10. ///////////////////////////////////////////////////////////////////////////////
  11. #pragma once
  12. #include <unordered_map>
  13. #include <unordered_set>
  14. #include "llvm/ADT/StringRef.h"
  15. #include <memory>
  16. #include "llvm/Support/ErrorOr.h"
  17. namespace llvm {
  18. class Function;
  19. class GlobalVariable;
  20. class Constant;
  21. class Module;
  22. class LLVMContext;
  23. } // namespace llvm
  24. namespace hlsl {
  25. class DxilModule;
  26. class DxilResourceBase;
  27. // Linker for DxilModule.
  28. class DxilLinker {
  29. public:
  30. virtual ~DxilLinker() {}
  31. static DxilLinker *CreateLinker(llvm::LLVMContext &Ctx);
  32. virtual bool HasLibNameRegistered(llvm::StringRef name) = 0;
  33. virtual bool RegisterLib(llvm::StringRef name,
  34. std::unique_ptr<llvm::Module> pModule,
  35. std::unique_ptr<llvm::Module> pDebugModule) = 0;
  36. virtual bool AttachLib(llvm::StringRef name) = 0;
  37. virtual bool DetachLib(llvm::StringRef name) = 0;
  38. virtual void DetachAll() = 0;
  39. virtual std::unique_ptr<llvm::Module> Link(llvm::StringRef entry,
  40. llvm::StringRef profile) = 0;
  41. protected:
  42. DxilLinker(llvm::LLVMContext &Ctx) : m_ctx(Ctx) {}
  43. llvm::LLVMContext &m_ctx;
  44. };
  45. } // namespace hlsl