#ifndef MIPSSUBTARGET_H
#define MIPSSUBTARGET_H
#include "MCTargetDesc/MipsReginfo.h"
#include "llvm/MC/MCInstrItineraries.h"
#include "llvm/Target/TargetSubtargetInfo.h"
#include <string>
#define GET_SUBTARGETINFO_HEADER
#include "MipsGenSubtargetInfo.inc"
namespace llvm {
class StringRef;
class MipsSubtarget : public MipsGenSubtargetInfo {
virtual void anchor();
public:
enum MipsABIEnum {
UnknownABI, O32, N32, N64, EABI
};
protected:
enum MipsArchEnum {
Mips32, Mips32r2, Mips64, Mips64r2
};
MipsArchEnum MipsArchVersion;
MipsABIEnum MipsABI;
bool IsLittle;
bool IsSingleFloat;
bool IsFP64bit;
bool IsGP64bit;
bool HasVFPU;
bool IsLinux;
bool UseSmallSection;
bool HasSEInReg;
bool HasCondMov;
bool HasSwap;
bool HasBitCount;
bool HasFPIdx;
bool InMips16Mode;
bool HasDSP, HasDSPR2;
bool IsAndroid;
InstrItineraryData InstrItins;
MipsReginfo MRI;
public:
virtual bool enablePostRAScheduler(CodeGenOpt::Level OptLevel,
AntiDepBreakMode& Mode,
RegClassVector& CriticalPathRCs) const;
bool isABI_EABI() const { return MipsABI == EABI; }
bool isABI_N64() const { return MipsABI == N64; }
bool isABI_N32() const { return MipsABI == N32; }
bool isABI_O32() const { return MipsABI == O32; }
unsigned getTargetABI() const { return MipsABI; }
MipsSubtarget(const std::string &TT, const std::string &CPU,
const std::string &FS, bool little, Reloc::Model RM);
void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
bool hasMips32() const { return MipsArchVersion >= Mips32; }
bool hasMips32r2() const { return MipsArchVersion == Mips32r2 ||
MipsArchVersion == Mips64r2; }
bool hasMips64() const { return MipsArchVersion >= Mips64; }
bool hasMips64r2() const { return MipsArchVersion == Mips64r2; }
bool isLittle() const { return IsLittle; }
bool isFP64bit() const { return IsFP64bit; }
bool isGP64bit() const { return IsGP64bit; }
bool isGP32bit() const { return !IsGP64bit; }
bool isSingleFloat() const { return IsSingleFloat; }
bool isNotSingleFloat() const { return !IsSingleFloat; }
bool hasVFPU() const { return HasVFPU; }
bool inMips16Mode() const { return InMips16Mode; }
bool hasDSP() const { return HasDSP; }
bool hasDSPR2() const { return HasDSPR2; }
bool isAndroid() const { return IsAndroid; }
bool isLinux() const { return IsLinux; }
bool useSmallSection() const { return UseSmallSection; }
bool hasStandardEncoding() const { return !inMips16Mode(); }
bool hasSEInReg() const { return HasSEInReg; }
bool hasCondMov() const { return HasCondMov; }
bool hasSwap() const { return HasSwap; }
bool hasBitCount() const { return HasBitCount; }
bool hasFPIdx() const { return HasFPIdx; }
const MipsReginfo &getMReginfo() const { return MRI; }
};
}
#endif