LLVM API Documentation

AlphaInstrInfo.h

Go to the documentation of this file.
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 return
00034   /// the source and dest operands and their sub-register indices by reference.
00035   virtual bool isMoveInstr(const MachineInstr &MI,
00036                            unsigned &SrcReg, unsigned &DstReg,
00037                            unsigned &SrcSubIdx, unsigned &DstSubIdx) const;
00038   
00039   virtual unsigned isLoadFromStackSlot(const MachineInstr *MI,
00040                                        int &FrameIndex) const;
00041   virtual unsigned isStoreToStackSlot(const MachineInstr *MI,
00042                                       int &FrameIndex) const;
00043   
00044   virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
00045                             MachineBasicBlock *FBB,
00046                             const SmallVectorImpl<MachineOperand> &Cond) const;
00047   virtual bool copyRegToReg(MachineBasicBlock &MBB,
00048                             MachineBasicBlock::iterator MI,
00049                             unsigned DestReg, unsigned SrcReg,
00050                             const TargetRegisterClass *DestRC,
00051                             const TargetRegisterClass *SrcRC) const;
00052   virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
00053                                    MachineBasicBlock::iterator MBBI,
00054                                    unsigned SrcReg, bool isKill, int FrameIndex,
00055                                    const TargetRegisterClass *RC) const;
00056 
00057   virtual void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, bool isKill,
00058                               SmallVectorImpl<MachineOperand> &Addr,
00059                               const TargetRegisterClass *RC,
00060                               SmallVectorImpl<MachineInstr*> &NewMIs) const;
00061 
00062   virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
00063                                     MachineBasicBlock::iterator MBBI,
00064                                     unsigned DestReg, int FrameIndex,
00065                                     const TargetRegisterClass *RC) const;
00066 
00067   virtual void loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
00068                                SmallVectorImpl<MachineOperand> &Addr,
00069                                const TargetRegisterClass *RC,
00070                                SmallVectorImpl<MachineInstr*> &NewMIs) const;
00071   
00072   virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF,
00073                                               MachineInstr* MI,
00074                                            const SmallVectorImpl<unsigned> &Ops,
00075                                               int FrameIndex) const;
00076 
00077   virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF,
00078                                               MachineInstr* MI,
00079                                            const SmallVectorImpl<unsigned> &Ops,
00080                                               MachineInstr* LoadMI) const {
00081     return 0;
00082   }
00083   
00084   bool AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB,
00085                      MachineBasicBlock *&FBB,
00086                      SmallVectorImpl<MachineOperand> &Cond,
00087                      bool AllowModify) const;
00088   unsigned RemoveBranch(MachineBasicBlock &MBB) const;
00089   void insertNoop(MachineBasicBlock &MBB, 
00090                   MachineBasicBlock::iterator MI) const;
00091   bool BlockHasNoFallThrough(const MachineBasicBlock &MBB) const;
00092   bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const;
00093 };
00094 
00095 }
00096 
00097 #endif