2012-02-17 09:55:11 +01:00
|
|
|
//===-- MipsSubtarget.cpp - Mips Subtarget Information --------------------===//
|
2007-06-06 09:42:06 +02:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 21:36:04 +01:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2007-06-06 09:42:06 +02:00
|
|
|
//
|
2011-04-15 23:51:11 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 09:42:06 +02:00
|
|
|
//
|
2011-07-01 23:01:15 +02:00
|
|
|
// This file implements the Mips specific subclass of TargetSubtargetInfo.
|
2007-06-06 09:42:06 +02:00
|
|
|
//
|
2011-04-15 23:51:11 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 09:42:06 +02:00
|
|
|
|
|
|
|
#include "MipsSubtarget.h"
|
|
|
|
#include "Mips.h"
|
2012-03-28 02:24:17 +02:00
|
|
|
#include "MipsRegisterInfo.h"
|
2011-08-24 20:08:43 +02:00
|
|
|
#include "llvm/Support/TargetRegistry.h"
|
2011-07-01 22:45:01 +02:00
|
|
|
|
|
|
|
#define GET_SUBTARGETINFO_TARGET_DESC
|
2011-07-08 03:53:10 +02:00
|
|
|
#define GET_SUBTARGETINFO_CTOR
|
2011-07-02 00:36:09 +02:00
|
|
|
#include "MipsGenSubtargetInfo.inc"
|
2011-07-01 22:45:01 +02:00
|
|
|
|
2007-06-06 09:42:06 +02:00
|
|
|
using namespace llvm;
|
|
|
|
|
2011-12-20 03:50:00 +01:00
|
|
|
void MipsSubtarget::anchor() { }
|
|
|
|
|
2011-06-30 03:53:36 +02:00
|
|
|
MipsSubtarget::MipsSubtarget(const std::string &TT, const std::string &CPU,
|
2012-08-22 05:18:13 +02:00
|
|
|
const std::string &FS, bool little,
|
|
|
|
Reloc::Model RM) :
|
2011-07-07 09:07:08 +02:00
|
|
|
MipsGenSubtargetInfo(TT, CPU, FS),
|
2012-02-28 08:46:26 +01:00
|
|
|
MipsArchVersion(Mips32), MipsABI(UnknownABI), IsLittle(little),
|
2011-09-21 19:31:45 +02:00
|
|
|
IsSingleFloat(false), IsFP64bit(false), IsGP64bit(false), HasVFPU(false),
|
|
|
|
IsLinux(true), HasSEInReg(false), HasCondMov(false), HasMulDivAdd(false),
|
2012-09-26 01:07:11 +02:00
|
|
|
HasMinMax(false), HasSwap(false), HasBitCount(false), InMips16Mode(false),
|
|
|
|
HasDSP(false), HasDSPR2(false), IsAndroid(false)
|
2007-06-06 09:42:06 +02:00
|
|
|
{
|
2011-06-30 03:53:36 +02:00
|
|
|
std::string CPUName = CPU;
|
|
|
|
if (CPUName.empty())
|
2011-11-30 00:08:41 +01:00
|
|
|
CPUName = "mips32";
|
2007-06-06 09:42:06 +02:00
|
|
|
|
|
|
|
// Parse features string.
|
2011-07-07 09:07:08 +02:00
|
|
|
ParseSubtargetFeatures(CPUName, FS);
|
2008-07-14 16:42:54 +02:00
|
|
|
|
2011-07-01 22:45:01 +02:00
|
|
|
// Initialize scheduling itinerary for the specified CPU.
|
|
|
|
InstrItins = getInstrItineraryForCPU(CPUName);
|
|
|
|
|
2011-09-21 04:45:29 +02:00
|
|
|
// Set MipsABI if it hasn't been set yet.
|
|
|
|
if (MipsABI == UnknownABI)
|
2012-02-28 08:46:26 +01:00
|
|
|
MipsABI = hasMips64() ? N64 : O32;
|
2011-09-21 04:45:29 +02:00
|
|
|
|
|
|
|
// Check if Architecture and ABI are compatible.
|
|
|
|
assert(((!hasMips64() && (isABI_O32() || isABI_EABI())) ||
|
|
|
|
(hasMips64() && (isABI_N32() || isABI_N64()))) &&
|
|
|
|
"Invalid Arch & ABI pair.");
|
|
|
|
|
2008-07-14 16:42:54 +02:00
|
|
|
// Is the target system Linux ?
|
|
|
|
if (TT.find("linux") == std::string::npos)
|
|
|
|
IsLinux = false;
|
2012-08-22 05:18:13 +02:00
|
|
|
|
|
|
|
// Set UseSmallSection.
|
|
|
|
UseSmallSection = !IsLinux && (RM == Reloc::Static);
|
2007-06-06 09:42:06 +02:00
|
|
|
}
|
2012-03-28 02:24:17 +02:00
|
|
|
|
|
|
|
bool
|
|
|
|
MipsSubtarget::enablePostRAScheduler(CodeGenOpt::Level OptLevel,
|
2012-06-14 23:10:56 +02:00
|
|
|
TargetSubtargetInfo::AntiDepBreakMode &Mode,
|
|
|
|
RegClassVector &CriticalPathRCs) const {
|
2012-05-15 05:14:52 +02:00
|
|
|
Mode = TargetSubtargetInfo::ANTIDEP_NONE;
|
2012-03-28 02:24:17 +02:00
|
|
|
CriticalPathRCs.clear();
|
|
|
|
CriticalPathRCs.push_back(hasMips64() ?
|
|
|
|
&Mips::CPU64RegsRegClass : &Mips::CPURegsRegClass);
|
2012-03-28 02:52:23 +02:00
|
|
|
return OptLevel >= CodeGenOpt::Aggressive;
|
2012-03-28 02:24:17 +02:00
|
|
|
}
|