Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:15

0001 //===-- llvm/MC/MCWasmObjectWriter.h - Wasm Object Writer -------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_MC_MCWASMOBJECTWRITER_H
0010 #define LLVM_MC_MCWASMOBJECTWRITER_H
0011 
0012 #include "llvm/MC/MCObjectWriter.h"
0013 #include <memory>
0014 
0015 namespace llvm {
0016 
0017 class MCFixup;
0018 class MCSectionWasm;
0019 class MCValue;
0020 class raw_pwrite_stream;
0021 
0022 class MCWasmObjectTargetWriter : public MCObjectTargetWriter {
0023   const unsigned Is64Bit : 1;
0024   const unsigned IsEmscripten : 1;
0025 
0026 protected:
0027   explicit MCWasmObjectTargetWriter(bool Is64Bit_, bool IsEmscripten);
0028 
0029 public:
0030   virtual ~MCWasmObjectTargetWriter();
0031 
0032   Triple::ObjectFormatType getFormat() const override { return Triple::Wasm; }
0033   static bool classof(const MCObjectTargetWriter *W) {
0034     return W->getFormat() == Triple::Wasm;
0035   }
0036 
0037   virtual unsigned getRelocType(const MCValue &Target, const MCFixup &Fixup,
0038                                 const MCSectionWasm &FixupSection,
0039                                 bool IsLocRel) const = 0;
0040 
0041   /// \name Accessors
0042   /// @{
0043   bool is64Bit() const { return Is64Bit; }
0044   bool isEmscripten() const { return IsEmscripten; }
0045   /// @}
0046 };
0047 
0048 /// Construct a new Wasm writer instance.
0049 ///
0050 /// \param MOTW - The target specific Wasm writer subclass.
0051 /// \param OS - The stream to write to.
0052 /// \returns The constructed object writer.
0053 std::unique_ptr<MCObjectWriter>
0054 createWasmObjectWriter(std::unique_ptr<MCWasmObjectTargetWriter> MOTW,
0055                        raw_pwrite_stream &OS);
0056 
0057 std::unique_ptr<MCObjectWriter>
0058 createWasmDwoObjectWriter(std::unique_ptr<MCWasmObjectTargetWriter> MOTW,
0059                           raw_pwrite_stream &OS, raw_pwrite_stream &DwoOS);
0060 
0061 } // namespace llvm
0062 
0063 #endif