34 explicit WebAssemblyWasmObjectWriter(
bool Is64Bit,
bool IsEmscripten);
38 const MCFixup &Fixup)
const override;
42 WebAssemblyWasmObjectWriter::WebAssemblyWasmObjectWriter(
bool Is64Bit,
47 if (
auto SyExp = dyn_cast<MCSymbolRefExpr>(Expr)) {
48 if (SyExp->getSymbol().isInSection())
49 return &SyExp->getSymbol().getSection();
53 if (
auto BinOp = dyn_cast<MCBinaryExpr>(Expr)) {
56 return SectionLHS == SectionRHS ? nullptr : SectionLHS;
59 if (
auto UnOp = dyn_cast<MCUnaryExpr>(Expr))
69 auto& SymA = cast<MCSymbolWasm>(RefA->
getSymbol());
75 return wasm::R_WASM_GLOBAL_INDEX_LEB;
78 return wasm::R_WASM_TABLE_INDEX_REL_SLEB;
81 return wasm::R_WASM_MEMORY_ADDR_REL_SLEB;
83 return wasm::R_WASM_TYPE_INDEX_LEB;
88 switch (
unsigned(Fixup.
getKind())) {
90 if (SymA.isFunction())
91 return wasm::R_WASM_TABLE_INDEX_SLEB;
92 return wasm::R_WASM_MEMORY_ADDR_SLEB;
97 return wasm::R_WASM_GLOBAL_INDEX_LEB;
98 if (SymA.isFunction())
99 return wasm::R_WASM_FUNCTION_INDEX_LEB;
101 return wasm::R_WASM_EVENT_INDEX_LEB;
102 return wasm::R_WASM_MEMORY_ADDR_LEB;
104 if (SymA.isFunction())
105 return wasm::R_WASM_TABLE_INDEX_I32;
106 if (
auto Section = static_cast<const MCSectionWasm *>(
108 if (
Section->getKind().isText())
109 return wasm::R_WASM_FUNCTION_OFFSET_I32;
110 else if (!
Section->isWasmData())
111 return wasm::R_WASM_SECTION_OFFSET_I32;
113 return wasm::R_WASM_MEMORY_ADDR_I32;
119 std::unique_ptr<MCObjectTargetWriter>
121 return std::make_unique<WebAssemblyWasmObjectWriter>(Is64Bit, IsEmscripten);
Instances of this class represent a uniqued identifier for a section in the current translation unit...
This class represents lattice values for constants.
This represents an "assembler immediate".
MCSymbolRefExpr::VariantKind getAccessVariant() const
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Base class for the full range of assembler expressions which are needed for parsing.
Represent a reference to a symbol from inside an expression.
static unsigned getRelocType(const MCValue &Target, const MCFixupKind FixupKind, const bool IsPCRel)
Translates generic PPC fixup kind to Mach-O/PPC relocation type enum.
static const MCSection * getFixupSection(const MCExpr *Expr)
This file provides WebAssembly-specific target descriptions.
const MCSymbolRefExpr * getSymA() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
PowerPC TLS Dynamic Call Fixup
const MCSymbol & getSymbol() const
Target - Wrapper for Target specific information.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
std::unique_ptr< MCObjectTargetWriter > createWebAssemblyWasmObjectWriter(bool Is64Bit, bool IsEmscripten)
const MCExpr * getValue() const
MCFixupKind getKind() const