1 //===- AlphaInstrInfo.h - Alpha Instruction Information ---------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the Alpha implementation of the TargetInstrInfo class.
12 //===----------------------------------------------------------------------===//
14 #ifndef ALPHAINSTRUCTIONINFO_H
15 #define ALPHAINSTRUCTIONINFO_H
17 #include "llvm/Target/TargetInstrInfo.h"
18 #include "AlphaRegisterInfo.h"
22 class AlphaInstrInfo : public TargetInstrInfoImpl {
23 const AlphaRegisterInfo RI;
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).
31 virtual const AlphaRegisterInfo &getRegisterInfo() const { return RI; }
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;
39 virtual unsigned isLoadFromStackSlot(const MachineInstr *MI,
40 int &FrameIndex) const;
41 virtual unsigned isStoreToStackSlot(const MachineInstr *MI,
42 int &FrameIndex) const;
44 virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
45 MachineBasicBlock *FBB,
46 const SmallVectorImpl<MachineOperand> &Cond,
48 virtual bool copyRegToReg(MachineBasicBlock &MBB,
49 MachineBasicBlock::iterator MI,
50 unsigned DestReg, unsigned SrcReg,
51 const TargetRegisterClass *DestRC,
52 const TargetRegisterClass *SrcRC,
54 virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
55 MachineBasicBlock::iterator MBBI,
56 unsigned SrcReg, bool isKill, int FrameIndex,
57 const TargetRegisterClass *RC,
58 const TargetRegisterInfo *TRI) const;
60 virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
61 MachineBasicBlock::iterator MBBI,
62 unsigned DestReg, int FrameIndex,
63 const TargetRegisterClass *RC,
64 const TargetRegisterInfo *TRI) const;
66 virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF,
68 const SmallVectorImpl<unsigned> &Ops,
69 int FrameIndex) const;
71 virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF,
73 const SmallVectorImpl<unsigned> &Ops,
74 MachineInstr* LoadMI) const {
78 bool AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB,
79 MachineBasicBlock *&FBB,
80 SmallVectorImpl<MachineOperand> &Cond,
81 bool AllowModify) const;
82 unsigned RemoveBranch(MachineBasicBlock &MBB) const;
83 void insertNoop(MachineBasicBlock &MBB,
84 MachineBasicBlock::iterator MI) const;
85 bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const;
87 /// getGlobalBaseReg - Return a virtual register initialized with the
88 /// the global base register value. Output instructions required to
89 /// initialize the register in the function entry block, if necessary.
91 unsigned getGlobalBaseReg(MachineFunction *MF) const;
93 /// getGlobalRetAddr - Return a virtual register initialized with the
94 /// the global return address register value. Output instructions required to
95 /// initialize the register in the function entry block, if necessary.
97 unsigned getGlobalRetAddr(MachineFunction *MF) const;