35 explicit WebAssemblyWasmObjectWriter(
bool Is64Bit);
39 const MCFixup &Fixup)
const override;
43 WebAssemblyWasmObjectWriter::WebAssemblyWasmObjectWriter(
bool Is64Bit)
48 if (
auto SyExp = dyn_cast<MCSymbolRefExpr>(Expr))
49 return cast<MCSymbolWasm>(SyExp->getSymbol()).isFunction();
51 if (
auto BinOp = dyn_cast<MCBinaryExpr>(Expr))
54 if (
auto UnOp = dyn_cast<MCUnaryExpr>(Expr))
66 if (
auto SyExp = dyn_cast<MCSymbolRefExpr>(Expr)) {
67 if (SyExp->getSymbol().isInSection())
68 return &SyExp->getSymbol().getSection();
72 if (
auto BinOp = dyn_cast<MCBinaryExpr>(Expr)) {
75 return SectionLHS == SectionRHS ? nullptr : SectionLHS;
78 if (
auto UnOp = dyn_cast<MCUnaryExpr>(Expr))
100 switch (
unsigned(Fixup.
getKind())) {
103 return wasm::R_WEBASSEMBLY_TABLE_INDEX_SLEB;
104 return wasm::R_WEBASSEMBLY_MEMORY_ADDR_SLEB;
109 return wasm::R_WEBASSEMBLY_GLOBAL_INDEX_LEB;
111 return wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB;
113 return wasm::R_WEBASSEMBLY_FUNCTION_INDEX_LEB;
115 return wasm::R_WEBASSEMBLY_EVENT_INDEX_LEB;
116 return wasm::R_WEBASSEMBLY_MEMORY_ADDR_LEB;
119 return wasm::R_WEBASSEMBLY_TABLE_INDEX_I32;
120 if (
auto Section = static_cast<const MCSectionWasm *>(
122 if (
Section->getKind().isText())
123 return wasm::R_WEBASSEMBLY_FUNCTION_OFFSET_I32;
124 else if (!
Section->isWasmData())
125 return wasm::R_WEBASSEMBLY_SECTION_OFFSET_I32;
127 return wasm::R_WEBASSEMBLY_MEMORY_ADDR_I32;
135 std::unique_ptr<MCObjectTargetWriter>
137 return llvm::make_unique<WebAssemblyWasmObjectWriter>(Is64Bit);
Instances of this class represent a uniqued identifier for a section in the current translation unit...
static bool IsGlobalType(const MCValue &Target)
This class represents lattice values for constants.
This represents an "assembler immediate".
std::unique_ptr< MCObjectTargetWriter > createWebAssemblyWasmObjectWriter(bool Is64Bit)
VariantKind getKind() const
static bool IsFunctionType(const MCValue &Target)
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 bool IsEventType(const MCValue &Target)
This file provides WebAssembly-specific target descriptions.
static const MCSection * GetFixupSection(const MCExpr *Expr)
const MCSymbolRefExpr * getSymA() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
PowerPC TLS Dynamic Call Fixup
Target - Wrapper for Target specific information.
const MCExpr * getValue() const
MCFixupKind getKind() const
static bool IsFunctionExpr(const MCExpr *Expr)