LLVM  9.0.0svn
MCWasmObjectWriter.h
Go to the documentation of this file.
1 //===-- llvm/MC/MCWasmObjectWriter.h - Wasm 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_MCWASMOBJECTWRITER_H
10 #define LLVM_MC_MCWASMOBJECTWRITER_H
11 
12 #include "llvm/MC/MCObjectWriter.h"
13 #include <memory>
14 
15 namespace llvm {
16 
17 class MCFixup;
18 class MCValue;
19 class raw_pwrite_stream;
20 
22  const unsigned Is64Bit : 1;
23 
24 protected:
25  explicit MCWasmObjectTargetWriter(bool Is64Bit_);
26 
27 public:
28  virtual ~MCWasmObjectTargetWriter();
29 
30  virtual Triple::ObjectFormatType getFormat() const { return Triple::Wasm; }
31  static bool classof(const MCObjectTargetWriter *W) {
32  return W->getFormat() == Triple::Wasm;
33  }
34 
35  virtual unsigned getRelocType(const MCValue &Target,
36  const MCFixup &Fixup) const = 0;
37 
38  /// \name Accessors
39  /// @{
40  bool is64Bit() const { return Is64Bit; }
41  /// @}
42 };
43 
44 /// Construct a new Wasm writer instance.
45 ///
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);
52 
53 } // namespace llvm
54 
55 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:23
This represents an "assembler immediate".
Definition: MCValue.h:39
virtual unsigned getRelocType(const MCValue &Target, const MCFixup &Fixup) const =0
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:74
virtual Triple::ObjectFormatType getFormat() const =0
virtual Triple::ObjectFormatType getFormat() const
static bool classof(const MCObjectTargetWriter *W)
std::unique_ptr< MCObjectWriter > createWasmObjectWriter(std::unique_ptr< MCWasmObjectTargetWriter > MOTW, raw_pwrite_stream &OS)
Construct a new Wasm writer instance.
PowerPC TLS Dynamic Call Fixup
Target - Wrapper for Target specific information.
Base class for classes that define behaviour that is specific to both the target and the object forma...
An abstract base class for streams implementations that also support a pwrite operation.
Definition: raw_ostream.h:340
ObjectFormatType
Definition: Triple.h:221