[llvm-dev] Representing MIPS ABI information in the triple as ARM/X86 do for EABI/EABIHF/X32

Renato Golin via llvm-dev llvm-dev at lists.llvm.org
Fri Jun 24 04:07:48 PDT 2016

On 24 June 2016 at 11:02, Daniel Sanders via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> The approach I'm using is to encode the ABI information into the triple in the same way that ARM does for EABI and hardfloat, and the same way that X86 does for X32. These targets define variants of Triple::GNU for each of these ABI's in the form of the Triple::GNUEABI, Triple::GNUEABIHF, and Triple::GNUX32 values of the environment component of the triple and it's up to the frontend and/or API-user to pass the right thing to the backend.

Hi Daniel,

The precedent is there, so I don't think this should be a contentious issue.

> For MIPS, I'm defining Triple::GNUABI32, Triple::GNUABIN32, and Triple::GNUABI64. All three of these are supported by tools like binutils (by virtue of a wildcard match '*linux-gnu*') and of these three, Triple::GNUABI32 is not in general use, Triple::GNUABIN32 will be used by Debian if/when we do an N32 port, and Triple::GNUABI64 is currently used by Debian for our N64 port. Once the ABI is in our backend triples, it can be used by MipsMCAsmInfo to enable IAS by default for N64 without also enabling it for N32. In later patches, such as D1292 this same information will also be used to fix the N32 support for IAS.

This "should" work.

> In summary, human end users of tools such as clang will continue using the same triples as they always have. These tools will then resolve them down to the effective triple (for example, in functions like clang's ComputeEffectiveClangTriple(), ComputeLLVMTriple(), and computeTargetTriple()). The MIPS backend will only see the triples that have a specific known ABI. I'd like to stress that this process is the same as the one we already use today for other options. For example 'x86_64-linux-gnu-clang -m32' transforms the triple with get32BitArchVariant() and passes 'i386-linux-gnu' to the backend.

We do similar, but not completely.

For instance, "-target arm-linux-gnueabi -mthumb -mfloat-abi=hard
-mcpu=cortex=a15" will change the triple to "thumbv7--linux-gnueabi"
not the expected "thumbv7--linux-gnueabihf".

Though, that's probably a bug. :)


More information about the llvm-dev mailing list