1 //==-- MSP430TargetMachine.h - Define TargetMachine for 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 TargetMachine.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 
15 #ifndef LLVM_TARGET_MSP430_TARGETMACHINE_H
16 #define LLVM_TARGET_MSP430_TARGETMACHINE_H
17 
18 #include "MSP430InstrInfo.h"
19 #include "MSP430ISelLowering.h"
20 #include "MSP430RegisterInfo.h"
21 #include "MSP430Subtarget.h"
22 #include "llvm/Target/TargetData.h"
23 #include "llvm/Target/TargetFrameInfo.h"
24 #include "llvm/Target/TargetMachine.h"
25 
26 namespace llvm {
27 
28 /// MSP430TargetMachine
29 ///
30 class MSP430TargetMachine : public LLVMTargetMachine {
31   MSP430Subtarget        Subtarget;
32   const TargetData       DataLayout;       // Calculates type size & alignment
33   MSP430InstrInfo        InstrInfo;
34   MSP430TargetLowering   TLInfo;
35 
36   // MSP430 does not have any call stack frame, therefore not having
37   // any MSP430 specific FrameInfo class.
38   TargetFrameInfo       FrameInfo;
39 
40 protected:
41   virtual const TargetAsmInfo *createTargetAsmInfo() const;
42 
43 public:
44   MSP430TargetMachine(const Target &T, const std::string &TT,
45                       const std::string &FS);
46 
47   virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
48   virtual const MSP430InstrInfo *getInstrInfo() const  { return &InstrInfo; }
49   virtual const TargetData *getTargetData() const     { return &DataLayout;}
50   virtual const MSP430Subtarget *getSubtargetImpl() const { return &Subtarget; }
51 
52   virtual const TargetRegisterInfo *getRegisterInfo() const {
53     return &InstrInfo.getRegisterInfo();
54   }
55 
56   virtual MSP430TargetLowering *getTargetLowering() const {
57     return const_cast<MSP430TargetLowering*>(&TLInfo);
58   }
59 
60   virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
61 }; // MSP430TargetMachine.
62 
63 } // end namespace llvm
64 
65 #endif // LLVM_TARGET_MSP430_TARGETMACHINE_H
66