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) const;
47 virtual bool copyRegToReg(MachineBasicBlock &MBB,
48 MachineBasicBlock::iterator MI,
49 unsigned DestReg, unsigned SrcReg,
50 const TargetRegisterClass *DestRC,
51 const TargetRegisterClass *SrcRC,
53 virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
54 MachineBasicBlock::iterator MBBI,
55 unsigned SrcReg, bool isKill, int FrameIndex,
56 const TargetRegisterClass *RC,
57 const TargetRegisterInfo *TRI) const;
59 virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
60 MachineBasicBlock::iterator MBBI,
61 unsigned DestReg, int FrameIndex,
62 const TargetRegisterClass *RC,
63 const TargetRegisterInfo *TRI) const;
65 virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF,
67 const SmallVectorImpl<unsigned> &Ops,
68 int FrameIndex) const;
70 virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF,
72 const SmallVectorImpl<unsigned> &Ops,
73 MachineInstr* LoadMI) const {
77 bool AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB,
78 MachineBasicBlock *&FBB,
79 SmallVectorImpl<MachineOperand> &Cond,
80 bool AllowModify) const;
81 unsigned RemoveBranch(MachineBasicBlock &MBB) const;
82 void insertNoop(MachineBasicBlock &MBB,
83 MachineBasicBlock::iterator MI) const;
84 bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const;
86 /// getGlobalBaseReg - Return a virtual register initialized with the
87 /// the global base register value. Output instructions required to
88 /// initialize the register in the function entry block, if necessary.
90 unsigned getGlobalBaseReg(MachineFunction *MF) const;
92 /// getGlobalRetAddr - Return a virtual register initialized with the
93 /// the global return address register value. Output instructions required to
94 /// initialize the register in the function entry block, if necessary.
96 unsigned getGlobalRetAddr(MachineFunction *MF) const;