LLVM daily talk of fifty-one TargetMachine

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/snsn1984/article/details/90341157

TargetMachine its subclasses:

The foregoing describes TargetMachine class, we simply analyzed under this article TargetMachine class and its subclasses. TargetMachine class is in include / llvm / Target / TargetMachine.h  the document.

TargetMachine class as an acquisition target machine information entry, as the parent class of the target machine is not directly inherited specific platform TargetMachine class, but first LLVMTargetMachine class inheritance:

TargetMachine.h

class LLVMTargetMachine : public TargetMachine {

Then the specific platform TargetMachine class and then inherit LLVMTargetMachine class. (To X86 platform, for example)

lib/Target/X86/X86TargetMachine.h

class X86TargetMachine final : public LLVMTargetMachine {

Therefore, the relationship between class XXXTargetMachine TargetMachine, LLVMTargetMachine specific target platform, and as shown:

Figure from: LLVM :: TargetMachine Class Reference

TargetMachine Virtual Methods:

基于前文我们已经提到的LLVM后端文档跟不上代码的变化,实际上现在除了TargetMachine类,Target description classes 中其他的类已经都不在include/llvm/Target目录之下。与此同时,在TargetMachine类中也不存在获取其他类包含的信息的接口,目前TargetMachine仅存的获取Target description classes中的类所包含信息的接口如下(其他的接口多是获取具体信息):

  /// Create a DataLayout.
  const DataLayout createDataLayout() const { return DL; }

创建DataLayout.

  virtual const TargetSubtargetInfo *getSubtargetImpl(const Function &) const {
    return nullptr;
  }

获取TargetSubtargetInfo。

其他的Target description classes(除TargetMachine和DataLayout之外):

以TargetLowering为例:TargetLowering(include/llvm/Codegen/TargetLowering.h)

TargetLoweringBase和TargetLowering都在include/llvm/Codegen/TargetLowering.h之中。而具体目标平台的XXXTargetLowering类则是在lib/Target下具体的目标平台目录之中。以X86平台为例,其则是在lib/Target/X86/X86ISelLowering.h 之中:

  //  X86 Implementation of the TargetLowering interface
  class X86TargetLowering final : public TargetLowering {

这个文件的注释也描述的很清晰:

// This file defines the interfaces that X86 uses to lower LLVM code into a
// selection DAG.

其他几个类的情况虽然有细微差别,但是情况都差不多。

 

Therefore, the analysis in this paper, in fact, is a combination of Target description classes and Implementations of the abstract description interfaces for particular targets were code analysis, back-end document six parts 1 and 5.

 

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

Guess you like

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