1 //===- MipsSubtarget.cpp - Mips Subtarget Information -----------*- C++ -*-===//
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 MipsSubtarget::MipsSubtarget(const std::string &TT, const std::string &CPU,
25 const std::string &FS, bool little) :
26 MipsGenSubtargetInfo(TT, CPU, FS),
27 MipsArchVersion(Mips32), MipsABI(UnknownABI), IsLittle(little),
28 IsSingleFloat(false), IsFP64bit(false), IsGP64bit(false), HasVFPU(false),
29 IsLinux(true), HasSEInReg(false), HasCondMov(false), HasMulDivAdd(false),
30 HasMinMax(false), HasSwap(false), HasBitCount(false)
32 std::string CPUName = CPU;
36 // Parse features string.
37 ParseSubtargetFeatures(CPUName, FS);
39 // Initialize scheduling itinerary for the specified CPU.
40 InstrItins = getInstrItineraryForCPU(CPUName);
42 // Set MipsABI if it hasn't been set yet.
43 if (MipsABI == UnknownABI)
44 MipsABI = hasMips64() ? N64 : O32;
46 // Check if Architecture and ABI are compatible.
47 assert(((!hasMips64() && (isABI_O32() || isABI_EABI())) ||
48 (hasMips64() && (isABI_N32() || isABI_N64()))) &&
49 "Invalid Arch & ABI pair.");
51 // Is the target system Linux ?
52 if (TT.find("linux") == std::string::npos)