36 explicit WebAssemblyAsmBackend(
bool Is64Bit,
bool IsEmscripten)
38 IsEmscripten(IsEmscripten) {}
46 std::unique_ptr<MCObjectTargetWriter>
53std::optional<MCFixupKind>
56#define WASM_RELOC(NAME, ID) .Case(#NAME, ID)
57#include "llvm/BinaryFormat/WasmRelocs.def"
66WebAssemblyAsmBackend::getFixupKindInfo(
MCFixupKind Kind)
const {
72 {
"fixup_sleb128_i32", 0, 5 * 8, 0},
73 {
"fixup_sleb128_i64", 0, 10 * 8, 0},
74 {
"fixup_uleb128_i32", 0, 5 * 8, 0},
75 {
"fixup_uleb128_i64", 0, 10 * 8, 0},
100void WebAssemblyAsmBackend::applyFixup(
const MCFragment &
F,
108 assert(
Info.Flags == 0 &&
"WebAssembly does not use MCFixupKindInfo flags");
110 unsigned NumBytes =
alignTo(
Info.TargetSize, 8) / 8;
118 "Invalid fixup offset!");
122 for (
unsigned I = 0;
I != NumBytes; ++
I)
126std::unique_ptr<MCObjectTargetWriter>
127WebAssemblyAsmBackend::createObjectTargetWriter()
const {
134 return new WebAssemblyAsmBackend(TT.isArch64Bit(), TT.isOSEmscripten());
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Analysis containing CSE Info
PowerPC TLS Dynamic Call Fixup
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
This file provides WebAssembly-specific target descriptions.
Generic interface to target specific assembler backends.
virtual bool writeNopData(raw_ostream &OS, uint64_t Count, const MCSubtargetInfo *STI) const =0
Write an (optimal) nop sequence of Count bytes to the given output.
virtual MCFixupKindInfo getFixupKindInfo(MCFixupKind Kind) const
Get information on a fixup kind.
virtual std::unique_ptr< MCObjectTargetWriter > createObjectTargetWriter() const =0
virtual std::optional< MCFixupKind > getFixupKind(StringRef Name) const
Map a relocation name used in .reloc to a fixup kind.
virtual void applyFixup(const MCFragment &, const MCFixup &, const MCValue &Target, uint8_t *Data, uint64_t Value, bool IsResolved)=0
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Generic base class for all target subtargets.
StringRef - Represent a constant reference to a string, i.e.
A switch()-like statement whose cases are string literals.
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream.
static const unsigned Nop
Instruction opcodes emitted via means other than CodeGen.
bool isRelocation(MCFixupKind FixupKind)
This is an optimization pass for GlobalISel generic memory operations.
@ FirstLiteralRelocationKind
MCAsmBackend * createWebAssemblyAsmBackend(const Triple &TT)
std::unique_ptr< MCObjectTargetWriter > createWebAssemblyWasmObjectWriter(bool Is64Bit, bool IsEmscripten)
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Target independent information on a fixup kind.