Remove the target hook TargetInstrInfo::BlockHasNoFallThrough in favor of
[oota-llvm.git] / lib / Target / Alpha / AlphaInstrInfo.h
1 //===- AlphaInstrInfo.h - Alpha Instruction Information ---------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the Alpha implementation of the TargetInstrInfo class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef ALPHAINSTRUCTIONINFO_H
15 #define ALPHAINSTRUCTIONINFO_H
16
17 #include "llvm/Target/TargetInstrInfo.h"
18 #include "AlphaRegisterInfo.h"
19
20 namespace llvm {
21
22 class AlphaInstrInfo : public TargetInstrInfoImpl {
23   const AlphaRegisterInfo RI;
24 public:
25   AlphaInstrInfo();
26
27   /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info.  As
28   /// such, whenever a client has an instance of instruction info, it should
29   /// always be able to get register info as well (through this method).
30   ///
31   virtual const AlphaRegisterInfo &getRegisterInfo() const { return RI; }
32
33   /// Return true if the instruction is a register to register move and return
34   /// the source and dest operands and their sub-register indices by reference.
35   virtual bool isMoveInstr(const MachineInstr &MI,
36                            unsigned &SrcReg, unsigned &DstReg,
37                            unsigned &SrcSubIdx, unsigned &DstSubIdx) const;
38   
39   virtual unsigned isLoadFromStackSlot(const MachineInstr *MI,
40                                        int &FrameIndex) const;
41   virtual unsigned isStoreToStackSlot(const MachineInstr *MI,
42                                       int &FrameIndex) const;
43   
44   virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
45                             MachineBasicBlock *FBB,
46                             const SmallVectorImpl<MachineOperand> &Cond) const;
47   virtual bool copyRegToReg(MachineBasicBlock &MBB,
48                             MachineBasicBlock::iterator MI,
49                             unsigned DestReg, unsigned SrcReg,
50                             const TargetRegisterClass *DestRC,
51                             const TargetRegisterClass *SrcRC) const;
52   virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
53                                    MachineBasicBlock::iterator MBBI,
54                                    unsigned SrcReg, bool isKill, int FrameIndex,
55                                    const TargetRegisterClass *RC) const;
56
57   virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
58                                     MachineBasicBlock::iterator MBBI,
59                                     unsigned DestReg, int FrameIndex,
60                                     const TargetRegisterClass *RC) const;
61   
62   virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF,
63                                               MachineInstr* MI,
64                                            const SmallVectorImpl<unsigned> &Ops,
65                                               int FrameIndex) const;
66
67   virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF,
68                                               MachineInstr* MI,
69                                            const SmallVectorImpl<unsigned> &Ops,
70                                               MachineInstr* LoadMI) const {
71     return 0;
72   }
73   
74   bool AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB,
75                      MachineBasicBlock *&FBB,
76                      SmallVectorImpl<MachineOperand> &Cond,
77                      bool AllowModify) const;
78   unsigned RemoveBranch(MachineBasicBlock &MBB) const;
79   void insertNoop(MachineBasicBlock &MBB, 
80                   MachineBasicBlock::iterator MI) const;
81   bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const;
82
83   /// getGlobalBaseReg - Return a virtual register initialized with the
84   /// the global base register value. Output instructions required to
85   /// initialize the register in the function entry block, if necessary.
86   ///
87   unsigned getGlobalBaseReg(MachineFunction *MF) const;
88
89   /// getGlobalRetAddr - Return a virtual register initialized with the
90   /// the global return address register value. Output instructions required to
91   /// initialize the register in the function entry block, if necessary.
92   ///
93   unsigned getGlobalRetAddr(MachineFunction *MF) const;
94 };
95
96 }
97
98 #endif