From: Akira Hatanaka Date: Wed, 21 Sep 2011 02:45:29 +0000 (+0000) Subject: Set ABI if it hasn't been set on the command line. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8c1b4bf0669738ce96be541c3a08c0d9ff6dab91;p=oota-llvm.git 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 --- diff --git a/lib/Target/Mips/MipsSubtarget.cpp b/lib/Target/Mips/MipsSubtarget.cpp index 3bb501176a8..5c8823eb3f2 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; diff --git a/lib/Target/Mips/MipsSubtarget.h b/lib/Target/Mips/MipsSubtarget.h index c6b43a7bccf..d9dddad23a4 100644 --- a/lib/Target/Mips/MipsSubtarget.h +++ b/lib/Target/Mips/MipsSubtarget.h @@ -29,7 +29,7 @@ class MipsSubtarget : public MipsGenSubtargetInfo { public: // NOTE: O64 will not be supported. enum MipsABIEnum { - O32, N32, N64, EABI + UnknownABI, O32, N32, N64, EABI }; protected: