LLVM API Documentation
00001 //=====-- MipsSubtarget.h - Define Subtarget for the Mips -----*- C++ -*--====// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file declares the Mips specific subclass of TargetSubtarget. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef MIPSSUBTARGET_H 00015 #define MIPSSUBTARGET_H 00016 00017 #include "llvm/Target/TargetSubtarget.h" 00018 #include "llvm/Target/TargetMachine.h" 00019 00020 #include <string> 00021 00022 namespace llvm { 00023 class Module; 00024 00025 class MipsSubtarget : public TargetSubtarget { 00026 00027 public: 00028 enum MipsABIEnum { 00029 O32, O64, N32, N64, EABI 00030 }; 00031 00032 protected: 00033 00034 enum MipsArchEnum { 00035 Mips1, Mips2, Mips3, Mips4, Mips32, Mips32r2, Mips64, Mips64r2 00036 }; 00037 00038 // Mips architecture version 00039 MipsArchEnum MipsArchVersion; 00040 00041 // Mips supported ABIs 00042 MipsABIEnum MipsABI; 00043 00044 // IsLittle - The target is Little Endian 00045 bool IsLittle; 00046 00047 // IsSingleFloat - The target only supports single precision float 00048 // point operations. This enable the target to use all 32 32-bit 00049 // floating point registers instead of only using even ones. 00050 bool IsSingleFloat; 00051 00052 // IsFP64bit - The target processor has 64-bit floating point registers. 00053 bool IsFP64bit; 00054 00055 // IsFP64bit - General-purpose registers are 64 bits wide 00056 bool IsGP64bit; 00057 00058 // HasVFPU - Processor has a vector floating point unit. 00059 bool HasVFPU; 00060 00061 // IsABICall - Enable SRV4 code for SVR4-style dynamic objects 00062 bool HasABICall; 00063 00064 // HasAbsoluteCall - Enable code that is not fully position-independent. 00065 // Only works with HasABICall enabled. 00066 bool HasAbsoluteCall; 00067 00068 // isLinux - Target system is Linux. Is false we consider ELFOS for now. 00069 bool IsLinux; 00070 00071 // Put global and static items less than or equal to SSectionThreshold 00072 // bytes into the small data or bss section. The default is 8. 00073 unsigned SSectionThreshold; 00074 00075 /// Features related to the presence of specific instructions. 00076 00077 // HasSEInReg - SEB and SEH (signext in register) instructions. 00078 bool HasSEInReg; 00079 00080 // HasCondMov - Conditional mov (MOVZ, MOVN) instructions. 00081 bool HasCondMov; 00082 00083 // HasMulDivAdd - Multiply add and sub (MADD, MADDu, MSUB, MSUBu) 00084 // instructions. 00085 bool HasMulDivAdd; 00086 00087 // HasMinMax - MIN and MAX instructions. 00088 bool HasMinMax; 00089 00090 // HasSwap - Byte and half swap instructions. 00091 bool HasSwap; 00092 00093 // HasBitCount - Count leading '1' and '0' bits. 00094 bool HasBitCount; 00095 00096 InstrItineraryData InstrItins; 00097 00098 public: 00099 00100 /// Only O32 and EABI supported right now. 00101 bool isABI_EABI() const { return MipsABI == EABI; } 00102 bool isABI_O32() const { return MipsABI == O32; } 00103 unsigned getTargetABI() const { return MipsABI; } 00104 00105 /// This constructor initializes the data members to match that 00106 /// of the specified module. 00107 MipsSubtarget(const TargetMachine &TM, const Module &M, 00108 const std::string &FS, bool little); 00109 00110 /// ParseSubtargetFeatures - Parses features string setting specified 00111 /// subtarget options. Definition of function is auto generated by tblgen. 00112 void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU); 00113 00114 bool hasMips2Ops() const { return MipsArchVersion >= Mips2; } 00115 00116 bool isLittle() const { return IsLittle; } 00117 bool isFP64bit() const { return IsFP64bit; }; 00118 bool isGP64bit() const { return IsGP64bit; }; 00119 bool isGP32bit() const { return !IsGP64bit; }; 00120 bool isSingleFloat() const { return IsSingleFloat; }; 00121 bool isNotSingleFloat() const { return !IsSingleFloat; }; 00122 bool hasVFPU() const { return HasVFPU; }; 00123 bool hasABICall() const { return HasABICall; }; 00124 bool hasAbsoluteCall() const { return HasAbsoluteCall; }; 00125 bool isLinux() const { return IsLinux; }; 00126 unsigned getSSectionThreshold() const { return SSectionThreshold; } 00127 00128 /// Features related to the presence of specific instructions. 00129 bool hasSEInReg() const { return HasSEInReg; }; 00130 bool hasCondMov() const { return HasCondMov; }; 00131 bool hasMulDivAdd() const { return HasMulDivAdd; }; 00132 bool hasMinMax() const { return HasMinMax; }; 00133 bool hasSwap() const { return HasSwap; }; 00134 bool hasBitCount() const { return HasBitCount; }; 00135 }; 00136 } // End llvm namespace 00137 00138 #endif
This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.