LLVM API Documentation
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 protected: 00041 virtual const TargetAsmInfo *createTargetAsmInfo() const; 00042 00043 public: 00044 PIC16TargetMachine(const Module &M, const std::string &FS, 00045 bool Cooper = false); 00046 00047 virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; } 00048 virtual const PIC16InstrInfo *getInstrInfo() const { return &InstrInfo; } 00049 virtual const TargetData *getTargetData() const { return &DataLayout;} 00050 virtual const PIC16Subtarget *getSubtargetImpl() const { return &Subtarget; } 00051 00052 virtual const PIC16RegisterInfo *getRegisterInfo() const { 00053 return &(InstrInfo.getRegisterInfo()); 00054 } 00055 00056 virtual PIC16TargetLowering *getTargetLowering() const { 00057 return const_cast<PIC16TargetLowering*>(&TLInfo); 00058 } 00059 00060 virtual bool addInstSelector(PassManagerBase &PM, bool Fast); 00061 virtual bool addAssemblyEmitter(PassManagerBase &PM, bool Fast, 00062 raw_ostream &Out); 00063 }; // PIC16TargetMachine. 00064 00065 /// CooperTargetMachine 00066 class CooperTargetMachine : public PIC16TargetMachine { 00067 public: 00068 CooperTargetMachine(const Module &M, const std::string &FS); 00069 }; // CooperTargetMachine. 00070 00071 } // end namespace llvm 00072 00073 #endif