1 //===- MipsRegisterInfo.h - Mips Register Information Impl ------*- 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 Mips implementation of the MRegisterInfo class.
12 //===----------------------------------------------------------------------===//
14 #ifndef MIPSREGISTERINFO_H
15 #define MIPSREGISTERINFO_H
17 #include "llvm/Target/MRegisterInfo.h"
18 #include "MipsGenRegisterInfo.h.inc"
22 class TargetInstrInfo;
25 struct MipsRegisterInfo : public MipsGenRegisterInfo {
26 const TargetInstrInfo &TII;
28 MipsRegisterInfo(const TargetInstrInfo &tii);
30 /// getRegisterNumbering - Given the enum value for some register, e.g.
31 /// Mips::RA, return the number that it corresponds to (e.g. 31).
32 static unsigned getRegisterNumbering(unsigned RegEnum);
34 /// Code Generation virtual methods...
35 void storeRegToStackSlot(MachineBasicBlock &MBB,
36 MachineBasicBlock::iterator MBBI,
37 unsigned SrcReg, bool isKill, int FrameIndex,
38 const TargetRegisterClass *RC) const;
40 void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, bool isKill,
41 SmallVectorImpl<MachineOperand> &Addr,
42 const TargetRegisterClass *RC,
43 SmallVectorImpl<MachineInstr*> &NewMIs) const;
45 void loadRegFromStackSlot(MachineBasicBlock &MBB,
46 MachineBasicBlock::iterator MBBI,
47 unsigned DestReg, int FrameIndex,
48 const TargetRegisterClass *RC) const;
50 void loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
51 SmallVectorImpl<MachineOperand> &Addr,
52 const TargetRegisterClass *RC,
53 SmallVectorImpl<MachineInstr*> &NewMIs) const;
55 void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
56 unsigned DestReg, const MachineInstr *Orig) const;
58 MachineInstr* foldMemoryOperand(MachineInstr* MI,
59 SmallVectorImpl<unsigned> &Ops,
60 int FrameIndex) const;
62 MachineInstr* foldMemoryOperand(MachineInstr* MI,
63 SmallVectorImpl<unsigned> &Ops,
64 MachineInstr* LoadMI) const {
68 void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
69 unsigned DestReg, unsigned SrcReg,
70 const TargetRegisterClass *DestRC,
71 const TargetRegisterClass *SrcRC) const;
74 const unsigned *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
76 const TargetRegisterClass* const*
77 getCalleeSavedRegClasses(const MachineFunction* MF = 0) const;
79 BitVector getReservedRegs(const MachineFunction &MF) const;
81 bool hasFP(const MachineFunction &MF) const;
83 void eliminateCallFramePseudoInstr(MachineFunction &MF,
84 MachineBasicBlock &MBB,
85 MachineBasicBlock::iterator I) const;
87 /// Stack Frame Processing Methods
88 void eliminateFrameIndex(MachineBasicBlock::iterator II,
89 int SPAdj, RegScavenger *RS = NULL) const;
91 void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
93 void emitPrologue(MachineFunction &MF) const;
94 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
96 /// Debug information queries.
97 unsigned getRARegister() const;
98 unsigned getFrameRegister(MachineFunction &MF) const;
100 /// Exception handling queries.
101 unsigned getEHExceptionRegister() const;
102 unsigned getEHHandlerRegister() const;
104 int getDwarfRegNum(unsigned RegNum, bool isEH) const;
107 } // end namespace llvm