summaryrefslogtreecommitdiff
path: root/lib/Target/Mips/MipsSubtarget.cpp
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanak@gmail.com>2011-09-21 02:45:29 +0000
committerAkira Hatanaka <ahatanak@gmail.com>2011-09-21 02:45:29 +0000
commit8c1b4bf0669738ce96be541c3a08c0d9ff6dab91 (patch)
tree7f1d11fc8e37d19feb8802c35b4bcbfffd4fc8b2 /lib/Target/Mips/MipsSubtarget.cpp
parent50fa74e8d2f2ac15a60d008a78649b83e1615d8f (diff)
downloadllvm-8c1b4bf0669738ce96be541c3a08c0d9ff6dab91.tar.gz
llvm-8c1b4bf0669738ce96be541c3a08c0d9ff6dab91.tar.bz2
llvm-8c1b4bf0669738ce96be541c3a08c0d9ff6dab91.tar.xz
Set ABI if it hasn't been set on the command line.
Check if architecture & ABI combination is valid. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140230 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips/MipsSubtarget.cpp')
-rw-r--r--lib/Target/Mips/MipsSubtarget.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Target/Mips/MipsSubtarget.cpp b/lib/Target/Mips/MipsSubtarget.cpp
index 3bb501176a..5c8823eb3f 100644
--- a/lib/Target/Mips/MipsSubtarget.cpp
+++ b/lib/Target/Mips/MipsSubtarget.cpp
@@ -39,6 +39,15 @@ MipsSubtarget::MipsSubtarget(const std::string &TT, const std::string &CPU,
// Initialize scheduling itinerary for the specified CPU.
InstrItins = getInstrItineraryForCPU(CPUName);
+ // Set MipsABI if it hasn't been set yet.
+ if (MipsABI == UnknownABI)
+ MipsABI = hasMips64() ? N64 : O32;
+
+ // Check if Architecture and ABI are compatible.
+ assert(((!hasMips64() && (isABI_O32() || isABI_EABI())) ||
+ (hasMips64() && (isABI_N32() || isABI_N64()))) &&
+ "Invalid Arch & ABI pair.");
+
// Is the target system Linux ?
if (TT.find("linux") == std::string::npos)
IsLinux = false;