LLVM API Documentation

MSP430Subtarget.h
Go to the documentation of this file.
00001 //===-- MSP430Subtarget.h - Define Subtarget for the MSP430 ----*- 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 MSP430 specific subclass of TargetSubtargetInfo.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_LIB_TARGET_MSP430_MSP430SUBTARGET_H
00015 #define LLVM_LIB_TARGET_MSP430_MSP430SUBTARGET_H
00016 
00017 #include "MSP430FrameLowering.h"
00018 #include "MSP430InstrInfo.h"
00019 #include "MSP430ISelLowering.h"
00020 #include "MSP430RegisterInfo.h"
00021 #include "MSP430SelectionDAGInfo.h"
00022 #include "llvm/IR/DataLayout.h"
00023 #include "llvm/Target/TargetSubtargetInfo.h"
00024 #include <string>
00025 
00026 #define GET_SUBTARGETINFO_HEADER
00027 #include "MSP430GenSubtargetInfo.inc"
00028 
00029 namespace llvm {
00030 class StringRef;
00031 
00032 class MSP430Subtarget : public MSP430GenSubtargetInfo {
00033   virtual void anchor();
00034   bool ExtendedInsts;
00035   const DataLayout DL; // Calculates type size & alignment
00036   MSP430FrameLowering FrameLowering;
00037   MSP430InstrInfo InstrInfo;
00038   MSP430TargetLowering TLInfo;
00039   MSP430SelectionDAGInfo TSInfo;
00040 
00041 public:
00042   /// This constructor initializes the data members to match that
00043   /// of the specified triple.
00044   ///
00045   MSP430Subtarget(const std::string &TT, const std::string &CPU,
00046                   const std::string &FS, const TargetMachine &TM);
00047 
00048   MSP430Subtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS);
00049 
00050   /// ParseSubtargetFeatures - Parses features string setting specified
00051   /// subtarget options.  Definition of function is auto generated by tblgen.
00052   void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
00053 
00054   const TargetFrameLowering *getFrameLowering() const override {
00055     return &FrameLowering;
00056   }
00057   const MSP430InstrInfo *getInstrInfo() const override { return &InstrInfo; }
00058   const DataLayout *getDataLayout() const override { return &DL; }
00059   const TargetRegisterInfo *getRegisterInfo() const override {
00060     return &InstrInfo.getRegisterInfo();
00061   }
00062   const MSP430TargetLowering *getTargetLowering() const override {
00063     return &TLInfo;
00064   }
00065   const MSP430SelectionDAGInfo *getSelectionDAGInfo() const override {
00066     return &TSInfo;
00067   }
00068 };
00069 } // End llvm namespace
00070 
00071 #endif  // LLVM_TARGET_MSP430_SUBTARGET_H