blob: db114da00d73420399c3a7ae162d9ef313fed34f [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001//===- MipsSubtarget.cpp - Mips Subtarget Information -----------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner081ce942007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007//
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"
17using namespace llvm;
18
Eli Friedman532ba1e2009-08-03 02:22:28 +000019MipsSubtarget::MipsSubtarget(const std::string &TT, const std::string &FS,
20 bool little) :
Bruno Cardoso Lopes4fb1f542008-07-05 19:05:21 +000021 MipsArchVersion(Mips1), MipsABI(O32), IsLittle(little), IsSingleFloat(false),
Eli Friedman532ba1e2009-08-03 02:22:28 +000022 IsFP64bit(false), IsGP64bit(false), HasVFPU(false), IsLinux(true),
23 HasSEInReg(false), HasCondMov(false), HasMulDivAdd(false), HasMinMax(false),
24 HasSwap(false), HasBitCount(false)
Dan Gohmanf17a25c2007-07-18 16:29:46 +000025{
Bruno Cardoso Lopes0ec193d2007-11-06 03:15:20 +000026 std::string CPU = "mips1";
Bruno Cardoso Lopes643c0402009-05-27 17:23:44 +000027 MipsArchVersion = Mips1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000028
29 // Parse features string.
30 ParseSubtargetFeatures(FS, CPU);
Bruno Cardoso Lopes29c15352008-07-14 14:42:54 +000031
32 // Is the target system Linux ?
33 if (TT.find("linux") == std::string::npos)
34 IsLinux = false;
Bruno Cardoso Lopes4fb1f542008-07-05 19:05:21 +000035
36 // When only the target triple is specified and is
37 // a allegrex target, set the features. We also match
38 // big and little endian allegrex cores (dont really
39 // know if a big one exists)
Bruno Cardoso Lopesb619af72008-08-08 04:49:42 +000040 if (TT.find("mipsallegrex") != std::string::npos ||
41 TT.find("psp") != std::string::npos) {
Bruno Cardoso Lopes4fb1f542008-07-05 19:05:21 +000042 MipsABI = EABI;
43 IsSingleFloat = true;
44 MipsArchVersion = Mips2;
Bruno Cardoso Lopesdfd657f2008-07-09 05:32:22 +000045 HasVFPU = true; // Enables Allegrex Vector FPU (not supported yet)
46 HasSEInReg = true;
Bruno Cardoso Lopesea4fc382008-08-08 06:16:31 +000047 HasBitCount = true;
Bruno Cardoso Lopes60f3e052008-08-13 07:13:40 +000048 HasSwap = true;
49 HasCondMov = true;
Bruno Cardoso Lopes4fb1f542008-07-05 19:05:21 +000050 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +000051}