summaryrefslogtreecommitdiff
path: root/include/llvm/ADT/Triple.h
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2014-03-06 20:47:11 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2014-03-06 20:47:11 +0000
commit4eb048a6f1b9777d31d71684204deb1b39aa1795 (patch)
tree956cabeaa8603c93307b2cff38b51e12fa34af78 /include/llvm/ADT/Triple.h
parent5219b0f586e901b0aee7c927d97cf6d43f8fc49d (diff)
downloadllvm-4eb048a6f1b9777d31d71684204deb1b39aa1795.tar.gz
llvm-4eb048a6f1b9777d31d71684204deb1b39aa1795.tar.bz2
llvm-4eb048a6f1b9777d31d71684204deb1b39aa1795.tar.xz
Support: split object format out of environment
This is a preliminary setup change to support a renaming of Windows target triples. Split the object file format information out of the environment into a separate entity. Unfortunately, file format was previously treated as an environment with an unknown OS. This is most obvious in the ARM subtarget where the handling for macho on an arbitrary platform switches to AAPCS rather than APCS (as per Apple's needs). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203160 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/Triple.h')
-rw-r--r--include/llvm/ADT/Triple.h27
1 files changed, 20 insertions, 7 deletions
diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h
index 9238f5af7a..0eb0420f56 100644
--- a/include/llvm/ADT/Triple.h
+++ b/include/llvm/ADT/Triple.h
@@ -124,9 +124,14 @@ public:
CODE16,
EABI,
EABIHF,
- MachO,
Android,
- ELF
+ };
+ enum ObjectFormatType {
+ UnknownObjectFormat,
+
+ COFF,
+ ELF,
+ MachO,
};
private:
@@ -144,13 +149,16 @@ private:
/// The parsed Environment type.
EnvironmentType Environment;
+ /// The object format type.
+ ObjectFormatType ObjectFormat;
+
public:
/// @name Constructors
/// @{
/// \brief Default constructor is the same as an empty string and leaves all
/// triple fields unknown.
- Triple() : Data(), Arch(), Vendor(), OS(), Environment() {}
+ Triple() : Data(), Arch(), Vendor(), OS(), Environment(), ObjectFormat() {}
explicit Triple(const Twine &Str);
Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);
@@ -189,6 +197,9 @@ public:
/// getEnvironment - Get the parsed environment type of this triple.
EnvironmentType getEnvironment() const { return Environment; }
+ /// getFormat - Get the object format for this triple.
+ ObjectFormatType getObjectFormat() const { return ObjectFormat; }
+
/// getOSVersion - Parse the version number from the OS name component of the
/// triple, if present.
///
@@ -344,18 +355,17 @@ public:
/// \brief Tests whether the OS uses the ELF binary format.
bool isOSBinFormatELF() const {
- return !isOSBinFormatMachO() && !isOSBinFormatCOFF();
+ return getObjectFormat() == Triple::ELF;
}
/// \brief Tests whether the OS uses the COFF binary format.
bool isOSBinFormatCOFF() const {
- return getEnvironment() != Triple::ELF &&
- getEnvironment() != Triple::MachO && isOSWindows();
+ return getObjectFormat() == Triple::COFF;
}
/// \brief Tests whether the environment is MachO.
bool isOSBinFormatMachO() const {
- return getEnvironment() == Triple::MachO || isOSDarwin();
+ return getObjectFormat() == Triple::MachO;
}
/// @}
@@ -378,6 +388,9 @@ public:
/// to a known type.
void setEnvironment(EnvironmentType Kind);
+ /// setObjectFormat - Set the object file format
+ void setObjectFormat(ObjectFormatType Kind);
+
/// setTriple - Set all components to the new triple \p Str.
void setTriple(const Twine &Str);