[MIPS] Fix switching between 32/64-bit variants of r6 target triples
authorYunQiang Su <wzssyqa@gmail.com>
Thu, 21 Oct 2021 07:46:22 +0000 (10:46 +0300)
committerSimon Atanasyan <simon@atanasyan.com>
Thu, 21 Oct 2021 12:04:07 +0000 (15:04 +0300)
commit302a165e18fda8318e9e1ce6f452a48925cb3857
tree5d0cf65deae80580a82be57d4c738671d6157b53
parent9bfe7af1597661b5ff5102605b65ff288071a394
[MIPS] Fix switching between 32/64-bit variants of r6 target triples

If clang driver gets 64-bit r6 target triple like `mipsisa64r6` and
additional option forces switching to generation of 32-bit code, it
loses r6 abi and generates 32-bit r2-r5 abi code.

```
$ clang -target mipsisa64r6-linux-gnu -mabi=32
```

This patch fixes the problem.

- Add optional `SubArchType` argument to the `Triple::setArch()` method.
- Implement generation of mips r6 target triples in the
  `Triple::getArchName()` method.

Differential Revision: https://reviews.llvm.org/D110514.diff
llvm/include/llvm/ADT/Triple.h
llvm/lib/Support/Triple.cpp
llvm/unittests/ADT/TripleTest.cpp