Akira Hatanaka | 4552c9a | 2011-04-15 21:51:11 +0000 | [diff] [blame] | 1 | //===- MipsSubtarget.cpp - Mips Subtarget Information -----------*- C++ -*-===// |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 7 | // |
Akira Hatanaka | 4552c9a | 2011-04-15 21:51:11 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 9 | // |
| 10 | // This file implements the Mips specific subclass of TargetSubtarget. |
| 11 | // |
Akira Hatanaka | 4552c9a | 2011-04-15 21:51:11 +0000 | [diff] [blame] | 12 | //===----------------------------------------------------------------------===// |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 13 | |
| 14 | #include "MipsSubtarget.h" |
| 15 | #include "Mips.h" |
Evan Cheng | 9421470 | 2011-07-01 20:45:01 +0000 | [diff] [blame^] | 16 | |
| 17 | #define GET_SUBTARGETINFO_CTOR |
| 18 | #define GET_SUBTARGETINFO_MC_DESC |
| 19 | #define GET_SUBTARGETINFO_TARGET_DESC |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 20 | #include "MipsGenSubtarget.inc" |
Evan Cheng | 9421470 | 2011-07-01 20:45:01 +0000 | [diff] [blame^] | 21 | |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 22 | using namespace llvm; |
| 23 | |
Evan Cheng | 276365d | 2011-06-30 01:53:36 +0000 | [diff] [blame] | 24 | MipsSubtarget::MipsSubtarget(const std::string &TT, const std::string &CPU, |
| 25 | const std::string &FS, bool little) : |
Evan Cheng | 9421470 | 2011-07-01 20:45:01 +0000 | [diff] [blame^] | 26 | MipsGenSubtargetInfo(), |
Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 27 | MipsArchVersion(Mips1), MipsABI(O32), IsLittle(little), IsSingleFloat(false), |
Eli Friedman | e2c7408 | 2009-08-03 02:22:28 +0000 | [diff] [blame] | 28 | IsFP64bit(false), IsGP64bit(false), HasVFPU(false), IsLinux(true), |
| 29 | HasSEInReg(false), HasCondMov(false), HasMulDivAdd(false), HasMinMax(false), |
| 30 | HasSwap(false), HasBitCount(false) |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 31 | { |
Evan Cheng | 276365d | 2011-06-30 01:53:36 +0000 | [diff] [blame] | 32 | std::string CPUName = CPU; |
| 33 | if (CPUName.empty()) |
| 34 | CPUName = "mips1"; |
Bruno Cardoso Lopes | d3bdf19 | 2009-05-27 17:23:44 +0000 | [diff] [blame] | 35 | MipsArchVersion = Mips1; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 36 | |
| 37 | // Parse features string. |
Evan Cheng | 276365d | 2011-06-30 01:53:36 +0000 | [diff] [blame] | 38 | ParseSubtargetFeatures(FS, CPUName); |
Bruno Cardoso Lopes | 43d526d | 2008-07-14 14:42:54 +0000 | [diff] [blame] | 39 | |
Evan Cheng | 9421470 | 2011-07-01 20:45:01 +0000 | [diff] [blame^] | 40 | // Initialize scheduling itinerary for the specified CPU. |
| 41 | InstrItins = getInstrItineraryForCPU(CPUName); |
| 42 | |
Bruno Cardoso Lopes | 43d526d | 2008-07-14 14:42:54 +0000 | [diff] [blame] | 43 | // Is the target system Linux ? |
| 44 | if (TT.find("linux") == std::string::npos) |
| 45 | IsLinux = false; |
Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 46 | |
Bruno Cardoso Lopes | 81092dc | 2011-03-04 17:51:39 +0000 | [diff] [blame] | 47 | // When only the target triple is specified and is |
Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 48 | // 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 Lopes | f131fa2 | 2008-08-08 04:49:42 +0000 | [diff] [blame] | 51 | if (TT.find("mipsallegrex") != std::string::npos || |
| 52 | TT.find("psp") != std::string::npos) { |
Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 53 | MipsABI = EABI; |
| 54 | IsSingleFloat = true; |
| 55 | MipsArchVersion = Mips2; |
Bruno Cardoso Lopes | 7728f7e | 2008-07-09 05:32:22 +0000 | [diff] [blame] | 56 | HasVFPU = true; // Enables Allegrex Vector FPU (not supported yet) |
| 57 | HasSEInReg = true; |
Bruno Cardoso Lopes | 65ad452 | 2008-08-08 06:16:31 +0000 | [diff] [blame] | 58 | HasBitCount = true; |
Bruno Cardoso Lopes | 739e441 | 2008-08-13 07:13:40 +0000 | [diff] [blame] | 59 | HasSwap = true; |
| 60 | HasCondMov = true; |
Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 61 | } |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 62 | } |