2011-04-16 05:51:11 +08:00
|
|
|
//===- MipsSubtarget.cpp - Mips Subtarget Information -----------*- C++ -*-===//
|
2007-06-06 15:42:06 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 04:36:04 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2007-06-06 15:42:06 +08:00
|
|
|
//
|
2011-04-16 05:51:11 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 15:42:06 +08:00
|
|
|
//
|
2011-07-02 05:01:15 +08:00
|
|
|
// This file implements the Mips specific subclass of TargetSubtargetInfo.
|
2007-06-06 15:42:06 +08:00
|
|
|
//
|
2011-04-16 05:51:11 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 15:42:06 +08:00
|
|
|
|
|
|
|
#include "MipsSubtarget.h"
|
|
|
|
#include "Mips.h"
|
2011-08-25 02:08:43 +08:00
|
|
|
#include "llvm/Support/TargetRegistry.h"
|
2011-07-02 04:45:01 +08:00
|
|
|
|
|
|
|
#define GET_SUBTARGETINFO_TARGET_DESC
|
2011-07-08 09:53:10 +08:00
|
|
|
#define GET_SUBTARGETINFO_CTOR
|
2011-07-02 06:36:09 +08:00
|
|
|
#include "MipsGenSubtargetInfo.inc"
|
2011-07-02 04:45:01 +08:00
|
|
|
|
2007-06-06 15:42:06 +08:00
|
|
|
using namespace llvm;
|
|
|
|
|
2011-06-30 09:53:36 +08:00
|
|
|
MipsSubtarget::MipsSubtarget(const std::string &TT, const std::string &CPU,
|
|
|
|
const std::string &FS, bool little) :
|
2011-07-07 15:07:08 +08:00
|
|
|
MipsGenSubtargetInfo(TT, CPU, FS),
|
2011-09-22 01:31:45 +08:00
|
|
|
MipsArchVersion(Mips32), MipsABI(UnknownABI), IsLittle(little),
|
|
|
|
IsSingleFloat(false), IsFP64bit(false), IsGP64bit(false), HasVFPU(false),
|
|
|
|
IsLinux(true), HasSEInReg(false), HasCondMov(false), HasMulDivAdd(false),
|
|
|
|
HasMinMax(false), HasSwap(false), HasBitCount(false)
|
2007-06-06 15:42:06 +08:00
|
|
|
{
|
2011-06-30 09:53:36 +08:00
|
|
|
std::string CPUName = CPU;
|
|
|
|
if (CPUName.empty())
|
2011-11-30 07:08:41 +08:00
|
|
|
CPUName = "mips32";
|
2007-06-06 15:42:06 +08:00
|
|
|
|
|
|
|
// Parse features string.
|
2011-07-07 15:07:08 +08:00
|
|
|
ParseSubtargetFeatures(CPUName, FS);
|
2008-07-14 22:42:54 +08:00
|
|
|
|
2011-07-02 04:45:01 +08:00
|
|
|
// Initialize scheduling itinerary for the specified CPU.
|
|
|
|
InstrItins = getInstrItineraryForCPU(CPUName);
|
|
|
|
|
2011-09-21 10:45:29 +08:00
|
|
|
// Set MipsABI if it hasn't been set yet.
|
|
|
|
if (MipsABI == UnknownABI)
|
|
|
|
MipsABI = hasMips64() ? N64 : O32;
|
|
|
|
|
|
|
|
// 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 22:42:54 +08:00
|
|
|
// Is the target system Linux ?
|
|
|
|
if (TT.find("linux") == std::string::npos)
|
|
|
|
IsLinux = false;
|
2007-06-06 15:42:06 +08:00
|
|
|
}
|