blob: a4d5eb857b393ad77558c7a84fbb662ce351e63d [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===-- 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
17namespace llvm {
18
19class MCFixup;
20class MCObjectWriter;
21class MCValue;
22class raw_pwrite_stream;
23
24class MCWasmObjectTargetWriter {
25 const unsigned Is64Bit : 1;
26
27protected:
28 explicit MCWasmObjectTargetWriter(bool Is64Bit_);
29
30public:
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.
47std::unique_ptr<MCObjectWriter>
48createWasmObjectWriter(std::unique_ptr<MCWasmObjectTargetWriter> MOTW,
49 raw_pwrite_stream &OS);
50
51} // End llvm namespace
52
53#endif