blob: 96ff30ba4a23d919984a7383ad75e6f6a4edb5a9 [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 Lopes225ca9c2008-07-05 19:05:21 +000017#include "llvm/Module.h"
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000018using namespace llvm;
19
20MipsSubtarget::MipsSubtarget(const TargetMachine &TM, const Module &M,
Bruno Cardoso Lopesd2947ee2008-06-04 01:45:25 +000021 const std::string &FS, bool little) :
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000022 MipsArchVersion(Mips1), MipsABI(O32), IsLittle(little), IsSingleFloat(false),
Bruno Cardoso Lopes7728f7e2008-07-09 05:32:22 +000023 IsFP64bit(false), IsGP64bit(false), HasVFPU(false), HasSEInReg(false)
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000024{
Bruno Cardoso Lopes000604a2007-11-06 03:15:20 +000025 std::string CPU = "mips1";
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000026
27 // Parse features string.
28 ParseSubtargetFeatures(FS, CPU);
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000029
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;
Bruno Cardoso Lopes7728f7e2008-07-09 05:32:22 +000039 HasVFPU = true; // Enables Allegrex Vector FPU (not supported yet)
40 HasSEInReg = true;
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000041 }
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000042}