LLVM API Documentation

PIC16TargetMachine.h

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