Sanjiv Gupta | 09bb420 | 2008-05-13 09:02:57 +0000 | [diff] [blame] | 1 | //===- PIC16InstrInfo.h - PIC16 Instruction Information----------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the niversity of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains the PIC16 implementation of the TargetInstrInfo class. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef PIC16INSTRUCTIONINFO_H |
| 15 | #define PIC16INSTRUCTIONINFO_H |
| 16 | |
| 17 | #include "PIC16.h" |
| 18 | #include "PIC16RegisterInfo.h" |
| 19 | #include "llvm/Target/TargetInstrInfo.h" |
| 20 | |
| 21 | namespace llvm { |
| 22 | |
| 23 | |
| 24 | class PIC16InstrInfo : public TargetInstrInfoImpl |
| 25 | { |
| 26 | PIC16TargetMachine &TM; |
Sanjiv Gupta | 085ae4f | 2008-11-19 11:00:54 +0000 | [diff] [blame] | 27 | const PIC16RegisterInfo RegInfo; |
Sanjiv Gupta | 09bb420 | 2008-05-13 09:02:57 +0000 | [diff] [blame] | 28 | public: |
| 29 | explicit PIC16InstrInfo(PIC16TargetMachine &TM); |
| 30 | |
Sanjiv Gupta | 085ae4f | 2008-11-19 11:00:54 +0000 | [diff] [blame] | 31 | virtual const PIC16RegisterInfo &getRegisterInfo() const { return RegInfo; } |
Sanjiv Gupta | 09bb420 | 2008-05-13 09:02:57 +0000 | [diff] [blame] | 32 | |
Sanjiv Gupta | 09bb420 | 2008-05-13 09:02:57 +0000 | [diff] [blame] | 33 | /// isLoadFromStackSlot - If the specified machine instruction is a direct |
| 34 | /// load from a stack slot, return the virtual or physical register number of |
| 35 | /// the destination along with the FrameIndex of the loaded stack slot. If |
| 36 | /// not, return 0. This predicate must return 0 if the instruction has |
| 37 | /// any side effects other than loading from the stack slot. |
Sanjiv Gupta | c780d0e | 2008-11-19 11:27:59 +0000 | [diff] [blame] | 38 | virtual unsigned isLoadFromStackSlot(const MachineInstr *MI, |
| 39 | int &FrameIndex) const; |
Sanjiv Gupta | 085ae4f | 2008-11-19 11:00:54 +0000 | [diff] [blame] | 40 | |
Sanjiv Gupta | 09bb420 | 2008-05-13 09:02:57 +0000 | [diff] [blame] | 41 | /// isStoreToStackSlot - If the specified machine instruction is a direct |
| 42 | /// store to a stack slot, return the virtual or physical register number of |
| 43 | /// the source reg along with the FrameIndex of the loaded stack slot. If |
| 44 | /// not, return 0. This predicate must return 0 if the instruction has |
| 45 | /// any side effects other than storing to the stack slot. |
Sanjiv Gupta | c780d0e | 2008-11-19 11:27:59 +0000 | [diff] [blame] | 46 | virtual unsigned isStoreToStackSlot(const MachineInstr *MI, |
| 47 | int &FrameIndex) const; |
Sanjiv Gupta | 09bb420 | 2008-05-13 09:02:57 +0000 | [diff] [blame] | 48 | |
Sanjiv Gupta | 085ae4f | 2008-11-19 11:00:54 +0000 | [diff] [blame] | 49 | virtual void storeRegToStackSlot(MachineBasicBlock &MBB, |
| 50 | MachineBasicBlock::iterator MBBI, |
| 51 | unsigned SrcReg, bool isKill, int FrameIndex, |
| 52 | const TargetRegisterClass *RC) const; |
| 53 | |
| 54 | virtual void loadRegFromStackSlot(MachineBasicBlock &MBB, |
| 55 | MachineBasicBlock::iterator MBBI, |
| 56 | unsigned DestReg, int FrameIndex, |
| 57 | const TargetRegisterClass *RC) const; |
| 58 | virtual bool copyRegToReg(MachineBasicBlock &MBB, |
| 59 | MachineBasicBlock::iterator MBBI, |
| 60 | unsigned DestReg, unsigned SrcReg, |
| 61 | const TargetRegisterClass *DestRC, |
| 62 | const TargetRegisterClass *SrcRC) const; |
| 63 | virtual bool isMoveInstr(const MachineInstr &MI, |
Sanjiv Gupta | f06bc20 | 2009-01-21 09:02:46 +0000 | [diff] [blame] | 64 | unsigned &SrcReg, unsigned &DstReg, |
| 65 | unsigned &SrcSubIdx, unsigned &DstSubIdx) const; |
Sanjiv Gupta | 09bb420 | 2008-05-13 09:02:57 +0000 | [diff] [blame] | 66 | |
Sanjiv Gupta | 6f8dca8 | 2009-06-03 15:31:12 +0000 | [diff] [blame^] | 67 | virtual |
| 68 | unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, |
| 69 | MachineBasicBlock *FBB, |
| 70 | const SmallVectorImpl<MachineOperand> &Cond) const; |
| 71 | |
Sanjiv Gupta | 0ba7dab | 2009-05-12 04:30:38 +0000 | [diff] [blame] | 72 | }; |
Sanjiv Gupta | 09bb420 | 2008-05-13 09:02:57 +0000 | [diff] [blame] | 73 | } // namespace llvm |
| 74 | |
| 75 | #endif |