33 class WebAssemblyAsmBackend final :
public MCAsmBackend {
37 explicit WebAssemblyAsmBackend(
bool Is64Bit)
39 ~WebAssemblyAsmBackend()
override {}
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_code_sleb128_i32", 0, 5 * 8, 0},
81 {
"fixup_code_sleb128_i64", 0, 10 * 8, 0},
82 {
"fixup_code_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 {
134 return new WebAssemblyAsmBackend(TT.
isArch64Bit());
This class represents lattice values for constants.
This represents an "assembler immediate".
std::unique_ptr< MCObjectTargetWriter > createWebAssemblyWasmObjectWriter(bool Is64Bit)
virtual const MCFixupKindInfo & getFixupKindInfo(MCFixupKind Kind) const
Get information on a fixup kind.
uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Alig...
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.
unsigned TargetSize
The number of bits written by this fixup.
MCAsmBackend * createWebAssemblyAsmBackend(const Triple &TT)
Target - Wrapper for Target specific information.
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...
unsigned Flags
Flags describing additional information on this fixup kind.
MCFixupKind getKind() const