32 class WebAssemblyAsmBackend final :
public MCAsmBackend {
37 explicit WebAssemblyAsmBackend(
bool Is64Bit,
bool IsEmscripten)
39 IsEmscripten(IsEmscripten) {}
41 unsigned getNumFixupKinds()
const override {
49 uint64_t
Value,
bool IsPCRel,
52 std::unique_ptr<MCObjectTargetWriter>
53 createObjectTargetWriter()
const override;
56 bool fixupNeedsRelaxation(
const MCFixup &Fixup, uint64_t
Value,
62 bool mayNeedRelaxation(
const MCInst &Inst,
68 MCInst &Res)
const override {}
70 bool writeNopData(
raw_ostream &OS, uint64_t Count)
const override;
80 {
"fixup_sleb128_i32", 0, 5 * 8, 0},
81 {
"fixup_sleb128_i64", 0, 10 * 8, 0},
82 {
"fixup_uleb128_i32", 0, 5 * 8, 0},
93 bool WebAssemblyAsmBackend::writeNopData(
raw_ostream &OS,
94 uint64_t Count)
const {
95 for (uint64_t
I = 0;
I < Count; ++
I)
105 uint64_t
Value,
bool IsPCRel,
108 assert(Info.
Flags == 0 &&
"WebAssembly does not use MCFixupKindInfo flags");
118 assert(Offset + NumBytes <= Data.
size() &&
"Invalid fixup offset!");
122 for (
unsigned I = 0;
I != NumBytes; ++
I)
123 Data[Offset +
I] |= uint8_t((Value >> (
I * 8)) & 0xff);
126 std::unique_ptr<MCObjectTargetWriter>
127 WebAssemblyAsmBackend::createObjectTargetWriter()
const {
bool isOSEmscripten() const
Tests whether the OS is Emscripten.
This class represents lattice values for constants.
This represents an "assembler immediate".
virtual const MCFixupKindInfo & getFixupKindInfo(MCFixupKind Kind) const
Get information on a fixup kind.
unsigned TargetOffset
The bit offset to write the relocation into.
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Encapsulates the layout of an assembly file at a particular point in time.
Analysis containing CSE Info
Instances of this class represent a single low-level machine instruction.
A relaxable fragment holds on to its MCInst, since it may need to be relaxed during the assembler lay...
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
size_t size() const
size - Get the array size.
This file provides WebAssembly-specific target descriptions.
MCFixupKind
Extensible enumeration to represent the type of a fixup.
uint32_t getOffset() const
Triple - Helper class for working with autoconf configuration names.
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
unsigned TargetSize
The number of bits written by this fixup.
MCAsmBackend * createWebAssemblyAsmBackend(const Triple &TT)
Target - Wrapper for Target specific information.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
bool isArch64Bit() const
Test whether the architecture is 64-bit.
Generic base class for all target subtargets.
Target independent information on a fixup kind.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
Generic interface to target specific assembler backends.
static const unsigned Nop
Instruction opcodes emitted via means other than CodeGen.
This class implements an extremely fast bulk output stream that can only output to a stream...
std::unique_ptr< MCObjectTargetWriter > createWebAssemblyWasmObjectWriter(bool Is64Bit, bool IsEmscripten)
unsigned Flags
Flags describing additional information on this fixup kind.
MCFixupKind getKind() const