SparcRegisterInfo.h revision eceada67286f0d8081c23aedd242f4deeffa85ad
1//===- SparcRegisterInfo.h - Sparc Register Information Impl ----*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
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.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file contains the Sparc implementation of the MRegisterInfo class.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef SPARCREGISTERINFO_H
15#define SPARCREGISTERINFO_H
16
17#include "llvm/Target/MRegisterInfo.h"
18#include "SparcGenRegisterInfo.h.inc"
19
20namespace llvm {
21
22class SparcSubtarget;
23class TargetInstrInfo;
24class Type;
25
26struct SparcRegisterInfo : public SparcGenRegisterInfo {
27  SparcSubtarget &Subtarget;
28  const TargetInstrInfo &TII;
29
30  SparcRegisterInfo(SparcSubtarget &st, const TargetInstrInfo &tii);
31
32  /// Code Generation virtual methods...
33  void storeRegToStackSlot(MachineBasicBlock &MBB,
34                           MachineBasicBlock::iterator MBBI,
35                           unsigned SrcReg, int FrameIndex,
36                           const TargetRegisterClass *RC) const;
37
38  void loadRegFromStackSlot(MachineBasicBlock &MBB,
39                            MachineBasicBlock::iterator MBBI,
40                            unsigned DestReg, int FrameIndex,
41                            const TargetRegisterClass *RC) const;
42
43  void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
44                    unsigned DestReg, unsigned SrcReg,
45                    const TargetRegisterClass *RC) const;
46
47  virtual MachineInstr* foldMemoryOperand(MachineInstr* MI,
48                                          unsigned OpNum,
49                                          int FrameIndex) const;
50
51  const unsigned *getCalleeSavedRegs() const;
52
53  const TargetRegisterClass* const* getCalleeSavedRegClasses() const;
54
55  BitVector getReservedRegs(const MachineFunction &MF) const;
56
57  bool hasFP(const MachineFunction &MF) const;
58
59  void eliminateCallFramePseudoInstr(MachineFunction &MF,
60                                     MachineBasicBlock &MBB,
61                                     MachineBasicBlock::iterator I) const;
62
63  void eliminateFrameIndex(MachineBasicBlock::iterator II) const;
64
65  void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
66
67  void emitPrologue(MachineFunction &MF) const;
68  void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
69
70  // Debug information queries.
71  unsigned getRARegister() const;
72  unsigned getFrameRegister(MachineFunction &MF) const;
73};
74
75} // end namespace llvm
76
77#endif
78