LLVM每日谈之五十 LLVM 后端文档解析3 —目标描述类

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/snsn1984/article/details/90341146

前文理清楚了六大部分、七大环节和七大步骤的对应关系。那么我们接下来要深入的去分析:Target description classes: abstract target description interfaces (代码地址:include/llvm/Target/)。

Target description classes的特点主要有以下几点:

1、Target description classes,作为LLVM后端六大部分的第一大部分,主要是提供目标机器的一个抽象描述,不依赖于任何特定的客户端。

2、Target description classes所包含的类,是设计来捕捉目标的抽象特性,和具体的代码生成算法没有任何关系。

3、所有的Target description classes(除了DataLayout之外),都是设计来做具体目标实现的父类的(具体的目标实现要实现这些类的子类),所以这些类的实现都是虚函数实现的。

4、TargetMachine类是目标机器的完整机器描述的初始入口,通过该接口可以获取特定目标的所有信息。(Primary interface to the complete machine description for the target machine. All target-specific information should be accessible through this interface.)该类包含了一系列的get*Info 虚函数,以便获目标机器的相关信息,这些虚函数在具体的目标机器实现的时候会做具体实现。

总结起来,在所有的Target description classes中,TargetMachine和DataLayout是比较特殊的。TargetMachine是访问具体目标机器实现的一个最初入口,包含了大量可以访问具体目标机器信息的接口。而DataLayout是Target description classes类中唯一不可扩展的,存放在include/llvm/IR/DataLayout.h 。具体代码:DataLayout.h

在Target description classes中,除了TargetMachineDataLayout两个比较特殊的类之外,还有如下一些类:

TargetLowering (include/llvm/Codegen/TargetLowering.h)

TargetRegisterInfo (include/llvm/CodeGen/TargetRegisterInfo.h)

TargetInstrInfo (include/llvm/CodeGen/TargetInstrInfo.h)

TargetFrameLowering (include/llvm/CodeGen/TargetFrameLowering.h)

TargetSubtarget (目前已经没有TargetSubtarget类,只有TargetSubtargetInfo类,地址为:include/llvm/CodeGen/TargetSubtargetInfo.h)

TargetJITInfo (目前已经没有TargetJITInfo类)

---------------------------------------------------------------------------------------

注意!注意!注意!

文档没有跟上最新的代码变动。所以,我们提到的Target description classes的代码地址:include/llvm/Target/,已经完全不适用了。我们目前除了TargetMachine类还在这里之外,其他的类已经都换地方了。多数类移动到了include/llvm/CodeGen/目录之下,提交节点为:rL318490 。


相关内容:

小乖他爹:LLVM每日谈之三十七 LLVM后端简介(杭州分享PPT)

小乖他爹:LLVM每日谈之四十七 LLVM后端文档解析

小乖他爹:LLVM每日谈之四十八 LLVM后端文档解析1

小乖他爹:LLVM每日谈之四十九 LLVM后端文档解析2

猜你喜欢

转载自blog.csdn.net/snsn1984/article/details/90341146