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 // HasSEInReg - Target has SEB and SEH (signext in register) instructions.
64 // IsABICall - Enable SRV4 code for SVR4-style dynamic objects
67 // HasAbsoluteCall - Enable code that is not fully position-independent.
68 // Only works with HasABICall enabled.
71 // isLinux - Target system is Linux. Is false we consider ELFOS for now.
74 // Put global and static items less than or equal to SSectionThreshold
75 // bytes into the small data or bss section. The default is 8.
76 unsigned SSectionThreshold;
78 InstrItineraryData InstrItins;
82 /// Only O32 and EABI supported right now.
83 bool isABI_EABI() const { return MipsABI == EABI; }
84 bool isABI_O32() const { return MipsABI == O32; }
85 unsigned getTargetABI() const { return MipsABI; }
87 /// This constructor initializes the data members to match that
88 /// of the specified module.
89 MipsSubtarget(const TargetMachine &TM, const Module &M,
90 const std::string &FS, bool little);
92 /// ParseSubtargetFeatures - Parses features string setting specified
93 /// subtarget options. Definition of function is auto generated by tblgen.
94 void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
96 bool hasMips2Ops() const { return MipsArchVersion >= Mips2; }
98 bool isLittle() const { return IsLittle; }
99 bool isFP64bit() const { return IsFP64bit; };
100 bool isGP64bit() const { return IsGP64bit; };
101 bool isGP32bit() const { return !IsGP64bit; };
102 bool isSingleFloat() const { return IsSingleFloat; };
103 bool isNotSingleFloat() const { return !IsSingleFloat; };
104 bool hasVFPU() const { return HasVFPU; };
105 bool hasSEInReg() const { return HasSEInReg; };
106 bool hasABICall() const { return HasABICall; };
107 bool hasAbsoluteCall() const { return HasAbsoluteCall; };
108 bool isLinux() const { return IsLinux; };
109 unsigned getSSectionThreshold() const { return SSectionThreshold; }
112 } // End llvm namespace