1 //===-- MipsSubtarget.cpp - Mips Subtarget Information --------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements the Mips specific subclass of TargetSubtargetInfo.
12 //===----------------------------------------------------------------------===//
14 #include "MipsSubtarget.h"
16 #include "llvm/Support/TargetRegistry.h"
18 #define GET_SUBTARGETINFO_TARGET_DESC
19 #define GET_SUBTARGETINFO_CTOR
20 #include "MipsGenSubtargetInfo.inc"
24 void MipsSubtarget::anchor() { }
26 MipsSubtarget::MipsSubtarget(const std::string &TT, const std::string &CPU,
27 const std::string &FS, bool little) :
28 MipsGenSubtargetInfo(TT, CPU, FS),
29 MipsArchVersion(Mips32), MipsABI(UnknownABI), IsLittle(little),
30 IsSingleFloat(false), IsFP64bit(false), IsGP64bit(false), HasVFPU(false),
31 IsLinux(true), HasSEInReg(false), HasCondMov(false), HasMulDivAdd(false),
32 HasMinMax(false), HasSwap(false), HasBitCount(false)
34 std::string CPUName = CPU;
38 // Parse features string.
39 ParseSubtargetFeatures(CPUName, FS);
41 // Initialize scheduling itinerary for the specified CPU.
42 InstrItins = getInstrItineraryForCPU(CPUName);
44 // Set MipsABI if it hasn't been set yet.
45 if (MipsABI == UnknownABI)
46 MipsABI = hasMips64() ? N64 : O32;
48 // Check if Architecture and ABI are compatible.
49 assert(((!hasMips64() && (isABI_O32() || isABI_EABI())) ||
50 (hasMips64() && (isABI_N32() || isABI_N64()))) &&
51 "Invalid Arch & ABI pair.");
53 // Is the target system Linux ?
54 if (TT.find("linux") == std::string::npos)