Home | History | Annotate | Download | only in XCore
      1 //===-- XCoreSubtarget.h - Define Subtarget for the XCore -------*- 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 XCore specific subclass of TargetSubtargetInfo.
     11 //
     12 //===----------------------------------------------------------------------===//
     13 
     14 #ifndef XCORESUBTARGET_H
     15 #define XCORESUBTARGET_H
     16 
     17 #include "XCoreFrameLowering.h"
     18 #include "XCoreISelLowering.h"
     19 #include "XCoreInstrInfo.h"
     20 #include "XCoreSelectionDAGInfo.h"
     21 #include "llvm/IR/DataLayout.h"
     22 #include "llvm/Target/TargetMachine.h"
     23 #include "llvm/Target/TargetSubtargetInfo.h"
     24 #include <string>
     25 
     26 #define GET_SUBTARGETINFO_HEADER
     27 #include "XCoreGenSubtargetInfo.inc"
     28 
     29 namespace llvm {
     30 class StringRef;
     31 
     32 class XCoreSubtarget : public XCoreGenSubtargetInfo {
     33   virtual void anchor();
     34   const DataLayout DL;       // Calculates type size & alignment
     35   XCoreInstrInfo InstrInfo;
     36   XCoreFrameLowering FrameLowering;
     37   XCoreTargetLowering TLInfo;
     38   XCoreSelectionDAGInfo TSInfo;
     39 
     40 public:
     41   /// This constructor initializes the data members to match that
     42   /// of the specified triple.
     43   ///
     44   XCoreSubtarget(const std::string &TT, const std::string &CPU,
     45                  const std::string &FS, const TargetMachine &TM);
     46 
     47   /// ParseSubtargetFeatures - Parses features string setting specified
     48   /// subtarget options.  Definition of function is auto generated by tblgen.
     49   void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
     50 
     51   const XCoreInstrInfo *getInstrInfo() const { return &InstrInfo; }
     52   const XCoreFrameLowering *getFrameLowering() const { return &FrameLowering; }
     53   const XCoreTargetLowering *getTargetLowering() const { return &TLInfo; }
     54   const XCoreSelectionDAGInfo *getSelectionDAGInfo() const { return &TSInfo; }
     55   const TargetRegisterInfo *getRegisterInfo() const {
     56     return &InstrInfo.getRegisterInfo();
     57   }
     58   const DataLayout *getDataLayout() const { return &DL; }
     59 };
     60 } // End llvm namespace
     61 
     62 #endif
     63