1 | //===-- llvm/MC/MCSPIRVObjectWriter.h - SPIR-V Object Writer -----*- C++ *-===// |
---|---|
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 | #ifndef LLVM_MC_MCSPIRVOBJECTWRITER_H |
10 | #define LLVM_MC_MCSPIRVOBJECTWRITER_H |
11 | |
12 | #include "llvm/MC/MCObjectWriter.h" |
13 | #include "llvm/Support/raw_ostream.h" |
14 | #include <memory> |
15 | |
16 | namespace llvm { |
17 | |
18 | class MCSPIRVObjectTargetWriter : public MCObjectTargetWriter { |
19 | protected: |
20 | explicit MCSPIRVObjectTargetWriter() {} |
21 | |
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 | |
29 | /// Construct a new SPIR-V writer instance. |
30 | /// |
31 | /// \param MOTW - The target specific SPIR-V writer subclass. |
32 | /// \param OS - The stream to write to. |
33 | /// \returns The constructed object writer. |
34 | std::unique_ptr<MCObjectWriter> |
35 | createSPIRVObjectWriter(std::unique_ptr<MCSPIRVObjectTargetWriter> MOTW, |
36 | raw_pwrite_stream &OS); |
37 | |
38 | } // namespace llvm |
39 | |
40 | #endif |
41 |