1*9880d681SAndroid Build Coastguard Worker //===-- SparcSubtarget.h - Define Subtarget for the SPARC -------*- C++ -*-===// 2*9880d681SAndroid Build Coastguard Worker // 3*9880d681SAndroid Build Coastguard Worker // The LLVM Compiler Infrastructure 4*9880d681SAndroid Build Coastguard Worker // 5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source 6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details. 7*9880d681SAndroid Build Coastguard Worker // 8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===// 9*9880d681SAndroid Build Coastguard Worker // 10*9880d681SAndroid Build Coastguard Worker // This file declares the SPARC specific subclass of TargetSubtargetInfo. 11*9880d681SAndroid Build Coastguard Worker // 12*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===// 13*9880d681SAndroid Build Coastguard Worker 14*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_LIB_TARGET_SPARC_SPARCSUBTARGET_H 15*9880d681SAndroid Build Coastguard Worker #define LLVM_LIB_TARGET_SPARC_SPARCSUBTARGET_H 16*9880d681SAndroid Build Coastguard Worker 17*9880d681SAndroid Build Coastguard Worker #include "SparcFrameLowering.h" 18*9880d681SAndroid Build Coastguard Worker #include "SparcISelLowering.h" 19*9880d681SAndroid Build Coastguard Worker #include "SparcInstrInfo.h" 20*9880d681SAndroid Build Coastguard Worker #include "llvm/CodeGen/SelectionDAGTargetInfo.h" 21*9880d681SAndroid Build Coastguard Worker #include "llvm/IR/DataLayout.h" 22*9880d681SAndroid Build Coastguard Worker #include "llvm/Target/TargetFrameLowering.h" 23*9880d681SAndroid Build Coastguard Worker #include "llvm/Target/TargetSubtargetInfo.h" 24*9880d681SAndroid Build Coastguard Worker #include <string> 25*9880d681SAndroid Build Coastguard Worker 26*9880d681SAndroid Build Coastguard Worker #define GET_SUBTARGETINFO_HEADER 27*9880d681SAndroid Build Coastguard Worker #include "SparcGenSubtargetInfo.inc" 28*9880d681SAndroid Build Coastguard Worker 29*9880d681SAndroid Build Coastguard Worker namespace llvm { 30*9880d681SAndroid Build Coastguard Worker class StringRef; 31*9880d681SAndroid Build Coastguard Worker 32*9880d681SAndroid Build Coastguard Worker class SparcSubtarget : public SparcGenSubtargetInfo { 33*9880d681SAndroid Build Coastguard Worker Triple TargetTriple; 34*9880d681SAndroid Build Coastguard Worker virtual void anchor(); 35*9880d681SAndroid Build Coastguard Worker bool IsV9; 36*9880d681SAndroid Build Coastguard Worker bool IsLeon; 37*9880d681SAndroid Build Coastguard Worker bool V8DeprecatedInsts; 38*9880d681SAndroid Build Coastguard Worker bool IsVIS, IsVIS2, IsVIS3; 39*9880d681SAndroid Build Coastguard Worker bool Is64Bit; 40*9880d681SAndroid Build Coastguard Worker bool HasHardQuad; 41*9880d681SAndroid Build Coastguard Worker bool UsePopc; 42*9880d681SAndroid Build Coastguard Worker bool UseSoftFloat; 43*9880d681SAndroid Build Coastguard Worker 44*9880d681SAndroid Build Coastguard Worker // LEON features 45*9880d681SAndroid Build Coastguard Worker bool HasUmacSmac; 46*9880d681SAndroid Build Coastguard Worker bool HasLeonCasa; 47*9880d681SAndroid Build Coastguard Worker bool InsertNOPLoad; 48*9880d681SAndroid Build Coastguard Worker bool FixFSMULD; 49*9880d681SAndroid Build Coastguard Worker bool ReplaceFMULS; 50*9880d681SAndroid Build Coastguard Worker bool FixAllFDIVSQRT; 51*9880d681SAndroid Build Coastguard Worker bool UseSoftFpu; 52*9880d681SAndroid Build Coastguard Worker bool PerformSDIVReplace; 53*9880d681SAndroid Build Coastguard Worker bool FixCallImmediates; 54*9880d681SAndroid Build Coastguard Worker bool IgnoreZeroFlag; 55*9880d681SAndroid Build Coastguard Worker bool InsertNOPDoublePrecision; 56*9880d681SAndroid Build Coastguard Worker bool PreventRoundChange; 57*9880d681SAndroid Build Coastguard Worker bool FlushCacheLineSWAP; 58*9880d681SAndroid Build Coastguard Worker bool InsertNOPsLoadStore; 59*9880d681SAndroid Build Coastguard Worker 60*9880d681SAndroid Build Coastguard Worker SparcInstrInfo InstrInfo; 61*9880d681SAndroid Build Coastguard Worker SparcTargetLowering TLInfo; 62*9880d681SAndroid Build Coastguard Worker SelectionDAGTargetInfo TSInfo; 63*9880d681SAndroid Build Coastguard Worker SparcFrameLowering FrameLowering; 64*9880d681SAndroid Build Coastguard Worker 65*9880d681SAndroid Build Coastguard Worker public: 66*9880d681SAndroid Build Coastguard Worker SparcSubtarget(const Triple &TT, const std::string &CPU, 67*9880d681SAndroid Build Coastguard Worker const std::string &FS, const TargetMachine &TM, bool is64bit); 68*9880d681SAndroid Build Coastguard Worker getInstrInfo()69*9880d681SAndroid Build Coastguard Worker const SparcInstrInfo *getInstrInfo() const override { return &InstrInfo; } getFrameLowering()70*9880d681SAndroid Build Coastguard Worker const TargetFrameLowering *getFrameLowering() const override { 71*9880d681SAndroid Build Coastguard Worker return &FrameLowering; 72*9880d681SAndroid Build Coastguard Worker } getRegisterInfo()73*9880d681SAndroid Build Coastguard Worker const SparcRegisterInfo *getRegisterInfo() const override { 74*9880d681SAndroid Build Coastguard Worker return &InstrInfo.getRegisterInfo(); 75*9880d681SAndroid Build Coastguard Worker } getTargetLowering()76*9880d681SAndroid Build Coastguard Worker const SparcTargetLowering *getTargetLowering() const override { 77*9880d681SAndroid Build Coastguard Worker return &TLInfo; 78*9880d681SAndroid Build Coastguard Worker } getSelectionDAGInfo()79*9880d681SAndroid Build Coastguard Worker const SelectionDAGTargetInfo *getSelectionDAGInfo() const override { 80*9880d681SAndroid Build Coastguard Worker return &TSInfo; 81*9880d681SAndroid Build Coastguard Worker } 82*9880d681SAndroid Build Coastguard Worker 83*9880d681SAndroid Build Coastguard Worker bool enableMachineScheduler() const override; 84*9880d681SAndroid Build Coastguard Worker isV9()85*9880d681SAndroid Build Coastguard Worker bool isV9() const { return IsV9; } isLeon()86*9880d681SAndroid Build Coastguard Worker bool isLeon() const { return IsLeon; } isVIS()87*9880d681SAndroid Build Coastguard Worker bool isVIS() const { return IsVIS; } isVIS2()88*9880d681SAndroid Build Coastguard Worker bool isVIS2() const { return IsVIS2; } isVIS3()89*9880d681SAndroid Build Coastguard Worker bool isVIS3() const { return IsVIS3; } useDeprecatedV8Instructions()90*9880d681SAndroid Build Coastguard Worker bool useDeprecatedV8Instructions() const { return V8DeprecatedInsts; } hasHardQuad()91*9880d681SAndroid Build Coastguard Worker bool hasHardQuad() const { return HasHardQuad; } usePopc()92*9880d681SAndroid Build Coastguard Worker bool usePopc() const { return UsePopc; } useSoftFloat()93*9880d681SAndroid Build Coastguard Worker bool useSoftFloat() const { return UseSoftFloat; } 94*9880d681SAndroid Build Coastguard Worker 95*9880d681SAndroid Build Coastguard Worker // Leon options useSoftFpu()96*9880d681SAndroid Build Coastguard Worker bool useSoftFpu() const { return UseSoftFpu; } hasLeonCasa()97*9880d681SAndroid Build Coastguard Worker bool hasLeonCasa() const { return HasLeonCasa; } hasUmacSmac()98*9880d681SAndroid Build Coastguard Worker bool hasUmacSmac() const { return HasUmacSmac; } performSDIVReplace()99*9880d681SAndroid Build Coastguard Worker bool performSDIVReplace() const { return PerformSDIVReplace; } fixCallImmediates()100*9880d681SAndroid Build Coastguard Worker bool fixCallImmediates() const { return FixCallImmediates; } ignoreZeroFlag()101*9880d681SAndroid Build Coastguard Worker bool ignoreZeroFlag() const { return IgnoreZeroFlag; } insertNOPDoublePrecision()102*9880d681SAndroid Build Coastguard Worker bool insertNOPDoublePrecision() const { return InsertNOPDoublePrecision; } fixFSMULD()103*9880d681SAndroid Build Coastguard Worker bool fixFSMULD() const { return FixFSMULD; } replaceFMULS()104*9880d681SAndroid Build Coastguard Worker bool replaceFMULS() const { return ReplaceFMULS; } preventRoundChange()105*9880d681SAndroid Build Coastguard Worker bool preventRoundChange() const { return PreventRoundChange; } fixAllFDIVSQRT()106*9880d681SAndroid Build Coastguard Worker bool fixAllFDIVSQRT() const { return FixAllFDIVSQRT; } flushCacheLineSWAP()107*9880d681SAndroid Build Coastguard Worker bool flushCacheLineSWAP() const { return FlushCacheLineSWAP; } insertNOPsLoadStore()108*9880d681SAndroid Build Coastguard Worker bool insertNOPsLoadStore() const { return InsertNOPsLoadStore; } insertNOPLoad()109*9880d681SAndroid Build Coastguard Worker bool insertNOPLoad() const { return InsertNOPLoad; } 110*9880d681SAndroid Build Coastguard Worker 111*9880d681SAndroid Build Coastguard Worker /// ParseSubtargetFeatures - Parses features string setting specified 112*9880d681SAndroid Build Coastguard Worker /// subtarget options. Definition of function is auto generated by tblgen. 113*9880d681SAndroid Build Coastguard Worker void ParseSubtargetFeatures(StringRef CPU, StringRef FS); 114*9880d681SAndroid Build Coastguard Worker SparcSubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS); 115*9880d681SAndroid Build Coastguard Worker is64Bit()116*9880d681SAndroid Build Coastguard Worker bool is64Bit() const { return Is64Bit; } 117*9880d681SAndroid Build Coastguard Worker 118*9880d681SAndroid Build Coastguard Worker /// The 64-bit ABI uses biased stack and frame pointers, so the stack frame 119*9880d681SAndroid Build Coastguard Worker /// of the current function is the area from [%sp+BIAS] to [%fp+BIAS]. getStackPointerBias()120*9880d681SAndroid Build Coastguard Worker int64_t getStackPointerBias() const { 121*9880d681SAndroid Build Coastguard Worker return is64Bit() ? 2047 : 0; 122*9880d681SAndroid Build Coastguard Worker } 123*9880d681SAndroid Build Coastguard Worker 124*9880d681SAndroid Build Coastguard Worker /// Given a actual stack size as determined by FrameInfo, this function 125*9880d681SAndroid Build Coastguard Worker /// returns adjusted framesize which includes space for register window 126*9880d681SAndroid Build Coastguard Worker /// spills and arguments. 127*9880d681SAndroid Build Coastguard Worker int getAdjustedFrameSize(int stackSize) const; 128*9880d681SAndroid Build Coastguard Worker isTargetLinux()129*9880d681SAndroid Build Coastguard Worker bool isTargetLinux() const { return TargetTriple.isOSLinux(); } 130*9880d681SAndroid Build Coastguard Worker }; 131*9880d681SAndroid Build Coastguard Worker 132*9880d681SAndroid Build Coastguard Worker } // end namespace llvm 133*9880d681SAndroid Build Coastguard Worker 134*9880d681SAndroid Build Coastguard Worker #endif 135