1 //===-- MSP430Subtarget.h - Define Subtarget for the MSP430 ----*- C++ -*--===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file declares the MSP430 specific subclass of TargetSubtargetInfo. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef LLVM_LIB_TARGET_MSP430_MSP430SUBTARGET_H 15 #define LLVM_LIB_TARGET_MSP430_MSP430SUBTARGET_H 16 17 #include "MSP430FrameLowering.h" 18 #include "MSP430ISelLowering.h" 19 #include "MSP430InstrInfo.h" 20 #include "MSP430RegisterInfo.h" 21 #include "MSP430SelectionDAGInfo.h" 22 #include "llvm/IR/DataLayout.h" 23 #include "llvm/Target/TargetSubtargetInfo.h" 24 #include <string> 25 26 #define GET_SUBTARGETINFO_HEADER 27 #include "MSP430GenSubtargetInfo.inc" 28 29 namespace llvm { 30 class StringRef; 31 32 class MSP430Subtarget : public MSP430GenSubtargetInfo { 33 virtual void anchor(); 34 bool ExtendedInsts; 35 const DataLayout DL; // Calculates type size & alignment 36 MSP430FrameLowering FrameLowering; 37 MSP430InstrInfo InstrInfo; 38 MSP430TargetLowering TLInfo; 39 MSP430SelectionDAGInfo TSInfo; 40 41 public: 42 /// This constructor initializes the data members to match that 43 /// of the specified triple. 44 /// 45 MSP430Subtarget(const std::string &TT, const std::string &CPU, 46 const std::string &FS, const TargetMachine &TM); 47 48 MSP430Subtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS); 49 50 /// ParseSubtargetFeatures - Parses features string setting specified 51 /// subtarget options. Definition of function is auto generated by tblgen. 52 void ParseSubtargetFeatures(StringRef CPU, StringRef FS); 53 getFrameLowering()54 const TargetFrameLowering *getFrameLowering() const override { 55 return &FrameLowering; 56 } getInstrInfo()57 const MSP430InstrInfo *getInstrInfo() const override { return &InstrInfo; } getDataLayout()58 const DataLayout *getDataLayout() const override { return &DL; } getRegisterInfo()59 const TargetRegisterInfo *getRegisterInfo() const override { 60 return &InstrInfo.getRegisterInfo(); 61 } getTargetLowering()62 const MSP430TargetLowering *getTargetLowering() const override { 63 return &TLInfo; 64 } getSelectionDAGInfo()65 const MSP430SelectionDAGInfo *getSelectionDAGInfo() const override { 66 return &TSInfo; 67 } 68 }; 69 } // End llvm namespace 70 71 #endif // LLVM_TARGET_MSP430_SUBTARGET_H 72