-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Learn LLVM 12
By :
The definition of the instructions in the target description allows the construction of decoder tables, which are used to disassemble an object file into a textual assembler. The decoder tables and a decoder function are generated by the llvm-tblgen tool. Besides the generated code, we only need to provide the code to register and initialize the M88kDisassembler class and some helper functions to decode registers and operands. We place the implementation in the Disassembler/M88kDisassembler.cpp file.
The getInstruction() method of the M88kDisassembler class does the decoding work. It takes an array of bytes as input and decodes the next instruction into an instance of the MCInst class. The class declaration is as follows:
using DecodeStatus = MCDisassembler::DecodeStatus;
namespace {
class M88kDisassembler : public MCDisassembler {
public:
M88kDisassembler(const MCSubtargetInfo &STI, MCContext &Ctx)
...