1235633Sdim//===-- SparcInstrInfo.h - Sparc Instruction Information --------*- C++ -*-===// 2193323Sed// 3193323Sed// The LLVM Compiler Infrastructure 4193323Sed// 5193323Sed// This file is distributed under the University of Illinois Open Source 6193323Sed// License. See LICENSE.TXT for details. 7193323Sed// 8193323Sed//===----------------------------------------------------------------------===// 9193323Sed// 10193323Sed// This file contains the Sparc implementation of the TargetInstrInfo class. 11193323Sed// 12193323Sed//===----------------------------------------------------------------------===// 13193323Sed 14193323Sed#ifndef SPARCINSTRUCTIONINFO_H 15193323Sed#define SPARCINSTRUCTIONINFO_H 16193323Sed 17235633Sdim#include "SparcRegisterInfo.h" 18193323Sed#include "llvm/Target/TargetInstrInfo.h" 19193323Sed 20224145Sdim#define GET_INSTRINFO_HEADER 21224145Sdim#include "SparcGenInstrInfo.inc" 22224145Sdim 23193323Sednamespace llvm { 24193323Sed 25193323Sed/// SPII - This namespace holds all of the target specific flags that 26193323Sed/// instruction info tracks. 27193323Sed/// 28193323Sednamespace SPII { 29193323Sed enum { 30193323Sed Pseudo = (1<<0), 31193323Sed Load = (1<<1), 32193323Sed Store = (1<<2), 33193323Sed DelaySlot = (1<<3) 34193323Sed }; 35193323Sed} 36193323Sed 37224145Sdimclass SparcInstrInfo : public SparcGenInstrInfo { 38193323Sed const SparcRegisterInfo RI; 39193323Sed const SparcSubtarget& Subtarget; 40263509Sdim virtual void anchor(); 41193323Sedpublic: 42193323Sed explicit SparcInstrInfo(SparcSubtarget &ST); 43193323Sed 44193323Sed /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As 45193323Sed /// such, whenever a client has an instance of instruction info, it should 46193323Sed /// always be able to get register info as well (through this method). 47193323Sed /// 48193323Sed virtual const SparcRegisterInfo &getRegisterInfo() const { return RI; } 49193323Sed 50193323Sed /// isLoadFromStackSlot - If the specified machine instruction is a direct 51193323Sed /// load from a stack slot, return the virtual or physical register number of 52193323Sed /// the destination along with the FrameIndex of the loaded stack slot. If 53193323Sed /// not, return 0. This predicate must return 0 if the instruction has 54193323Sed /// any side effects other than loading from the stack slot. 55193323Sed virtual unsigned isLoadFromStackSlot(const MachineInstr *MI, 56193323Sed int &FrameIndex) const; 57263509Sdim 58193323Sed /// isStoreToStackSlot - If the specified machine instruction is a direct 59193323Sed /// store to a stack slot, return the virtual or physical register number of 60193323Sed /// the source reg along with the FrameIndex of the loaded stack slot. If 61193323Sed /// not, return 0. This predicate must return 0 if the instruction has 62193323Sed /// any side effects other than storing to the stack slot. 63193323Sed virtual unsigned isStoreToStackSlot(const MachineInstr *MI, 64193323Sed int &FrameIndex) const; 65218893Sdim 66218893Sdim virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, 67218893Sdim MachineBasicBlock *&FBB, 68218893Sdim SmallVectorImpl<MachineOperand> &Cond, 69218893Sdim bool AllowModify = false) const ; 70218893Sdim 71218893Sdim virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const; 72218893Sdim 73193323Sed virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, 74193323Sed MachineBasicBlock *FBB, 75210299Sed const SmallVectorImpl<MachineOperand> &Cond, 76210299Sed DebugLoc DL) const; 77193323Sed 78210299Sed virtual void copyPhysReg(MachineBasicBlock &MBB, 79210299Sed MachineBasicBlock::iterator I, DebugLoc DL, 80210299Sed unsigned DestReg, unsigned SrcReg, 81210299Sed bool KillSrc) const; 82263509Sdim 83193323Sed virtual void storeRegToStackSlot(MachineBasicBlock &MBB, 84193323Sed MachineBasicBlock::iterator MBBI, 85193323Sed unsigned SrcReg, bool isKill, int FrameIndex, 86208599Srdivacky const TargetRegisterClass *RC, 87208599Srdivacky const TargetRegisterInfo *TRI) const; 88193323Sed 89193323Sed virtual void loadRegFromStackSlot(MachineBasicBlock &MBB, 90193323Sed MachineBasicBlock::iterator MBBI, 91193323Sed unsigned DestReg, int FrameIndex, 92208599Srdivacky const TargetRegisterClass *RC, 93208599Srdivacky const TargetRegisterInfo *TRI) const; 94263509Sdim 95198090Srdivacky unsigned getGlobalBaseReg(MachineFunction *MF) const; 96193323Sed}; 97193323Sed 98193323Sed} 99193323Sed 100193323Sed#endif 101