• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "llvm/CodeGen/SelectionDAGTargetInfo.h"
22 #include "llvm/CodeGen/TargetSubtargetInfo.h"
23 #include "llvm/IR/DataLayout.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 public:
34   enum HWMultEnum {
35     NoHWMult, HWMult16, HWMult32, HWMultF5
36   };
37 
38 private:
39   virtual void anchor();
40   bool ExtendedInsts;
41   HWMultEnum HWMultMode;
42   MSP430FrameLowering FrameLowering;
43   MSP430InstrInfo InstrInfo;
44   MSP430TargetLowering TLInfo;
45   SelectionDAGTargetInfo TSInfo;
46 
47 public:
48   /// This constructor initializes the data members to match that
49   /// of the specified triple.
50   ///
51   MSP430Subtarget(const Triple &TT, const std::string &CPU,
52                   const std::string &FS, const TargetMachine &TM);
53 
54   MSP430Subtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS);
55 
56   /// ParseSubtargetFeatures - Parses features string setting specified
57   /// subtarget options.  Definition of function is auto generated by tblgen.
58   void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
59 
hasHWMult16()60   bool hasHWMult16() const { return HWMultMode == HWMult16; }
hasHWMult32()61   bool hasHWMult32() const { return HWMultMode == HWMult32; }
hasHWMultF5()62   bool hasHWMultF5() const { return HWMultMode == HWMultF5; }
63 
getFrameLowering()64   const TargetFrameLowering *getFrameLowering() const override {
65     return &FrameLowering;
66   }
getInstrInfo()67   const MSP430InstrInfo *getInstrInfo() const override { return &InstrInfo; }
getRegisterInfo()68   const TargetRegisterInfo *getRegisterInfo() const override {
69     return &InstrInfo.getRegisterInfo();
70   }
getTargetLowering()71   const MSP430TargetLowering *getTargetLowering() const override {
72     return &TLInfo;
73   }
getSelectionDAGInfo()74   const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
75     return &TSInfo;
76   }
77 };
78 } // End llvm namespace
79 
80 #endif  // LLVM_TARGET_MSP430_SUBTARGET_H
81