MCSPIRVObjectWriter.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- llvm/MC/MCSPIRVObjectWriter.h - SPIR-V Object Writer -----*- C++ *-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_MC_MCSPIRVOBJECTWRITER_H
  14. #define LLVM_MC_MCSPIRVOBJECTWRITER_H
  15. #include "llvm/MC/MCObjectWriter.h"
  16. #include "llvm/Support/raw_ostream.h"
  17. #include <memory>
  18. namespace llvm {
  19. class MCSPIRVObjectTargetWriter : public MCObjectTargetWriter {
  20. protected:
  21. explicit MCSPIRVObjectTargetWriter() {}
  22. public:
  23. Triple::ObjectFormatType getFormat() const override { return Triple::SPIRV; }
  24. static bool classof(const MCObjectTargetWriter *W) {
  25. return W->getFormat() == Triple::SPIRV;
  26. }
  27. };
  28. /// Construct a new SPIR-V writer instance.
  29. ///
  30. /// \param MOTW - The target specific SPIR-V writer subclass.
  31. /// \param OS - The stream to write to.
  32. /// \returns The constructed object writer.
  33. std::unique_ptr<MCObjectWriter>
  34. createSPIRVObjectWriter(std::unique_ptr<MCSPIRVObjectTargetWriter> MOTW,
  35. raw_pwrite_stream &OS);
  36. } // namespace llvm
  37. #endif
  38. #ifdef __GNUC__
  39. #pragma GCC diagnostic pop
  40. #endif