Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame^] | 1 | //===-- llvm/MC/MCWasmObjectWriter.h - Wasm Object Writer -------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef LLVM_MC_MCWASMOBJECTWRITER_H |
| 11 | #define LLVM_MC_MCWASMOBJECTWRITER_H |
| 12 | |
| 13 | #include "llvm/ADT/Triple.h" |
| 14 | #include "llvm/BinaryFormat/Wasm.h" |
| 15 | #include "llvm/Support/DataTypes.h" |
| 16 | |
| 17 | namespace llvm { |
| 18 | |
| 19 | class MCFixup; |
| 20 | class MCObjectWriter; |
| 21 | class MCValue; |
| 22 | class raw_pwrite_stream; |
| 23 | |
| 24 | class MCWasmObjectTargetWriter { |
| 25 | const unsigned Is64Bit : 1; |
| 26 | |
| 27 | protected: |
| 28 | explicit MCWasmObjectTargetWriter(bool Is64Bit_); |
| 29 | |
| 30 | public: |
| 31 | virtual ~MCWasmObjectTargetWriter(); |
| 32 | |
| 33 | virtual unsigned getRelocType(const MCValue &Target, |
| 34 | const MCFixup &Fixup) const = 0; |
| 35 | |
| 36 | /// \name Accessors |
| 37 | /// @{ |
| 38 | bool is64Bit() const { return Is64Bit; } |
| 39 | /// @} |
| 40 | }; |
| 41 | |
| 42 | /// \brief Construct a new Wasm writer instance. |
| 43 | /// |
| 44 | /// \param MOTW - The target specific Wasm writer subclass. |
| 45 | /// \param OS - The stream to write to. |
| 46 | /// \returns The constructed object writer. |
| 47 | std::unique_ptr<MCObjectWriter> |
| 48 | createWasmObjectWriter(std::unique_ptr<MCWasmObjectTargetWriter> MOTW, |
| 49 | raw_pwrite_stream &OS); |
| 50 | |
| 51 | } // End llvm namespace |
| 52 | |
| 53 | #endif |