1 //===-- XtensaSubtarget.h - Define Subtarget for the Xtensa ----*- C++ -*--===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // This file declares the Xtensa specific subclass of TargetSubtargetInfo. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #ifndef LLVM_LIB_TARGET_XTENSA_XTENSASUBTARGET_H 14 #define LLVM_LIB_TARGET_XTENSA_XTENSASUBTARGET_H 15 16 #include "XtensaFrameLowering.h" 17 #include "XtensaISelLowering.h" 18 #include "XtensaInstrInfo.h" 19 #include "XtensaRegisterInfo.h" 20 #include "llvm/CodeGen/SelectionDAGTargetInfo.h" 21 #include "llvm/CodeGen/TargetSubtargetInfo.h" 22 #include "llvm/IR/DataLayout.h" 23 #include "llvm/Target/TargetMachine.h" 24 25 #define GET_SUBTARGETINFO_HEADER 26 #include "XtensaGenSubtargetInfo.inc" 27 28 namespace llvm { 29 class StringRef; 30 31 class XtensaSubtarget : public XtensaGenSubtargetInfo { 32 private: 33 const Triple &TargetTriple; 34 XtensaInstrInfo InstrInfo; 35 XtensaTargetLowering TLInfo; 36 SelectionDAGTargetInfo TSInfo; 37 XtensaFrameLowering FrameLowering; 38 39 // Enabled Xtensa Density extension 40 bool HasDensity; 41 42 XtensaSubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS); 43 44 public: 45 XtensaSubtarget(const Triple &TT, StringRef CPU, StringRef FS, 46 const TargetMachine &TM); 47 48 const Triple &getTargetTriple() const { return TargetTriple; } 49 50 const TargetFrameLowering *getFrameLowering() const override { 51 return &FrameLowering; 52 } 53 const XtensaInstrInfo *getInstrInfo() const override { return &InstrInfo; } 54 const XtensaRegisterInfo *getRegisterInfo() const override { 55 return &InstrInfo.getRegisterInfo(); 56 } 57 58 const XtensaTargetLowering *getTargetLowering() const override { 59 return &TLInfo; 60 } 61 const SelectionDAGTargetInfo *getSelectionDAGInfo() const override { 62 return &TSInfo; 63 } 64 65 bool hasDensity() const { return HasDensity; } 66 67 // Automatically generated by tblgen. 68 void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS); 69 }; 70 } // end namespace llvm 71 72 #endif /* LLVM_LIB_TARGET_XTENSA_XTENSASUBTARGET_H */ 73