LLVM 19.0.0git
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
13#include <memory>
14
15namespace llvm {
16
17class MCFixup;
18class MCSectionWasm;
19class MCValue;
20class raw_pwrite_stream;
21
23 const unsigned Is64Bit : 1;
24 const unsigned IsEmscripten : 1;
25
26protected:
27 explicit MCWasmObjectTargetWriter(bool Is64Bit_, bool IsEmscripten);
28
29public:
31
32 Triple::ObjectFormatType getFormat() const override { return Triple::Wasm; }
33 static bool classof(const MCObjectTargetWriter *W) {
34 return W->getFormat() == Triple::Wasm;
35 }
36
37 virtual unsigned getRelocType(const MCValue &Target, const MCFixup &Fixup,
38 const MCSectionWasm &FixupSection,
39 bool IsLocRel) const = 0;
40
41 /// \name Accessors
42 /// @{
43 bool is64Bit() const { return Is64Bit; }
44 bool isEmscripten() const { return IsEmscripten; }
45 /// @}
46};
47
48/// Construct a new Wasm writer instance.
49///
50/// \param MOTW - The target specific Wasm writer subclass.
51/// \param OS - The stream to write to.
52/// \returns The constructed object writer.
53std::unique_ptr<MCObjectWriter>
54createWasmObjectWriter(std::unique_ptr<MCWasmObjectTargetWriter> MOTW,
55 raw_pwrite_stream &OS);
56
57std::unique_ptr<MCObjectWriter>
58createWasmDwoObjectWriter(std::unique_ptr<MCWasmObjectTargetWriter> MOTW,
59 raw_pwrite_stream &OS, raw_pwrite_stream &DwoOS);
60
61} // namespace llvm
62
63#endif
PowerPC TLS Dynamic Call Fixup
raw_pwrite_stream & OS
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:71
Base class for classes that define behaviour that is specific to both the target and the object forma...
This represents a section on wasm.
Definition: MCSectionWasm.h:26
This represents an "assembler immediate".
Definition: MCValue.h:36
static bool classof(const MCObjectTargetWriter *W)
Triple::ObjectFormatType getFormat() const override
virtual unsigned getRelocType(const MCValue &Target, const MCFixup &Fixup, const MCSectionWasm &FixupSection, bool IsLocRel) const =0
Target - Wrapper for Target specific information.
ObjectFormatType
Definition: Triple.h:285
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
std::unique_ptr< MCObjectWriter > createWasmObjectWriter(std::unique_ptr< MCWasmObjectTargetWriter > MOTW, raw_pwrite_stream &OS)
Construct a new Wasm writer instance.
std::unique_ptr< MCObjectWriter > createWasmDwoObjectWriter(std::unique_ptr< MCWasmObjectTargetWriter > MOTW, raw_pwrite_stream &OS, raw_pwrite_stream &DwoOS)