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

Learning the backend code structure


The backend implementation is scattered among different directories in the LLVM source tree. The main libraries behind code generation are found in the lib directory and its subfolders CodeGen, MC, TableGen, and Target:

  • The CodeGen directory contains implementation files and headers for all generic code generation algorithms: instruction selection, scheduler, register allocation, and all analyses needed for them.

  • The MC directory holds the implementation of low-level functionality for the assembler (assembly parser), relaxation algorithm (disassembler), and specific object file idioms such as ELF, COFF, MachO, and so on.

  • The TableGen directory holds the complete implementation of the TableGen tool, which is used to generate C++ code based on high-level target descriptions found in .td files.

  • Each target is implemented in a different subfolder under the Target folder (for example, Target/Mips) with several .cpp, .h, and .td files. Files implementing similar...