1 //===- SparcRegisterInfo.h - Sparc Register Information Impl ----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the Sparc implementation of the MRegisterInfo class.
12 //===----------------------------------------------------------------------===//
14 #ifndef SPARCREGISTERINFO_H
15 #define SPARCREGISTERINFO_H
17 #include "llvm/Target/MRegisterInfo.h"
18 #include "SparcGenRegisterInfo.h.inc"
23 class TargetInstrInfo;
26 struct SparcRegisterInfo : public SparcGenRegisterInfo {
27 SparcSubtarget &Subtarget;
28 const TargetInstrInfo &TII;
30 SparcRegisterInfo(SparcSubtarget &st, const TargetInstrInfo &tii);
32 /// Code Generation virtual methods...
33 void storeRegToStackSlot(MachineBasicBlock &MBB,
34 MachineBasicBlock::iterator MBBI,
35 unsigned SrcReg, int FrameIndex,
36 const TargetRegisterClass *RC) const;
38 void loadRegFromStackSlot(MachineBasicBlock &MBB,
39 MachineBasicBlock::iterator MBBI,
40 unsigned DestReg, int FrameIndex,
41 const TargetRegisterClass *RC) const;
43 void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
44 unsigned DestReg, unsigned SrcReg,
45 const TargetRegisterClass *DestRC,
46 const TargetRegisterClass *SrcRC) const;
48 void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
49 unsigned DestReg, const MachineInstr *Orig) const;
51 virtual MachineInstr* foldMemoryOperand(MachineInstr* MI,
53 int FrameIndex) const;
55 virtual MachineInstr* foldMemoryOperand(MachineInstr* MI,
57 MachineInstr* LoadMI) const {
61 const unsigned *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
63 const TargetRegisterClass* const* getCalleeSavedRegClasses(
64 const MachineFunction *MF = 0) const;
66 BitVector getReservedRegs(const MachineFunction &MF) const;
68 bool hasFP(const MachineFunction &MF) const;
70 void eliminateCallFramePseudoInstr(MachineFunction &MF,
71 MachineBasicBlock &MBB,
72 MachineBasicBlock::iterator I) const;
74 void eliminateFrameIndex(MachineBasicBlock::iterator II,
75 int SPAdj, RegScavenger *RS = NULL) const;
77 void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
79 void emitPrologue(MachineFunction &MF) const;
80 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
82 // Debug information queries.
83 unsigned getRARegister() const;
84 unsigned getFrameRegister(MachineFunction &MF) const;
86 // Exception handling queries.
87 unsigned getEHExceptionRegister() const;
88 unsigned getEHHandlerRegister() const;
91 } // end namespace llvm