LLVM API Documentation
00001 //===- AlphaInstrInfo.h - Alpha 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 Alpha implementation of the TargetInstrInfo class. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef ALPHAINSTRUCTIONINFO_H 00015 #define ALPHAINSTRUCTIONINFO_H 00016 00017 #include "llvm/Target/TargetInstrInfo.h" 00018 #include "AlphaRegisterInfo.h" 00019 00020 namespace llvm { 00021 00022 class AlphaInstrInfo : public TargetInstrInfoImpl { 00023 const AlphaRegisterInfo RI; 00024 public: 00025 AlphaInstrInfo(); 00026 00027 /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As 00028 /// such, whenever a client has an instance of instruction info, it should 00029 /// always be able to get register info as well (through this method). 00030 /// 00031 virtual const AlphaRegisterInfo &getRegisterInfo() const { return RI; } 00032 00033 /// Return true if the instruction is a register to register move and 00034 /// leave the source and dest operands in the passed parameters. 00035 /// 00036 virtual bool isMoveInstr(const MachineInstr &MI, 00037 unsigned &SrcReg, unsigned &DstReg) const; 00038 00039 virtual unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const; 00040 virtual unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const; 00041 00042 virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, 00043 MachineBasicBlock *FBB, 00044 const SmallVectorImpl<MachineOperand> &Cond) const; 00045 virtual bool copyRegToReg(MachineBasicBlock &MBB, 00046 MachineBasicBlock::iterator MI, 00047 unsigned DestReg, unsigned SrcReg, 00048 const TargetRegisterClass *DestRC, 00049 const TargetRegisterClass *SrcRC) const; 00050 virtual void storeRegToStackSlot(MachineBasicBlock &MBB, 00051 MachineBasicBlock::iterator MBBI, 00052 unsigned SrcReg, bool isKill, int FrameIndex, 00053 const TargetRegisterClass *RC) const; 00054 00055 virtual void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, bool isKill, 00056 SmallVectorImpl<MachineOperand> &Addr, 00057 const TargetRegisterClass *RC, 00058 SmallVectorImpl<MachineInstr*> &NewMIs) const; 00059 00060 virtual void loadRegFromStackSlot(MachineBasicBlock &MBB, 00061 MachineBasicBlock::iterator MBBI, 00062 unsigned DestReg, int FrameIndex, 00063 const TargetRegisterClass *RC) const; 00064 00065 virtual void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, 00066 SmallVectorImpl<MachineOperand> &Addr, 00067 const TargetRegisterClass *RC, 00068 SmallVectorImpl<MachineInstr*> &NewMIs) const; 00069 00070 virtual MachineInstr* foldMemoryOperand(MachineFunction &MF, 00071 MachineInstr* MI, 00072 SmallVectorImpl<unsigned> &Ops, 00073 int FrameIndex) const; 00074 00075 virtual MachineInstr* foldMemoryOperand(MachineFunction &MF, 00076 MachineInstr* MI, 00077 SmallVectorImpl<unsigned> &Ops, 00078 MachineInstr* LoadMI) const { 00079 return 0; 00080 } 00081 00082 bool AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB, 00083 MachineBasicBlock *&FBB, 00084 SmallVectorImpl<MachineOperand> &Cond) const; 00085 unsigned RemoveBranch(MachineBasicBlock &MBB) const; 00086 void insertNoop(MachineBasicBlock &MBB, 00087 MachineBasicBlock::iterator MI) const; 00088 bool BlockHasNoFallThrough(MachineBasicBlock &MBB) const; 00089 bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const; 00090 }; 00091 00092 } 00093 00094 #endif