Several changes to Mips backend, experimental fp support being the most
[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/Module.h"
18 using namespace llvm;
19
20 MipsSubtarget::MipsSubtarget(const TargetMachine &TM, const Module &M, 
21                              const std::string &FS, bool little) : 
22   MipsArchVersion(Mips1), MipsABI(O32), IsLittle(little), IsSingleFloat(false),
23   IsFP64bit(false), IsGP64bit(false), HasAllegrexVFPU(false), IsAllegrex(false)
24 {
25   std::string CPU = "mips1";
26
27   // Parse features string.
28   ParseSubtargetFeatures(FS, CPU);
29
30   // When only the target triple is specified and is 
31   // a allegrex target, set the features. We also match
32   // big and little endian allegrex cores (dont really
33   // know if a big one exists)
34   const std::string& TT = M.getTargetTriple();
35   if (TT.find("mipsallegrex") != std::string::npos) {
36     MipsABI = EABI;
37     IsSingleFloat = true;
38     MipsArchVersion = Mips2;
39     HasAllegrexVFPU = true; // Enables Allegrex Vector FPU (not supported yet)
40     IsAllegrex = true;
41   }
42 }