956fe91754914f34fe5b194b480aeb8310be7b58
[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 TargetSubtarget.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "MipsSubtarget.h"
15 #include "Mips.h"
16 #include "MipsGenSubtarget.inc"
17 #include "llvm/Support/CommandLine.h"
18 using namespace llvm;
19
20 static cl::opt<unsigned>
21 SSThreshold("mips-ssection-threshold", cl::Hidden,
22             cl::desc("Small data and bss section threshold size (default=8)"),
23             cl::init(8));
24
25 MipsSubtarget::MipsSubtarget(const std::string &TT, const std::string &FS,
26                              bool little) : 
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 CPU = "mips1";
33   MipsArchVersion = Mips1;
34
35   // Parse features string.
36   ParseSubtargetFeatures(FS, CPU);
37
38   // Small section size threshold
39   SSectionThreshold = SSThreshold;
40
41   // Is the target system Linux ?
42   if (TT.find("linux") == std::string::npos)
43     IsLinux = false;
44
45   // When only the target triple is specified and is 
46   // a allegrex target, set the features. We also match
47   // big and little endian allegrex cores (dont really
48   // know if a big one exists)
49   if (TT.find("mipsallegrex") != std::string::npos ||
50       TT.find("psp") != std::string::npos) {
51     MipsABI = EABI;
52     IsSingleFloat = true;
53     MipsArchVersion = Mips2;
54     HasVFPU = true; // Enables Allegrex Vector FPU (not supported yet)
55     HasSEInReg = true;
56     HasBitCount = true;
57     HasSwap = true;
58     HasCondMov = true;
59   }
60 }