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 loadRegFromStackSlot(MachineBasicBlock &MBB,
00058                                     MachineBasicBlock::iterator MBBI,
00059                                     unsigned DestReg, int FrameIndex,
00060                                     const TargetRegisterClass *RC) const;
00061   
00062   virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF,
00063                                               MachineInstr* MI,
00064                                            const SmallVectorImpl<unsigned> &Ops,
00065                                               int FrameIndex) const;
00066 
00067   virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF,
00068                                               MachineInstr* MI,
00069                                            const SmallVectorImpl<unsigned> &Ops,
00070                                               MachineInstr* LoadMI) const {
00071     return 0;
00072   }
00073   
00074   bool AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB,
00075                      MachineBasicBlock *&FBB,
00076                      SmallVectorImpl<MachineOperand> &Cond,
00077                      bool AllowModify) const;
00078   unsigned RemoveBranch(MachineBasicBlock &MBB) const;
00079   void insertNoop(MachineBasicBlock &MBB, 
00080                   MachineBasicBlock::iterator MI) const;
00081   bool BlockHasNoFallThrough(const MachineBasicBlock &MBB) const;
00082   bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const;
00083 
00084   /// getGlobalBaseReg - Return a virtual register initialized with the
00085   /// the global base register value. Output instructions required to
00086   /// initialize the register in the function entry block, if necessary.
00087   ///
00088   unsigned getGlobalBaseReg(MachineFunction *MF) const;
00089 
00090   /// getGlobalRetAddr - Return a virtual register initialized with the
00091   /// the global return address register value. Output instructions required to
00092   /// initialize the register in the function entry block, if necessary.
00093   ///
00094   unsigned getGlobalRetAddr(MachineFunction *MF) const;
00095 };
00096 
00097 }
00098 
00099 #endif