Sanjiv Gupta | 0e68771 | 2008-05-13 09:02:57 +0000 | [diff] [blame^] | 1 | //===-- PIC16TargetMachine.h - Define TargetMachine for PIC16 ---*- 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 PIC16 specific subclass of TargetMachine. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | |
| 15 | #ifndef PIC16_TARGETMACHINE_H |
| 16 | #define PIC16_TARGETMACHINE_H |
| 17 | |
| 18 | #include "PIC16InstrInfo.h" |
| 19 | #include "PIC16ISelLowering.h" |
| 20 | #include "PIC16Subtarget.h" |
| 21 | #include "llvm/Target/TargetData.h" |
| 22 | #include "llvm/Target/TargetFrameInfo.h" |
| 23 | #include "llvm/Target/TargetMachine.h" |
| 24 | |
| 25 | namespace llvm { |
| 26 | |
| 27 | /// PIC16TargetMachine |
| 28 | /// |
| 29 | class PIC16TargetMachine : public LLVMTargetMachine { |
| 30 | PIC16Subtarget Subtarget; |
| 31 | const TargetData DataLayout; // Calculates type size & alignment |
| 32 | PIC16InstrInfo InstrInfo; |
| 33 | PIC16TargetLowering TLInfo; |
| 34 | TargetFrameInfo FrameInfo; |
| 35 | |
| 36 | protected: |
| 37 | virtual const TargetAsmInfo *createTargetAsmInfo() const; |
| 38 | |
| 39 | public: |
| 40 | PIC16TargetMachine(const Module &M, const std::string &FS); |
| 41 | |
| 42 | virtual const TargetFrameInfo *getFrameInfo() const |
| 43 | { return &FrameInfo; } |
| 44 | virtual const PIC16InstrInfo *getInstrInfo() const |
| 45 | { return &InstrInfo; } |
| 46 | virtual const TargetData *getTargetData() const |
| 47 | { return &DataLayout; } |
| 48 | virtual PIC16TargetLowering *getTargetLowering() const |
| 49 | { return const_cast<PIC16TargetLowering*>(&TLInfo); } |
| 50 | virtual const TargetRegisterInfo *getRegisterInfo() const |
| 51 | { return &InstrInfo.getRegisterInfo(); } |
| 52 | |
| 53 | virtual bool addInstSelector(PassManagerBase &PM, bool Fast); |
| 54 | virtual bool addPrologEpilogInserter(PassManagerBase &PM, bool Fast); |
| 55 | virtual bool addPreEmitPass(PassManagerBase &PM, bool Fast); |
| 56 | virtual bool addAssemblyEmitter(PassManagerBase &PM, bool Fast, |
| 57 | std::ostream &Out); |
| 58 | }; |
| 59 | } // end namespace llvm |
| 60 | |
| 61 | #endif |