Change default target architecture from Mips1 to Mips32r1 in preparation for
[oota-llvm.git] / lib / Target / Mips / MipsSubtarget.cpp
1 //===- MipsSubtarget.cpp - Mips Subtarget Information -----------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements the Mips specific subclass of TargetSubtargetInfo.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "MipsSubtarget.h"
15 #include "Mips.h"
16 #include "llvm/Support/TargetRegistry.h"
17
18 #define GET_SUBTARGETINFO_TARGET_DESC
19 #define GET_SUBTARGETINFO_CTOR
20 #include "MipsGenSubtargetInfo.inc"
21
22 using namespace llvm;
23
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(Mips1), MipsABI(O32), IsLittle(little), IsSingleFloat(false),
28   IsFP64bit(false), IsGP64bit(false), HasVFPU(false), IsLinux(true),
29   HasSEInReg(false), HasCondMov(false), HasMulDivAdd(false), HasMinMax(false),
30   HasSwap(false), HasBitCount(false)
31 {
32   std::string CPUName = CPU;
33   if (CPUName.empty())
34     CPUName = "mips32r1";
35
36   // Parse features string.
37   ParseSubtargetFeatures(CPUName, FS);
38
39   // Initialize scheduling itinerary for the specified CPU.
40   InstrItins = getInstrItineraryForCPU(CPUName);
41
42   // Is the target system Linux ?
43   if (TT.find("linux") == std::string::npos)
44     IsLinux = false;
45
46   // When only the target triple is specified and is
47   // a allegrex target, set the features. We also match
48   // big and little endian allegrex cores (dont really
49   // know if a big one exists)
50   if (TT.find("mipsallegrex") != std::string::npos ||
51       TT.find("psp") != std::string::npos) {
52     MipsABI = EABI;
53     IsSingleFloat = true;
54     MipsArchVersion = Mips2;
55     HasVFPU = true; // Enables Allegrex Vector FPU (not supported yet)
56     HasSEInReg = true;
57     HasBitCount = true;
58     HasSwap = true;
59     HasCondMov = true;
60   }
61 }