blob: 956fe91754914f34fe5b194b480aeb8310be7b58 [file] [log] [blame]
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +00001//===- MipsSubtarget.cpp - Mips Subtarget Information -----------*- C++ -*-===//
2//
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//
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"
Bruno Cardoso Lopes43d526d2008-07-14 14:42:54 +000017#include "llvm/Support/CommandLine.h"
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000018using namespace llvm;
19
Chris Lattnere3736f82009-08-13 05:41:27 +000020static cl::opt<unsigned>
21SSThreshold("mips-ssection-threshold", cl::Hidden,
22 cl::desc("Small data and bss section threshold size (default=8)"),
23 cl::init(8));
24
Eli Friedmane2c74082009-08-03 02:22:28 +000025MipsSubtarget::MipsSubtarget(const std::string &TT, const std::string &FS,
26 bool little) :
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{
Bruno Cardoso Lopes000604a2007-11-06 03:15:20 +000032 std::string CPU = "mips1";
Bruno Cardoso Lopesd3bdf192009-05-27 17:23:44 +000033 MipsArchVersion = Mips1;
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000034
35 // Parse features string.
36 ParseSubtargetFeatures(FS, CPU);
Bruno Cardoso Lopes43d526d2008-07-14 14:42:54 +000037
Chris Lattnere3736f82009-08-13 05:41:27 +000038 // Small section size threshold
39 SSectionThreshold = SSThreshold;
40
Bruno Cardoso Lopes43d526d2008-07-14 14:42:54 +000041 // Is the target system Linux ?
42 if (TT.find("linux") == std::string::npos)
43 IsLinux = false;
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000044
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)
Bruno Cardoso Lopesf131fa22008-08-08 04:49:42 +000049 if (TT.find("mipsallegrex") != std::string::npos ||
50 TT.find("psp") != std::string::npos) {
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000051 MipsABI = EABI;
52 IsSingleFloat = true;
53 MipsArchVersion = Mips2;
Bruno Cardoso Lopes7728f7e2008-07-09 05:32:22 +000054 HasVFPU = true; // Enables Allegrex Vector FPU (not supported yet)
55 HasSEInReg = true;
Bruno Cardoso Lopes65ad4522008-08-08 06:16:31 +000056 HasBitCount = true;
Bruno Cardoso Lopes739e4412008-08-13 07:13:40 +000057 HasSwap = true;
58 HasCondMov = true;
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000059 }
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000060}