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" |
Sanjiv Gupta | b1b5ffd | 2008-11-19 11:00:54 +0000 | [diff] [blame] | 20 | #include "PIC16RegisterInfo.h" |
Sanjiv Gupta | 0e68771 | 2008-05-13 09:02:57 +0000 | [diff] [blame] | 21 | #include "PIC16Subtarget.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 | /// PIC16TargetMachine |
| 29 | /// |
| 30 | class PIC16TargetMachine : public LLVMTargetMachine { |
| 31 | PIC16Subtarget Subtarget; |
| 32 | const TargetData DataLayout; // Calculates type size & alignment |
| 33 | PIC16InstrInfo InstrInfo; |
| 34 | PIC16TargetLowering TLInfo; |
Sanjiv Gupta | b1b5ffd | 2008-11-19 11:00:54 +0000 | [diff] [blame] | 35 | |
| 36 | // PIC16 does not have any call stack frame, therefore not having |
| 37 | // any PIC16 specific FrameInfo class. |
Sanjiv Gupta | 0e68771 | 2008-05-13 09:02:57 +0000 | [diff] [blame] | 38 | TargetFrameInfo FrameInfo; |
| 39 | |
| 40 | protected: |
| 41 | virtual const TargetAsmInfo *createTargetAsmInfo() const; |
Sanjiv Gupta | 0e68771 | 2008-05-13 09:02:57 +0000 | [diff] [blame] | 42 | |
Sanjiv Gupta | b1b5ffd | 2008-11-19 11:00:54 +0000 | [diff] [blame] | 43 | public: |
Daniel Dunbar | 51b198a | 2009-07-15 20:24:03 +0000 | [diff] [blame] | 44 | PIC16TargetMachine(const Target &T, const Module &M, const std::string &FS, |
Sanjiv Gupta | b1b5ffd | 2008-11-19 11:00:54 +0000 | [diff] [blame] | 45 | bool Cooper = false); |
| 46 | |
| 47 | virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; } |
| 48 | virtual const PIC16InstrInfo *getInstrInfo() const { return &InstrInfo; } |
| 49 | virtual const TargetData *getTargetData() const { return &DataLayout;} |
| 50 | virtual const PIC16Subtarget *getSubtargetImpl() const { return &Subtarget; } |
| 51 | |
| 52 | virtual const PIC16RegisterInfo *getRegisterInfo() const { |
| 53 | return &(InstrInfo.getRegisterInfo()); |
| 54 | } |
| 55 | |
| 56 | virtual PIC16TargetLowering *getTargetLowering() const { |
| 57 | return const_cast<PIC16TargetLowering*>(&TLInfo); |
| 58 | } |
| 59 | |
Bill Wendling | 98a366d | 2009-04-29 23:29:43 +0000 | [diff] [blame] | 60 | virtual bool addInstSelector(PassManagerBase &PM, |
| 61 | CodeGenOpt::Level OptLevel); |
Sanjiv Gupta | d8d27f4 | 2009-05-06 08:02:01 +0000 | [diff] [blame] | 62 | virtual bool addPostRegAlloc(PassManagerBase &PM, CodeGenOpt::Level OptLevel); |
Sanjiv Gupta | b1b5ffd | 2008-11-19 11:00:54 +0000 | [diff] [blame] | 63 | }; // PIC16TargetMachine. |
| 64 | |
| 65 | /// CooperTargetMachine |
| 66 | class CooperTargetMachine : public PIC16TargetMachine { |
| 67 | public: |
Daniel Dunbar | 51b198a | 2009-07-15 20:24:03 +0000 | [diff] [blame] | 68 | CooperTargetMachine(const Target &T, const Module &M, const std::string &FS); |
Sanjiv Gupta | b1b5ffd | 2008-11-19 11:00:54 +0000 | [diff] [blame] | 69 | }; // CooperTargetMachine. |
| 70 | |
Sanjiv Gupta | 0e68771 | 2008-05-13 09:02:57 +0000 | [diff] [blame] | 71 | } // end namespace llvm |
| 72 | |
| 73 | #endif |