1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

[Triple] Add isLittleEndian().

This allows us to query about the endianness without having to
look at DataLayout. The API will be used (and tested) in lld,
in order to find out the endianness of BitcodeFiles.

Briefly discussed with Rafael.

llvm-svn: 274090
This commit is contained in:
Davide Italiano 2016-06-29 01:56:27 +00:00
parent 4503ee726b
commit 5a9dae8e37
2 changed files with 9 additions and 0 deletions

View File

@ -676,6 +676,11 @@ public:
/// string then the triple's arch name is used.
StringRef getARMCPUForArch(StringRef Arch = StringRef()) const;
/// Tests whether the target triple is little endian.
///
/// \returns true if the triple is little endian, false otherwise.
bool isLittleEndian() const;
/// @}
/// @name Static helpers for IDs.
/// @{

View File

@ -1406,6 +1406,10 @@ Triple Triple::getLittleEndianArchVariant() const {
return T;
}
bool Triple::isLittleEndian() const {
return *this == getLittleEndianArchVariant();
}
StringRef Triple::getARMCPUForArch(StringRef MArch) const {
if (MArch.empty())
MArch = getArchName();