blob: a0cb71ee6d6d8efeb53a637b3d2e958b45b1c8f5 [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//
Evan Cheng5b1b44892011-07-01 21:01:15 +000010// This file implements the Mips specific subclass of TargetSubtargetInfo.
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000011//
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
Evan Chengebdeeab2011-07-08 01:53:10 +000017#define GET_SUBTARGETINFO_ENUM
Evan Cheng94214702011-07-01 20:45:01 +000018#define GET_SUBTARGETINFO_MC_DESC
19#define GET_SUBTARGETINFO_TARGET_DESC
Evan Chengebdeeab2011-07-08 01:53:10 +000020#define GET_SUBTARGETINFO_CTOR
Evan Cheng385e9302011-07-01 22:36:09 +000021#include "MipsGenSubtargetInfo.inc"
Evan Cheng94214702011-07-01 20:45:01 +000022
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000023using namespace llvm;
24
Evan Cheng276365d2011-06-30 01:53:36 +000025MipsSubtarget::MipsSubtarget(const std::string &TT, const std::string &CPU,
26 const std::string &FS, bool little) :
Evan Cheng0ddff1b2011-07-07 07:07:08 +000027 MipsGenSubtargetInfo(TT, CPU, FS),
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000028 MipsArchVersion(Mips1), MipsABI(O32), IsLittle(little), IsSingleFloat(false),
Eli Friedmane2c74082009-08-03 02:22:28 +000029 IsFP64bit(false), IsGP64bit(false), HasVFPU(false), IsLinux(true),
30 HasSEInReg(false), HasCondMov(false), HasMulDivAdd(false), HasMinMax(false),
31 HasSwap(false), HasBitCount(false)
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000032{
Evan Cheng276365d2011-06-30 01:53:36 +000033 std::string CPUName = CPU;
34 if (CPUName.empty())
35 CPUName = "mips1";
Bruno Cardoso Lopesd3bdf192009-05-27 17:23:44 +000036 MipsArchVersion = Mips1;
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000037
38 // Parse features string.
Evan Cheng0ddff1b2011-07-07 07:07:08 +000039 ParseSubtargetFeatures(CPUName, FS);
Bruno Cardoso Lopes43d526d2008-07-14 14:42:54 +000040
Evan Cheng94214702011-07-01 20:45:01 +000041 // Initialize scheduling itinerary for the specified CPU.
42 InstrItins = getInstrItineraryForCPU(CPUName);
43
Bruno Cardoso Lopes43d526d2008-07-14 14:42:54 +000044 // Is the target system Linux ?
45 if (TT.find("linux") == std::string::npos)
46 IsLinux = false;
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000047
Bruno Cardoso Lopes81092dc2011-03-04 17:51:39 +000048 // When only the target triple is specified and is
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000049 // 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)
Bruno Cardoso Lopesf131fa22008-08-08 04:49:42 +000052 if (TT.find("mipsallegrex") != std::string::npos ||
53 TT.find("psp") != std::string::npos) {
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000054 MipsABI = EABI;
55 IsSingleFloat = true;
56 MipsArchVersion = Mips2;
Bruno Cardoso Lopes7728f7e2008-07-09 05:32:22 +000057 HasVFPU = true; // Enables Allegrex Vector FPU (not supported yet)
58 HasSEInReg = true;
Bruno Cardoso Lopes65ad4522008-08-08 06:16:31 +000059 HasBitCount = true;
Bruno Cardoso Lopes739e4412008-08-13 07:13:40 +000060 HasSwap = true;
61 HasCondMov = true;
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000062 }
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000063}