The primary aim of this patch (and the clang counterpart) is to make it possible
to enable IAS by default for the N64 ABI (which is almost ready for it) without
also enabling it for the N32 ABI (which is definitely not ready). The same
change also lays the necessary ground work for fixing the N32 support such as
picking the right ELFCLASS and relocation encoding (N32 doesn't support the
3-relocs-in-1 encoding that N64 has).
The overall approach is to move away from the MCTargetOptions::ABIName way of
specifying the ABI (which until fairly recently was only in use by MIPS) and
move to specifying the ABI in the triple like other targets. Clang and API
users will then be required to specify the correct triple for the ABI they wish
to target.
In more detail:
Added the following environment values to llvm::Triple to explicitly
specify the ABI as part of the environment component of the triple:
- ABI32, ABIN32, ABI64
- AndroidABI32, AndroidABI64
- GNUABI32, GNUABIN32, GNUABI64
ABI32/AndroidABI32/GNUABI32 are used internally to distinguish between the case
where O32 has been specified, and the case where the default ABI is implied.
This matters for triples such as mips64-linux-gnu where the default ABI is
context sensitive and could be any of the three main ABI's depending on
the environment. It is unlikely that these 'ABI32' suffixes will be seen in
GNU Triples.
In this patch, the MIPS backend will accept ABI's through either
MCTargetOptions::ABIName or the triple. A subsequent patch will restrict
this so that the MIPS backend only accepts ABI information from the triple
to avoid the potential for confusion caused by mismatches between the
triple and MCTargetOptions. At that point a corresponding clang patch will
be required to ensure proper usage and C++ API users who pass non-empty ABI
names will need to add something like:
Triple ABITriple = TT.getABIVariant(ABIName) if (ABITriple.getArch() != Triple::UnknownArch) { TT = ABITriple; ABIName = "" }
to their code. C-API users will be unaffected by this requirement since they
are currently unable to specify the ABI.
The test changes are as follows:
test/CodeGen/Mips/fp16-promote.ll
Changed gnueabi to gnu in the triple. EABI has been removed recently because it was untested and had bitrotted.
test/MC/Mips/cpsetup.s
Made the OS component of the triple known since getABIVariant() needs to know the OS to apply the ABI information to the triple.
test/MC/Mips/mips64-register-names-o32.s:
Switched daddiu's for addiu's since O32 prohibits the use of 64-bit GPRs.
See http://reviews.llvm.org/D20916 for an explanation as to why
MCTargetOptions::ABIName doesn't work for Mips.
Patch By: Daniel Sanders