blob: bd3e48858fe1fdb44eb4bdb1005feee738f56349 [file] [log] [blame]
Sanjiv Gupta09bb4202008-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 Gupta085ae4f2008-11-19 11:00:54 +000027 const PIC16RegisterInfo RegInfo;
Sanjiv Gupta09bb4202008-05-13 09:02:57 +000028public:
29 explicit PIC16InstrInfo(PIC16TargetMachine &TM);
30
Sanjiv Gupta085ae4f2008-11-19 11:00:54 +000031 virtual const PIC16RegisterInfo &getRegisterInfo() const { return RegInfo; }
Sanjiv Gupta09bb4202008-05-13 09:02:57 +000032
Sanjiv Gupta09bb4202008-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 Gupta085ae4f2008-11-19 11:00:54 +000038 virtual unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const;
39
Sanjiv Gupta09bb4202008-05-13 09:02:57 +000040 /// isStoreToStackSlot - If the specified machine instruction is a direct
41 /// store to a stack slot, return the virtual or physical register number of
42 /// the source reg along with the FrameIndex of the loaded stack slot. If
43 /// not, return 0. This predicate must return 0 if the instruction has
44 /// any side effects other than storing to the stack slot.
Sanjiv Gupta085ae4f2008-11-19 11:00:54 +000045 virtual unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const;
Sanjiv Gupta09bb4202008-05-13 09:02:57 +000046
Sanjiv Gupta085ae4f2008-11-19 11:00:54 +000047 virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
48 MachineBasicBlock::iterator MBBI,
49 unsigned SrcReg, bool isKill, int FrameIndex,
50 const TargetRegisterClass *RC) const;
51
52 virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
53 MachineBasicBlock::iterator MBBI,
54 unsigned DestReg, int FrameIndex,
55 const TargetRegisterClass *RC) const;
56 virtual bool copyRegToReg(MachineBasicBlock &MBB,
57 MachineBasicBlock::iterator MBBI,
58 unsigned DestReg, unsigned SrcReg,
59 const TargetRegisterClass *DestRC,
60 const TargetRegisterClass *SrcRC) const;
61 virtual bool isMoveInstr(const MachineInstr &MI,
62 unsigned &SrcReg,
63 unsigned &DestReg) const;
Sanjiv Gupta09bb4202008-05-13 09:02:57 +000064
65};
66
67} // namespace llvm
68
69#endif