1*9880d681SAndroid Build Coastguard Worker //===-- AVRSubtarget.h - Define Subtarget for the AVR -----------*- 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 AVR 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_AVR_SUBTARGET_H 15*9880d681SAndroid Build Coastguard Worker #define LLVM_AVR_SUBTARGET_H 16*9880d681SAndroid Build Coastguard Worker 17*9880d681SAndroid Build Coastguard Worker #include "llvm/Target/TargetSubtargetInfo.h" 18*9880d681SAndroid Build Coastguard Worker #include "llvm/IR/DataLayout.h" 19*9880d681SAndroid Build Coastguard Worker #include "llvm/IR/DataLayout.h" 20*9880d681SAndroid Build Coastguard Worker #include "llvm/Target/TargetMachine.h" 21*9880d681SAndroid Build Coastguard Worker 22*9880d681SAndroid Build Coastguard Worker #include "AVRFrameLowering.h" 23*9880d681SAndroid Build Coastguard Worker #include "AVRISelLowering.h" 24*9880d681SAndroid Build Coastguard Worker #include "AVRInstrInfo.h" 25*9880d681SAndroid Build Coastguard Worker #include "AVRSelectionDAGInfo.h" 26*9880d681SAndroid Build Coastguard Worker 27*9880d681SAndroid Build Coastguard Worker #define GET_SUBTARGETINFO_HEADER 28*9880d681SAndroid Build Coastguard Worker #include "AVRGenSubtargetInfo.inc" 29*9880d681SAndroid Build Coastguard Worker 30*9880d681SAndroid Build Coastguard Worker namespace llvm { 31*9880d681SAndroid Build Coastguard Worker 32*9880d681SAndroid Build Coastguard Worker /// A specific AVR target MCU. 33*9880d681SAndroid Build Coastguard Worker class AVRSubtarget : public AVRGenSubtargetInfo { 34*9880d681SAndroid Build Coastguard Worker public: 35*9880d681SAndroid Build Coastguard Worker //! Creates an AVR subtarget. 36*9880d681SAndroid Build Coastguard Worker //! \param TT The target triple. 37*9880d681SAndroid Build Coastguard Worker //! \param CPU The CPU to target. 38*9880d681SAndroid Build Coastguard Worker //! \param FS The feature string. 39*9880d681SAndroid Build Coastguard Worker //! \param TM The target machine. 40*9880d681SAndroid Build Coastguard Worker AVRSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, 41*9880d681SAndroid Build Coastguard Worker AVRTargetMachine &TM); 42*9880d681SAndroid Build Coastguard Worker getInstrInfo()43*9880d681SAndroid Build Coastguard Worker const AVRInstrInfo *getInstrInfo() const override { return &InstrInfo; } getFrameLowering()44*9880d681SAndroid Build Coastguard Worker const TargetFrameLowering *getFrameLowering() const override { return &FrameLowering; } getTargetLowering()45*9880d681SAndroid Build Coastguard Worker const AVRTargetLowering *getTargetLowering() const override { return &TLInfo; } getSelectionDAGInfo()46*9880d681SAndroid Build Coastguard Worker const AVRSelectionDAGInfo *getSelectionDAGInfo() const override { return &TSInfo; } getRegisterInfo()47*9880d681SAndroid Build Coastguard Worker const AVRRegisterInfo *getRegisterInfo() const override { return &InstrInfo.getRegisterInfo(); } 48*9880d681SAndroid Build Coastguard Worker 49*9880d681SAndroid Build Coastguard Worker /// Parses a subtarget feature string, setting appropriate options. 50*9880d681SAndroid Build Coastguard Worker /// \note Definition of function is auto generated by `tblgen`. 51*9880d681SAndroid Build Coastguard Worker void ParseSubtargetFeatures(StringRef CPU, StringRef FS); 52*9880d681SAndroid Build Coastguard Worker 53*9880d681SAndroid Build Coastguard Worker // Subtarget feature getters. 54*9880d681SAndroid Build Coastguard Worker // See AVR.td for details. hasSRAM()55*9880d681SAndroid Build Coastguard Worker bool hasSRAM() const { return m_hasSRAM; } hasJMPCALL()56*9880d681SAndroid Build Coastguard Worker bool hasJMPCALL() const { return m_hasJMPCALL; } hasIJMPCALL()57*9880d681SAndroid Build Coastguard Worker bool hasIJMPCALL() const { return m_hasIJMPCALL; } hasEIJMPCALL()58*9880d681SAndroid Build Coastguard Worker bool hasEIJMPCALL() const { return m_hasEIJMPCALL; } hasADDSUBIW()59*9880d681SAndroid Build Coastguard Worker bool hasADDSUBIW() const { return m_hasADDSUBIW; } hasSmallStack()60*9880d681SAndroid Build Coastguard Worker bool hasSmallStack() const { return m_hasSmallStack; } hasMOVW()61*9880d681SAndroid Build Coastguard Worker bool hasMOVW() const { return m_hasMOVW; } hasLPM()62*9880d681SAndroid Build Coastguard Worker bool hasLPM() const { return m_hasLPM; } hasLPMX()63*9880d681SAndroid Build Coastguard Worker bool hasLPMX() const { return m_hasLPMX; } hasELPM()64*9880d681SAndroid Build Coastguard Worker bool hasELPM() const { return m_hasELPM; } hasELPMX()65*9880d681SAndroid Build Coastguard Worker bool hasELPMX() const { return m_hasELPMX; } hasSPM()66*9880d681SAndroid Build Coastguard Worker bool hasSPM() const { return m_hasSPM; } hasSPMX()67*9880d681SAndroid Build Coastguard Worker bool hasSPMX() const { return m_hasSPMX; } hasDES()68*9880d681SAndroid Build Coastguard Worker bool hasDES() const { return m_hasDES; } supportsRMW()69*9880d681SAndroid Build Coastguard Worker bool supportsRMW() const { return m_supportsRMW; } supportsMultiplication()70*9880d681SAndroid Build Coastguard Worker bool supportsMultiplication() const { return m_supportsMultiplication; } hasBREAK()71*9880d681SAndroid Build Coastguard Worker bool hasBREAK() const { return m_hasBREAK; } hasTinyEncoding()72*9880d681SAndroid Build Coastguard Worker bool hasTinyEncoding() const { return m_hasTinyEncoding; } 73*9880d681SAndroid Build Coastguard Worker 74*9880d681SAndroid Build Coastguard Worker /// Gets the ELF architecture for the e_flags field 75*9880d681SAndroid Build Coastguard Worker /// of an ELF object file. getELFArch()76*9880d681SAndroid Build Coastguard Worker unsigned getELFArch() const { 77*9880d681SAndroid Build Coastguard Worker assert(ELFArch != 0 && 78*9880d681SAndroid Build Coastguard Worker "every device must have an associate ELF architecture"); 79*9880d681SAndroid Build Coastguard Worker return ELFArch; 80*9880d681SAndroid Build Coastguard Worker } 81*9880d681SAndroid Build Coastguard Worker 82*9880d681SAndroid Build Coastguard Worker private: 83*9880d681SAndroid Build Coastguard Worker AVRInstrInfo InstrInfo; 84*9880d681SAndroid Build Coastguard Worker AVRFrameLowering FrameLowering; 85*9880d681SAndroid Build Coastguard Worker AVRTargetLowering TLInfo; 86*9880d681SAndroid Build Coastguard Worker AVRSelectionDAGInfo TSInfo; 87*9880d681SAndroid Build Coastguard Worker 88*9880d681SAndroid Build Coastguard Worker // Subtarget feature settings 89*9880d681SAndroid Build Coastguard Worker // See AVR.td for details. 90*9880d681SAndroid Build Coastguard Worker bool m_hasSRAM; 91*9880d681SAndroid Build Coastguard Worker bool m_hasJMPCALL; 92*9880d681SAndroid Build Coastguard Worker bool m_hasIJMPCALL; 93*9880d681SAndroid Build Coastguard Worker bool m_hasEIJMPCALL; 94*9880d681SAndroid Build Coastguard Worker bool m_hasADDSUBIW; 95*9880d681SAndroid Build Coastguard Worker bool m_hasSmallStack; 96*9880d681SAndroid Build Coastguard Worker bool m_hasMOVW; 97*9880d681SAndroid Build Coastguard Worker bool m_hasLPM; 98*9880d681SAndroid Build Coastguard Worker bool m_hasLPMX; 99*9880d681SAndroid Build Coastguard Worker bool m_hasELPM; 100*9880d681SAndroid Build Coastguard Worker bool m_hasELPMX; 101*9880d681SAndroid Build Coastguard Worker bool m_hasSPM; 102*9880d681SAndroid Build Coastguard Worker bool m_hasSPMX; 103*9880d681SAndroid Build Coastguard Worker bool m_hasDES; 104*9880d681SAndroid Build Coastguard Worker bool m_supportsRMW; 105*9880d681SAndroid Build Coastguard Worker bool m_supportsMultiplication; 106*9880d681SAndroid Build Coastguard Worker bool m_hasBREAK; 107*9880d681SAndroid Build Coastguard Worker bool m_hasTinyEncoding; 108*9880d681SAndroid Build Coastguard Worker 109*9880d681SAndroid Build Coastguard Worker /// The ELF e_flags architecture. 110*9880d681SAndroid Build Coastguard Worker unsigned ELFArch; 111*9880d681SAndroid Build Coastguard Worker 112*9880d681SAndroid Build Coastguard Worker // Dummy member, used by FeatureSet's. We cannot have a SubtargetFeature with 113*9880d681SAndroid Build Coastguard Worker // no variable, so we instead bind pseudo features to this variable. 114*9880d681SAndroid Build Coastguard Worker bool m_FeatureSetDummy; 115*9880d681SAndroid Build Coastguard Worker }; 116*9880d681SAndroid Build Coastguard Worker 117*9880d681SAndroid Build Coastguard Worker } // end namespace llvm 118*9880d681SAndroid Build Coastguard Worker 119*9880d681SAndroid Build Coastguard Worker #endif // LLVM_AVR_SUBTARGET_H 120