LLVM API Documentation
00001 //===- SparcInstrInfo.h - Sparc Instruction Information ---------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file contains the Sparc implementation of the TargetInstrInfo class. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef SPARCINSTRUCTIONINFO_H 00015 #define SPARCINSTRUCTIONINFO_H 00016 00017 #include "llvm/Target/TargetInstrInfo.h" 00018 #include "SparcRegisterInfo.h" 00019 00020 namespace llvm { 00021 00022 /// SPII - This namespace holds all of the target specific flags that 00023 /// instruction info tracks. 00024 /// 00025 namespace SPII { 00026 enum { 00027 Pseudo = (1<<0), 00028 Load = (1<<1), 00029 Store = (1<<2), 00030 DelaySlot = (1<<3) 00031 }; 00032 } 00033 00034 class SparcInstrInfo : public TargetInstrInfoImpl { 00035 const SparcRegisterInfo RI; 00036 const SparcSubtarget& Subtarget; 00037 public: 00038 explicit SparcInstrInfo(SparcSubtarget &ST); 00039 00040 /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As 00041 /// such, whenever a client has an instance of instruction info, it should 00042 /// always be able to get register info as well (through this method). 00043 /// 00044 virtual const SparcRegisterInfo &getRegisterInfo() const { return RI; } 00045 00046 /// Return true if the instruction is a register to register move and 00047 /// leave the source and dest operands in the passed parameters. 00048 /// 00049 virtual bool isMoveInstr(const MachineInstr &MI, 00050 unsigned &SrcReg, unsigned &DstReg) const; 00051 00052 /// isLoadFromStackSlot - If the specified machine instruction is a direct 00053 /// load from a stack slot, return the virtual or physical register number of 00054 /// the destination along with the FrameIndex of the loaded stack slot. If 00055 /// not, return 0. This predicate must return 0 if the instruction has 00056 /// any side effects other than loading from the stack slot. 00057 virtual unsigned isLoadFromStackSlot(const MachineInstr *MI, 00058 int &FrameIndex) const; 00059 00060 /// isStoreToStackSlot - If the specified machine instruction is a direct 00061 /// store to a stack slot, return the virtual or physical register number of 00062 /// the source reg along with the FrameIndex of the loaded stack slot. If 00063 /// not, return 0. This predicate must return 0 if the instruction has 00064 /// any side effects other than storing to the stack slot. 00065 virtual unsigned isStoreToStackSlot(const MachineInstr *MI, 00066 int &FrameIndex) const; 00067 00068 00069 virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, 00070 MachineBasicBlock *FBB, 00071 const SmallVectorImpl<MachineOperand> &Cond) const; 00072 00073 virtual bool copyRegToReg(MachineBasicBlock &MBB, 00074 MachineBasicBlock::iterator I, 00075 unsigned DestReg, unsigned SrcReg, 00076 const TargetRegisterClass *DestRC, 00077 const TargetRegisterClass *SrcRC) const; 00078 00079 virtual void storeRegToStackSlot(MachineBasicBlock &MBB, 00080 MachineBasicBlock::iterator MBBI, 00081 unsigned SrcReg, bool isKill, int FrameIndex, 00082 const TargetRegisterClass *RC) const; 00083 00084 virtual void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, bool isKill, 00085 SmallVectorImpl<MachineOperand> &Addr, 00086 const TargetRegisterClass *RC, 00087 SmallVectorImpl<MachineInstr*> &NewMIs) const; 00088 00089 virtual void loadRegFromStackSlot(MachineBasicBlock &MBB, 00090 MachineBasicBlock::iterator MBBI, 00091 unsigned DestReg, int FrameIndex, 00092 const TargetRegisterClass *RC) const; 00093 00094 virtual void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, 00095 SmallVectorImpl<MachineOperand> &Addr, 00096 const TargetRegisterClass *RC, 00097 SmallVectorImpl<MachineInstr*> &NewMIs) const; 00098 00099 virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF, 00100 MachineInstr* MI, 00101 const SmallVectorImpl<unsigned> &Ops, 00102 int FrameIndex) const; 00103 00104 virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF, 00105 MachineInstr* MI, 00106 const SmallVectorImpl<unsigned> &Ops, 00107 MachineInstr* LoadMI) const { 00108 return 0; 00109 } 00110 }; 00111 00112 } 00113 00114 #endif
This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.