The machine code (MC for short) classes comprise an entire framework for low-level manipulation of functions and instructions. In comparison with other backend components, this is a new framework that was designed to aid in the creation of LLVM-based assemblers and disassemblers. Previously, LLVM lacked an integrated assembler and was only able to proceed with the compilation until the assembly language emission step, which created an assembly text file as output and depended on external tools to carry on the rest of the compilation (assembler and linker).
In the MC framework, machine code instructions (MCInst
) replace machine instructions (MachineInstr
). The MCInst
class, defined in the <llvm_source>/include/llvm/MC/MCInst.h
file, defines a lightweight representation for instructions. Compared to MIs, MCInst
s carry less information about the program. For instance, an MCInst
instance can be created not only by a backend, but also...