31 #define DEBUG_TYPE "mccodeemitter"
33 STATISTIC(MCNumEmitted,
"Number of MC instructions emitted.");
34 STATISTIC(MCNumFixups,
"Number of MC fixups created.");
41 uint64_t getBinaryCodeForInstr(
const MCInst &
MI,
50 WebAssemblyMCCodeEmitter(
const MCInstrInfo &mcii) : MCII(mcii) {}
55 return new WebAssemblyMCCodeEmitter(MCII);
58 void WebAssemblyMCCodeEmitter::encodeInstruction(
61 uint64_t Start = OS.
tell();
63 uint64_t Binary = getBinaryCodeForInstr(MI, Fixups, STI);
64 assert(Binary < UINT8_MAX &&
"Multi-byte opcodes not supported yet");
65 OS << uint8_t(Binary);
70 if (MI.
getOpcode() == WebAssembly::BR_TABLE_I32 ||
71 MI.
getOpcode() == WebAssembly::BR_TABLE_I64)
79 }
else if (MO.
isImm()) {
82 "WebAssembly non-variable_ops don't use TSFlags");
102 "Unexpected floating-point immediate as a non-fixed operand");
104 "WebAssembly variable_ops floating point ops don't use TSFlags");
150 #include "WebAssemblyGenMCCodeEmitter.inc"
32-bit floating-point immediates.
void push_back(const T &Elt)
STATISTIC(NumFunctions,"Total number of functions")
32-bit integer immediates.
Describe properties that are true of each instruction in the target description file.
MachineInstrBuilder MachineInstrBuilder &DefMI const MCInstrDesc & Desc
32-bit unsigned memory offsets.
static Lanai::Fixups FixupKind(const MCExpr *Expr)
signature immediate for block/loop.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
uint64_t tell() const
tell - Return the current offset with the file.
uint8_t OperandType
Information about the type of the operand.
Instances of this class represent a single low-level machine instruction.
const MCExpr * getExpr() const
64-bit integer immediates.
MCCodeEmitter * createWebAssemblyMCCodeEmitter(const MCInstrInfo &MCII)
MCCodeEmitter - Generic instruction encoding interface.
This file provides WebAssembly-specific target descriptions.
Interface to description of machine instruction set.
MCFixupKind
Extensible enumeration to represent the type of a fixup.
type signature immediate for call_indirect.
static MCFixup create(uint32_t Offset, const MCExpr *Value, MCFixupKind Kind, SMLoc Loc=SMLoc())
unsigned getOpcode() const
64-bit floating-point immediates.
32-bit unsigned function indices.
llvm_unreachable("Unknown RegBank!")
unsigned getNumOperands() const
MCSubtargetInfo - Generic base class for all target subtargets.
void encodeSLEB128(int64_t Value, raw_ostream &OS, unsigned Padding=0)
Utility function to encode a SLEB128 value to an output stream.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
unsigned getNumOperands() const
Return the number of declared MachineOperands for this MachineInstruction.
const MCOperandInfo * OpInfo
This class implements an extremely fast bulk output stream that can only output to a stream...
void encodeULEB128(uint64_t Value, raw_ostream &OS, unsigned Padding=0)
Utility function to encode a ULEB128 value to an output stream.
This holds information about one operand of a machine instruction, indicating the register class for ...
Instances of this class represent operands of the MCInst class.
const MCOperand & getOperand(unsigned i) const