LLVM daily talk correction of fifty-three Target Registration of

Before the text: Create a new LLVM backend differences first step documentation and code  mainly for the implementation of a new back-end Target Machine, a first step in a new back-end seven steps. After this step, there is an implicit content that is registered to the Target, so that other tools can be used LLVM your new target at runtime.

LLVM of official documents in order to Sparc, for example, made an example:

with

 

In fact, the code change has been great. The current registration code Target, and no longer the same place, and even include / llvm / Target / TargetRegistry.h are no longer exists. In this paper, the latest code RISCV as an example to show the code Target registration:

llvm/lib/Target/RISCV/TargetInfo/RISCVTargetInfo.cpp

extern "C" void LLVMInitializeRISCVTargetInfo() {
  RegisterTarget<Triple::riscv32> X(getTheRISCV32Target(), "riscv32",
                                    "32-bit RISC-V", "RISCV");
  RegisterTarget<Triple::riscv64> Y(getTheRISCV64Target(), "riscv64",
                                    "64-bit RISC-V", "RISCV");
}

llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp

// Force static initialization.
extern "C" void LLVMInitializeRISCVAsmPrinter() {
  RegisterAsmPrinter<RISCVAsmPrinter> X(getTheRISCV32Target());
  RegisterAsmPrinter<RISCVAsmPrinter> Y(getTheRISCV64Target());
}

We can see that the current structure of the code and documentation have been very different. To point this out, but also want to make subsequent contact less take some detours piece.

Reference documents: http://releases.llvm.org/8.0.0/docs/WritingAnLLVMBackend.html

Reference Code: LLVM / LLVM-Project  Latest the commit f58ef87

 

related information:

Little angel his father: LLVM daily talk of thirty-seven LLVM backend Profile (Hangzhou Share PPT)

Little angel his father: LLVM daily talk of forty-seven LLVM backend document parsing

Little angel his father: LLVM talk about the daily forty-eight LLVM backend document parsing 1

Little angel his father: LLVM talk about the daily forty-nine LLVM backend document parsing 2

Little angel his father: LLVM daily talk of fifty LLVM backend document parsing 3 - goal description class

Little angel his father: LLVM daily talk of fifty-one TargetMachine

LLVM to talk about the differences in daily fifty-two create a new LLVM back end of the first step in the document and the code: his father little angel

Posted on 2019-06-02

Guess you like

Origin blog.csdn.net/snsn1984/article/details/92207590