[PATCH] D110514: MIPS: Triple::setArch as R6 if MipsSubArch_r6

YunQiang Su via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 13 01:55:49 PDT 2021


wzssyqa added a comment.

In D110514#3057388 <https://reviews.llvm.org/D110514#3057388>, @atanasyan wrote:

> - This patch needs test cases. Take a look at `llvm/unittests/ADT/TripleTest.cpp`
> - IMHO the current fix is not the best solution. It solves the problem but looks a bit strange. For example, the following code (unusual but correct) stops working. Without the patch it produces a correct "arm-linux-gnu" target triple.
>
>   Triple T("mipsisa32r6-linux-gnu");
>   T.setArch(Triple::arm);

ohhh. strange code...

> It's better to modify `Triple::setArch()` function so it takes two arguments `ArchType` and `SubArchType`. The second argument is `NoSubARch` by default. Then the `setArch()` passes both arguments to the `getArchTypeName()`. We need to teach this function to generate architecture's name in accordance with `ArchType` and `SubArchType` arguments. In this patch we can do it for MIPS only. @MaskRay - what do you think?

I don't think modify `getArchTypeName' is a good idea.
I prefer keep `TypeName` as it, and use ArchName to hold more info.

In fact it is almost same as my first shape of code: Add a new function

  getArchName(ArchType Kind)
      


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110514/new/

https://reviews.llvm.org/D110514



More information about the llvm-commits mailing list