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 TargetSubtarget.
12 //===----------------------------------------------------------------------===//
14 #ifndef MIPSSUBTARGET_H
15 #define MIPSSUBTARGET_H
17 #include "llvm/Target/TargetSubtarget.h"
18 #include "llvm/Target/TargetMachine.h"
25 class MipsSubtarget : public TargetSubtarget {
29 O32, O64, N32, N64, EABI
35 Mips1, Mips2, Mips3, Mips4, Mips32, Mips32r2, Mips64, Mips64r2
38 // Mips architecture version
39 MipsArchEnum MipsArchVersion;
41 // Mips supported ABIs
44 // IsLittle - The target is Little Endian
47 // IsSingleFloat - The target only supports single precision float
48 // point operations. This enable the target to use all 32 32-bit
49 // floating point registers instead of only using even ones.
52 // IsFP64bit - The target processor has 64-bit floating point registers.
55 // IsFP64bit - General-purpose registers are 64 bits wide
58 // HasVFPU - Processor has a vector floating point unit.
61 // IsABICall - Enable SRV4 code for SVR4-style dynamic objects
64 // HasAbsoluteCall - Enable code that is not fully position-independent.
65 // Only works with HasABICall enabled.
68 // isLinux - Target system is Linux. Is false we consider ELFOS for now.
71 /// Features related to the presence of specific instructions.
73 // HasSEInReg - SEB and SEH (signext in register) instructions.
76 // HasCondMov - Conditional mov (MOVZ, MOVN) instructions.
79 // HasMulDivAdd - Multiply add and sub (MADD, MADDu, MSUB, MSUBu)
83 // HasMinMax - MIN and MAX instructions.
86 // HasSwap - Byte and half swap instructions.
89 // HasBitCount - Count leading '1' and '0' bits.
92 InstrItineraryData InstrItins;
96 /// Only O32 and EABI supported right now.
97 bool isABI_EABI() const { return MipsABI == EABI; }
98 bool isABI_O32() const { return MipsABI == O32; }
99 unsigned getTargetABI() const { return MipsABI; }
101 /// This constructor initializes the data members to match that
102 /// of the specified module.
103 MipsSubtarget(const TargetMachine &TM, const Module &M,
104 const std::string &FS, bool little);
106 /// ParseSubtargetFeatures - Parses features string setting specified
107 /// subtarget options. Definition of function is auto generated by tblgen.
108 std::string ParseSubtargetFeatures(const std::string &FS,
109 const std::string &CPU);
111 bool isMips1() const { return MipsArchVersion == Mips1; }
113 bool isLittle() const { return IsLittle; }
114 bool isFP64bit() const { return IsFP64bit; };
115 bool isGP64bit() const { return IsGP64bit; };
116 bool isGP32bit() const { return !IsGP64bit; };
117 bool isSingleFloat() const { return IsSingleFloat; };
118 bool isNotSingleFloat() const { return !IsSingleFloat; };
119 bool hasVFPU() const { return HasVFPU; };
120 bool hasABICall() const { return HasABICall; };
121 bool hasAbsoluteCall() const { return HasAbsoluteCall; };
122 bool isLinux() const { return IsLinux; };
124 /// Features related to the presence of specific instructions.
125 bool hasSEInReg() const { return HasSEInReg; };
126 bool hasCondMov() const { return HasCondMov; };
127 bool hasMulDivAdd() const { return HasMulDivAdd; };
128 bool hasMinMax() const { return HasMinMax; };
129 bool hasSwap() const { return HasSwap; };
130 bool hasBitCount() const { return HasBitCount; };
132 } // End llvm namespace