LLVM API Documentation

MipsSubtarget.h

Go to the documentation of this file.
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 
00024 class MipsSubtarget : public TargetSubtarget {
00025 
00026 public:
00027   enum MipsABIEnum {
00028     O32, O64, N32, N64, EABI
00029   }; 
00030 
00031 protected:
00032 
00033   enum MipsArchEnum {
00034     Mips1, Mips2, Mips3, Mips4, Mips32, Mips32r2, Mips64, Mips64r2
00035   };
00036 
00037   // Mips architecture version 
00038   MipsArchEnum MipsArchVersion;
00039 
00040   // Mips supported ABIs 
00041   MipsABIEnum MipsABI;
00042 
00043   // IsLittle - The target is Little Endian
00044   bool IsLittle;
00045 
00046   // IsSingleFloat - The target only supports single precision float
00047   // point operations. This enable the target to use all 32 32-bit
00048   // floating point registers instead of only using even ones.
00049   bool IsSingleFloat;
00050 
00051   // IsFP64bit - The target processor has 64-bit floating point registers.
00052   bool IsFP64bit;
00053 
00054   // IsFP64bit - General-purpose registers are 64 bits wide
00055   bool IsGP64bit;
00056 
00057   // HasVFPU - Processor has a vector floating point unit.
00058   bool HasVFPU;
00059 
00060   // isLinux - Target system is Linux. Is false we consider ELFOS for now.
00061   bool IsLinux;
00062 
00063   /// Features related to the presence of specific instructions.
00064   
00065   // HasSEInReg - SEB and SEH (signext in register) instructions.
00066   bool HasSEInReg;
00067 
00068   // HasCondMov - Conditional mov (MOVZ, MOVN) instructions.
00069   bool HasCondMov;
00070 
00071   // HasMulDivAdd - Multiply add and sub (MADD, MADDu, MSUB, MSUBu) 
00072   // instructions.
00073   bool HasMulDivAdd;
00074 
00075   // HasMinMax - MIN and MAX instructions.
00076   bool HasMinMax;
00077 
00078   // HasSwap - Byte and half swap instructions.
00079   bool HasSwap;
00080 
00081   // HasBitCount - Count leading '1' and '0' bits.
00082   bool HasBitCount;
00083 
00084   InstrItineraryData InstrItins;
00085 
00086 public:
00087 
00088   /// Only O32 and EABI supported right now.
00089   bool isABI_EABI() const { return MipsABI == EABI; }
00090   bool isABI_O32() const { return MipsABI == O32; }
00091   unsigned getTargetABI() const { return MipsABI; }
00092 
00093   /// This constructor initializes the data members to match that
00094   /// of the specified triple.
00095   MipsSubtarget(const std::string &TT, const std::string &FS, bool little);
00096   
00097   /// ParseSubtargetFeatures - Parses features string setting specified 
00098   /// subtarget options.  Definition of function is auto generated by tblgen.
00099   std::string ParseSubtargetFeatures(const std::string &FS,
00100                                      const std::string &CPU);
00101 
00102   bool isMips1() const { return MipsArchVersion == Mips1; }
00103 
00104   bool isLittle() const { return IsLittle; }
00105   bool isFP64bit() const { return IsFP64bit; };
00106   bool isGP64bit() const { return IsGP64bit; };
00107   bool isGP32bit() const { return !IsGP64bit; };
00108   bool isSingleFloat() const { return IsSingleFloat; };
00109   bool isNotSingleFloat() const { return !IsSingleFloat; };
00110   bool hasVFPU() const { return HasVFPU; };
00111   bool isLinux() const { return IsLinux; };
00112 
00113   /// Features related to the presence of specific instructions.
00114   bool hasSEInReg()   const { return HasSEInReg; };
00115   bool hasCondMov()   const { return HasCondMov; };
00116   bool hasMulDivAdd() const { return HasMulDivAdd; };
00117   bool hasMinMax()    const { return HasMinMax; };
00118   bool hasSwap()      const { return HasSwap; };
00119   bool hasBitCount()  const { return HasBitCount; };
00120 };
00121 } // End llvm namespace
00122 
00123 #endif