Eliminate asm parser's dependency on TargetMachine:
[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
17 #define GET_SUBTARGETINFO_ENUM
18 #define GET_SUBTARGETINFO_MC_DESC
19 #define GET_SUBTARGETINFO_TARGET_DESC
20 #define GET_SUBTARGETINFO_CTOR
21 #include "MipsGenSubtargetInfo.inc"
22
23 using namespace llvm;
24
25 MipsSubtarget::MipsSubtarget(const std::string &TT, const std::string &CPU,
26                              const std::string &FS, bool little) :
27   MipsGenSubtargetInfo(TT, CPU, FS),
28   MipsArchVersion(Mips1), MipsABI(O32), IsLittle(little), IsSingleFloat(false),
29   IsFP64bit(false), IsGP64bit(false), HasVFPU(false), IsLinux(true),
30   HasSEInReg(false), HasCondMov(false), HasMulDivAdd(false), HasMinMax(false),
31   HasSwap(false), HasBitCount(false)
32 {
33   std::string CPUName = CPU;
34   if (CPUName.empty())
35     CPUName = "mips1";
36   MipsArchVersion = Mips1;
37
38   // Parse features string.
39   ParseSubtargetFeatures(CPUName, FS);
40
41   // Initialize scheduling itinerary for the specified CPU.
42   InstrItins = getInstrItineraryForCPU(CPUName);
43
44   // Is the target system Linux ?
45   if (TT.find("linux") == std::string::npos)
46     IsLinux = false;
47
48   // When only the target triple is specified and is
49   // a allegrex target, set the features. We also match
50   // big and little endian allegrex cores (dont really
51   // know if a big one exists)
52   if (TT.find("mipsallegrex") != std::string::npos ||
53       TT.find("psp") != std::string::npos) {
54     MipsABI = EABI;
55     IsSingleFloat = true;
56     MipsArchVersion = Mips2;
57     HasVFPU = true; // Enables Allegrex Vector FPU (not supported yet)
58     HasSEInReg = true;
59     HasBitCount = true;
60     HasSwap = true;
61     HasCondMov = true;
62   }
63 }