Steps to Create a new LLVM Backend
Table of Contents
This aritcle is to show how a simple LLVM IR example is transformed into RISCV Assembly.
1 Triple class
Represents the platform that LLVM produces code for.
2 ELF File format support
3 Target Description (.td files) Use RISCV as example
4 DAG-based Instruction Selection Classes
- RISCVTargetMachine
- RISCVSubtarget
- RISCVPassConfig
- RISCVISelDAGToDAG
- RISCVISelLowering
This class configures the
instruction DAG selection process and enhances the lowering
with target-specific operations.
The class needs to provide the required lowering methods for the function calls.
LowerReturn()
,LowerCall()
,LowerFormalArguments()
,LowerOperation()
,PerformDAGCombine()
. - RISCVFrameLowering
6 MC Layer classes
- RISCVMCInstLower
- MCAsmInfo
- MCInstrInfo
- RegInfo
- SubtargetInfo
- MCAsmBackend
- MCInstPrinter
- MCCodeEmitter
- LLVMInitializeRISCVTargetMC