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 asELF
,COFF
,MachO
, and so on. - The
TableGen
directory holds the complete implementation of theTableGen
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...