Book Image

Getting started with LLVM core libraries

Book Image

Getting started with LLVM core libraries

Overview of this book

Table of Contents (17 chapters)
Getting Started with LLVM Core Libraries
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Understanding the machine code framework


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).

MC instructions

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, MCInsts carry less information about the program. For instance, an MCInst instance can be created not only by a backend, but also...