[PATCH] D10969: Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC.

Renato Golin via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 05:20:55 PDT 2015


rengolin added a comment.

In http://reviews.llvm.org/D10969#243155, @dsanders wrote:

> The reason for separating the enums is that it's desirable for Triple and TargetTuple to have different sets of values, particularly for ARM and Mips. By the end of the project, Triple's values should be focused on representing the triple, and TargetTuple's values should be focused on representing the target. For example, it's correct for mipsel-linux-gnu that Triple::getArch() returns Triple::mipsel. However, it's also desirable that TargetTuple::getArch() return TargetTuple::mips and TargetTuple::getEndian() return TargetTuple::LittleEndian. To put it another way, Triple's enum are more-or-less numeric representations of the input string, whereas TargetTuple's enums are representations of the intended target.


You're absolutely right, and that's why I ended up creating my own enums in the TargetParser.

> I don't know the ARM triples but here's an example based on what I've seen in your target parser work: Triple::getArch() should return Triple::armv7 for armv7-linux-gnu, while TargetTuple::getArch() would return TargetTuple::arm, and TargetTuple::getSubArch() would return TargetTuple::v7. Does that agree with your understanding of ARM triples?


Yes. Moreover, the sub-arch should be an identifier for a set of default features + allowed features, that can be enabled/disabled via other flags. The fact that the mapping between CPU and Arch is not injectve nor surjective makes the meaning of arch and subarch very subjective. :)


http://reviews.llvm.org/D10969





More information about the llvm-commits mailing list