1 //===-- llvm/MC/MCWasmObjectWriter.h - Wasm Object Writer -------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_MC_MCWASMOBJECTWRITER_H
10 #define LLVM_MC_MCWASMOBJECTWRITER_H
12 #include "llvm/MC/MCObjectWriter.h"
19 class raw_pwrite_stream;
21 class MCWasmObjectTargetWriter : public MCObjectTargetWriter {
22 const unsigned Is64Bit : 1;
25 explicit MCWasmObjectTargetWriter(bool Is64Bit_);
28 virtual ~MCWasmObjectTargetWriter();
30 virtual Triple::ObjectFormatType getFormat() const { return Triple::Wasm; }
31 static bool classof(const MCObjectTargetWriter *W) {
32 return W->getFormat() == Triple::Wasm;
35 virtual unsigned getRelocType(const MCValue &Target,
36 const MCFixup &Fixup) const = 0;
40 bool is64Bit() const { return Is64Bit; }
44 /// Construct a new Wasm writer instance.
46 /// \param MOTW - The target specific Wasm writer subclass.
47 /// \param OS - The stream to write to.
48 /// \returns The constructed object writer.
49 std::unique_ptr<MCObjectWriter>
50 createWasmObjectWriter(std::unique_ptr<MCWasmObjectTargetWriter> MOTW,
51 raw_pwrite_stream &OS);