blob: 9c69e0459d3444bec1ca43b8f4c1ee07d8036954 [file] [log] [blame]
Akira Hatanaka4552c9a2011-04-15 21:51:11 +00001//===- MipsSubtarget.cpp - Mips Subtarget Information -----------*- C++ -*-===//
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +00007//
Akira Hatanaka4552c9a2011-04-15 21:51:11 +00008//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +00009//
10// This file implements the Mips specific subclass of TargetSubtarget.
11//
Akira Hatanaka4552c9a2011-04-15 21:51:11 +000012//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000013
14#include "MipsSubtarget.h"
15#include "Mips.h"
Evan Cheng94214702011-07-01 20:45:01 +000016
17#define GET_SUBTARGETINFO_CTOR
18#define GET_SUBTARGETINFO_MC_DESC
19#define GET_SUBTARGETINFO_TARGET_DESC
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000020#include "MipsGenSubtarget.inc"
Evan Cheng94214702011-07-01 20:45:01 +000021
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000022using namespace llvm;
23
Evan Cheng276365d2011-06-30 01:53:36 +000024MipsSubtarget::MipsSubtarget(const std::string &TT, const std::string &CPU,
25 const std::string &FS, bool little) :
Evan Cheng94214702011-07-01 20:45:01 +000026 MipsGenSubtargetInfo(),
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000027 MipsArchVersion(Mips1), MipsABI(O32), IsLittle(little), IsSingleFloat(false),
Eli Friedmane2c74082009-08-03 02:22:28 +000028 IsFP64bit(false), IsGP64bit(false), HasVFPU(false), IsLinux(true),
29 HasSEInReg(false), HasCondMov(false), HasMulDivAdd(false), HasMinMax(false),
30 HasSwap(false), HasBitCount(false)
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000031{
Evan Cheng276365d2011-06-30 01:53:36 +000032 std::string CPUName = CPU;
33 if (CPUName.empty())
34 CPUName = "mips1";
Bruno Cardoso Lopesd3bdf192009-05-27 17:23:44 +000035 MipsArchVersion = Mips1;
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000036
37 // Parse features string.
Evan Cheng276365d2011-06-30 01:53:36 +000038 ParseSubtargetFeatures(FS, CPUName);
Bruno Cardoso Lopes43d526d2008-07-14 14:42:54 +000039
Evan Cheng94214702011-07-01 20:45:01 +000040 // Initialize scheduling itinerary for the specified CPU.
41 InstrItins = getInstrItineraryForCPU(CPUName);
42
Bruno Cardoso Lopes43d526d2008-07-14 14:42:54 +000043 // Is the target system Linux ?
44 if (TT.find("linux") == std::string::npos)
45 IsLinux = false;
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000046
Bruno Cardoso Lopes81092dc2011-03-04 17:51:39 +000047 // When only the target triple is specified and is
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000048 // a allegrex target, set the features. We also match
49 // big and little endian allegrex cores (dont really
50 // know if a big one exists)
Bruno Cardoso Lopesf131fa22008-08-08 04:49:42 +000051 if (TT.find("mipsallegrex") != std::string::npos ||
52 TT.find("psp") != std::string::npos) {
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000053 MipsABI = EABI;
54 IsSingleFloat = true;
55 MipsArchVersion = Mips2;
Bruno Cardoso Lopes7728f7e2008-07-09 05:32:22 +000056 HasVFPU = true; // Enables Allegrex Vector FPU (not supported yet)
57 HasSEInReg = true;
Bruno Cardoso Lopes65ad4522008-08-08 06:16:31 +000058 HasBitCount = true;
Bruno Cardoso Lopes739e4412008-08-13 07:13:40 +000059 HasSwap = true;
60 HasCondMov = true;
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000061 }
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000062}