Difference between revisions of "NaplesPU LLVM Documentation"
(→TableGen) |
|||
Line 24: | Line 24: | ||
For other informations, check the [http://llvm.org/docs/TableGen/index.html TableGen Documentation] | For other informations, check the [http://llvm.org/docs/TableGen/index.html TableGen Documentation] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== C++ classes implementation == | == C++ classes implementation == |
Revision as of 18:40, 30 March 2019
The main task of the backend is to generate nu+ assembly code from the LLVM IR obtained by the Clang frontend. It also handles object representation of classes needed to create the assembler and the disassembler. The nu+ backend is contained in the NuPlus folder under "compiler/lib/Target" directory. It contains several files, each implementing a specific class of the LLVM Framework.
An LLVM backend is constructed on two types of file, C++ and TableGen source files. Refer to section TableGen to get a detailed explanation of it.
Required reading
Before working on LLVM, you should be familiar with some things. In particular:
- Basic Blocks
- SSA (Static Single Assignment) form
- AST (Abstract Syntax tree)
- DAG Direct Acyclic Graph.
In addition to general aspects about compilers, it is recommended to review the following topics:
See the following textbook for other informations Getting Started with LLVM Core Libraries and LLVM Cookbook.
See also this article to get an overview of the main CodeGenerator phases.
TableGen
TableGen is a record-oriented language used to describe the target-specific information. It is written by the LLVM team in order to simplify the back-end development and to avoid potential code redundancy. For example, by using TableGen, if some feature of the target-specific register file changes, you do not need to modify different files wherever the register appears but you need only to modify the .td file that contains its definition. Actually, the TableGen is used to define instruction formats, instructions, registers, pattern-matching DAGs, instruction selection matching order, calling conventions, and target platform properties.
For other informations, check the TableGen Documentation
C++ classes implementation
- NuPlus.h
- NuPlusAsmPrinter.cpp/.h
- NuPlusFrameLowering.cpp/.h
- NuPlusInstrInfo.cpp/.h
- NuPlusISelDAGToDAG.cpp
- NuPlusISelLowering.cpp/.h
- NuPlusMachineFunctionInfo.cpp/.h
- NuPlusMCInstLower.cpp/.h
- NuPlusRegisterInfo.cpp/.h
- NuPlusSubtarget.cpp/.h
- NuPlusTargetMachine.cpp/.h
- NuPlusTargetObjectFile.cpp/.h
Inside the AsmParser folder:
Inside the Disassembler folder:
Inside the InstPrinter folder:
Inside the MCTargetDesc folder:
- NuPlusAsmBackend.cpp
- NuPlusELFObjectWriter.cpp
- NuPlusFixupKinds.h
- NuPlusMCAsmInfo.cpp/.h
- NuPlusMCCodeEmitter.cpp
- NuPlusMCTargetDesc.cpp/.h