1 //===- MipsInstrInfo.h - Mips Instruction Information -----------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Bruno Cardoso Lopes and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the Mips implementation of the TargetInstrInfo class.
12 //===----------------------------------------------------------------------===//
14 #ifndef MIPSINSTRUCTIONINFO_H
15 #define MIPSINSTRUCTIONINFO_H
18 #include "llvm/Target/TargetInstrInfo.h"
19 #include "MipsRegisterInfo.h"
23 class MipsInstrInfo : public TargetInstrInfo
25 MipsTargetMachine &TM;
26 const MipsRegisterInfo RI;
28 MipsInstrInfo(MipsTargetMachine &TM);
30 /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As
31 /// such, whenever a client has an instance of instruction info, it should
32 /// always be able to get register info as well (through this method).
34 virtual const MRegisterInfo &getRegisterInfo() const { return RI; }
36 /// Return true if the instruction is a register to register move and
37 /// leave the source and dest operands in the passed parameters.
39 virtual bool isMoveInstr(const MachineInstr &MI,
40 unsigned &SrcReg, unsigned &DstReg) const;
42 /// isLoadFromStackSlot - If the specified machine instruction is a direct
43 /// load from a stack slot, return the virtual or physical register number of
44 /// the destination along with the FrameIndex of the loaded stack slot. If
45 /// not, return 0. This predicate must return 0 if the instruction has
46 /// any side effects other than loading from the stack slot.
47 virtual unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const;
49 /// isStoreToStackSlot - If the specified machine instruction is a direct
50 /// store to a stack slot, return the virtual or physical register number of
51 /// the source reg along with the FrameIndex of the loaded stack slot. If
52 /// not, return 0. This predicate must return 0 if the instruction has
53 /// any side effects other than storing to the stack slot.
54 virtual unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const;
56 virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
57 MachineBasicBlock *FBB,
58 const std::vector<MachineOperand> &Cond) const;