LLVM API Documentation

MSP430TargetMachine.h

Go to the documentation of this file.
00001 //==-- MSP430TargetMachine.h - Define TargetMachine for 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 TargetMachine.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 
00015 #ifndef LLVM_TARGET_MSP430_TARGETMACHINE_H
00016 #define LLVM_TARGET_MSP430_TARGETMACHINE_H
00017 
00018 #include "MSP430InstrInfo.h"
00019 #include "MSP430ISelLowering.h"
00020 #include "MSP430RegisterInfo.h"
00021 #include "MSP430Subtarget.h"
00022 #include "llvm/Target/TargetData.h"
00023 #include "llvm/Target/TargetFrameInfo.h"
00024 #include "llvm/Target/TargetMachine.h"
00025 
00026 namespace llvm {
00027 
00028 /// MSP430TargetMachine
00029 ///
00030 class MSP430TargetMachine : public LLVMTargetMachine {
00031   MSP430Subtarget        Subtarget;
00032   const TargetData       DataLayout;       // Calculates type size & alignment
00033   MSP430InstrInfo        InstrInfo;
00034   MSP430TargetLowering   TLInfo;
00035 
00036   // MSP430 does not have any call stack frame, therefore not having
00037   // any MSP430 specific FrameInfo class.
00038   TargetFrameInfo       FrameInfo;
00039 
00040 public:
00041   MSP430TargetMachine(const Target &T, const std::string &TT,
00042                       const std::string &FS);
00043 
00044   virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
00045   virtual const MSP430InstrInfo *getInstrInfo() const  { return &InstrInfo; }
00046   virtual const TargetData *getTargetData() const     { return &DataLayout;}
00047   virtual const MSP430Subtarget *getSubtargetImpl() const { return &Subtarget; }
00048 
00049   virtual const TargetRegisterInfo *getRegisterInfo() const {
00050     return &InstrInfo.getRegisterInfo();
00051   }
00052 
00053   virtual MSP430TargetLowering *getTargetLowering() const {
00054     return const_cast<MSP430TargetLowering*>(&TLInfo);
00055   }
00056 
00057   virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
00058 }; // MSP430TargetMachine.
00059 
00060 } // end namespace llvm
00061 
00062 #endif // LLVM_TARGET_MSP430_TARGETMACHINE_H