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))
91 switch (
unsigned(Fixup.
getKind())) {
93 return wasm::R_WEBASSEMBLY_GLOBAL_INDEX_LEB;
96 return wasm::R_WEBASSEMBLY_TABLE_INDEX_SLEB;
97 return wasm::R_WEBASSEMBLY_MEMORY_ADDR_SLEB;
102 return wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB;
104 return wasm::R_WEBASSEMBLY_FUNCTION_INDEX_LEB;
105 return wasm::R_WEBASSEMBLY_MEMORY_ADDR_LEB;
108 return wasm::R_WEBASSEMBLY_TABLE_INDEX_I32;
109 if (
auto Section = static_cast<const MCSectionWasm *>(
111 if (
Section->getKind().isText())
112 return wasm::R_WEBASSEMBLY_FUNCTION_OFFSET_I32;
113 else if (!
Section->isWasmData())
114 return wasm::R_WEBASSEMBLY_SECTION_OFFSET_I32;
116 return wasm::R_WEBASSEMBLY_MEMORY_ADDR_I32;
124 std::unique_ptr<MCObjectTargetWriter>
126 return llvm::make_unique<WebAssemblyWasmObjectWriter>(Is64Bit);
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Compute iterated dominance frontiers using a linear time algorithm.
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.
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)