1 //===-- MipsSubtarget.h - Define Subtarget for the Mips ---------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares the Mips specific subclass of TargetSubtargetInfo.
12 //===----------------------------------------------------------------------===//
14 #ifndef MIPSSUBTARGET_H
15 #define MIPSSUBTARGET_H
17 #include "llvm/Target/TargetSubtargetInfo.h"
18 #include "llvm/MC/MCInstrItineraries.h"
21 #define GET_SUBTARGETINFO_HEADER
22 #include "MipsGenSubtargetInfo.inc"
27 class MipsSubtarget : public MipsGenSubtargetInfo {
28 virtual void anchor();
31 // NOTE: O64 will not be supported.
33 UnknownABI, O32, N32, N64, EABI
39 Mips32, Mips32r2, Mips64, Mips64r2
42 // Mips architecture version
43 MipsArchEnum MipsArchVersion;
45 // Mips supported ABIs
48 // IsLittle - The target is Little Endian
51 // IsSingleFloat - The target only supports single precision float
52 // point operations. This enable the target to use all 32 32-bit
53 // floating point registers instead of only using even ones.
56 // IsFP64bit - The target processor has 64-bit floating point registers.
59 // IsFP64bit - General-purpose registers are 64 bits wide
62 // HasVFPU - Processor has a vector floating point unit.
65 // isLinux - Target system is Linux. Is false we consider ELFOS for now.
68 /// Features related to the presence of specific instructions.
70 // HasSEInReg - SEB and SEH (signext in register) instructions.
73 // HasCondMov - Conditional mov (MOVZ, MOVN) instructions.
76 // HasMulDivAdd - Multiply add and sub (MADD, MADDu, MSUB, MSUBu)
80 // HasMinMax - MIN and MAX instructions.
83 // HasSwap - Byte and half swap instructions.
86 // HasBitCount - Count leading '1' and '0' bits.
89 // InMips16 -- can process Mips16 instructions
92 // IsAndroid -- target is android
95 InstrItineraryData InstrItins;
98 virtual bool enablePostRAScheduler(CodeGenOpt::Level OptLevel,
99 AntiDepBreakMode& Mode,
100 RegClassVector& CriticalPathRCs) const;
102 /// Only O32 and EABI supported right now.
103 bool isABI_EABI() const { return MipsABI == EABI; }
104 bool isABI_N64() const { return MipsABI == N64; }
105 bool isABI_N32() const { return MipsABI == N32; }
106 bool isABI_O32() const { return MipsABI == O32; }
107 unsigned getTargetABI() const { return MipsABI; }
109 /// This constructor initializes the data members to match that
110 /// of the specified triple.
111 MipsSubtarget(const std::string &TT, const std::string &CPU,
112 const std::string &FS, bool little);
114 /// ParseSubtargetFeatures - Parses features string setting specified
115 /// subtarget options. Definition of function is auto generated by tblgen.
116 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
118 bool hasMips32() const { return MipsArchVersion >= Mips32; }
119 bool hasMips32r2() const { return MipsArchVersion == Mips32r2 ||
120 MipsArchVersion == Mips64r2; }
121 bool hasMips64() const { return MipsArchVersion >= Mips64; }
122 bool hasMips64r2() const { return MipsArchVersion == Mips64r2; }
124 bool hasMips32r2Or64() const { return hasMips32r2() || hasMips64(); }
126 bool isLittle() const { return IsLittle; }
127 bool isFP64bit() const { return IsFP64bit; }
128 bool isGP64bit() const { return IsGP64bit; }
129 bool isGP32bit() const { return !IsGP64bit; }
130 bool isSingleFloat() const { return IsSingleFloat; }
131 bool isNotSingleFloat() const { return !IsSingleFloat; }
132 bool hasVFPU() const { return HasVFPU; }
133 bool inMips16Mode() const { return InMips16Mode; }
134 bool isAndroid() const { return IsAndroid; }
135 bool isLinux() const { return IsLinux; }
137 bool hasStandardEncoding() const { return !inMips16Mode(); }
139 /// Features related to the presence of specific instructions.
140 bool hasSEInReg() const { return HasSEInReg; }
141 bool hasCondMov() const { return HasCondMov; }
142 bool hasMulDivAdd() const { return HasMulDivAdd; }
143 bool hasMinMax() const { return HasMinMax; }
144 bool hasSwap() const { return HasSwap; }
145 bool hasBitCount() const { return HasBitCount; }
147 } // End llvm namespace