File indexing completed on 2026-05-10 08:44:15
0001
0002
0003
0004
0005
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
0042
0043 bool is64Bit() const { return Is64Bit; }
0044 bool isEmscripten() const { return IsEmscripten; }
0045
0046 };
0047
0048
0049
0050
0051
0052
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 }
0062
0063 #endif