Steps to Create a new LLVM Backend

374 阅读1分钟

Steps to Create a new LLVM Backend

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.

4 DAG-based Instruction Selection Classes

  1. RISCVTargetMachine
  2. RISCVSubtarget
  3. RISCVPassConfig
  4. RISCVISelDAGToDAG
  5. 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().
  6. RISCVFrameLowering

6 MC Layer classes

  1. RISCVMCInstLower
  2. MCAsmInfo
  3. MCInstrInfo
  4. RegInfo
  5. SubtargetInfo
  6. MCAsmBackend
  7. MCInstPrinter
  8. MCCodeEmitter
  9. LLVMInitializeRISCVTargetMC

8 CMakeLists.txt