blob: 40a4cb4ddb2d1731c640944893383aa4030e86f7 [file] [log] [blame]
Sanjiv Gupta0e687712008-05-13 09:02:57 +00001//===- 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
21namespace llvm {
22
23
24class PIC16InstrInfo : public TargetInstrInfoImpl
25{
26 PIC16TargetMachine &TM;
Sanjiv Guptab1b5ffd2008-11-19 11:00:54 +000027 const PIC16RegisterInfo RegInfo;
Sanjiv Gupta0e687712008-05-13 09:02:57 +000028public:
29 explicit PIC16InstrInfo(PIC16TargetMachine &TM);
30
Sanjiv Guptab1b5ffd2008-11-19 11:00:54 +000031 virtual const PIC16RegisterInfo &getRegisterInfo() const { return RegInfo; }
Sanjiv Gupta0e687712008-05-13 09:02:57 +000032
Sanjiv Gupta0e687712008-05-13 09:02:57 +000033 /// 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 Gupta863d3e92008-11-19 11:27:59 +000038 virtual unsigned isLoadFromStackSlot(const MachineInstr *MI,
39 int &FrameIndex) const;
Sanjiv Guptab1b5ffd2008-11-19 11:00:54 +000040
Sanjiv Gupta0e687712008-05-13 09:02:57 +000041 /// 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 Gupta863d3e92008-11-19 11:27:59 +000046 virtual unsigned isStoreToStackSlot(const MachineInstr *MI,
47 int &FrameIndex) const;
Sanjiv Gupta0e687712008-05-13 09:02:57 +000048
Sanjiv Guptab1b5ffd2008-11-19 11:00:54 +000049 virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
50 MachineBasicBlock::iterator MBBI,
51 unsigned SrcReg, bool isKill, int FrameIndex,
Evan Cheng746ad692010-05-06 19:06:44 +000052 const TargetRegisterClass *RC,
53 const TargetRegisterInfo *TRI) const;
Sanjiv Guptab1b5ffd2008-11-19 11:00:54 +000054
55 virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
56 MachineBasicBlock::iterator MBBI,
57 unsigned DestReg, int FrameIndex,
Evan Cheng746ad692010-05-06 19:06:44 +000058 const TargetRegisterClass *RC,
59 const TargetRegisterInfo *TRI) const;
Sanjiv Guptab1b5ffd2008-11-19 11:00:54 +000060 virtual bool copyRegToReg(MachineBasicBlock &MBB,
61 MachineBasicBlock::iterator MBBI,
62 unsigned DestReg, unsigned SrcReg,
63 const TargetRegisterClass *DestRC,
Dan Gohman34dcc6f2010-05-06 20:33:48 +000064 const TargetRegisterClass *SrcRC,
65 DebugLoc DL) const;
Sanjiv Guptab1b5ffd2008-11-19 11:00:54 +000066 virtual bool isMoveInstr(const MachineInstr &MI,
Sanjiv Gupta25305662009-01-21 09:02:46 +000067 unsigned &SrcReg, unsigned &DstReg,
68 unsigned &SrcSubIdx, unsigned &DstSubIdx) const;
Sanjiv Gupta0e687712008-05-13 09:02:57 +000069
Sanjiv Gupta892c8ca2009-06-03 15:31:12 +000070 virtual
71 unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
72 MachineBasicBlock *FBB,
73 const SmallVectorImpl<MachineOperand> &Cond) const;
Sanjiv Guptae70b8972009-10-27 17:40:24 +000074 virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
75 MachineBasicBlock *&FBB,
76 SmallVectorImpl<MachineOperand> &Cond,
77 bool AllowModify) const;
Sanjiv Guptaed4f4fb2009-05-12 04:30:38 +000078 };
Sanjiv Gupta0e687712008-05-13 09:02:57 +000079} // namespace llvm
80
81#endif