Teach sparc to fold loads/stores into copies.
[oota-llvm.git] / lib / Target / Sparc / SparcRegisterInfo.h
1 //===- SparcV8RegisterInfo.h - SparcV8 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 SparcV8 implementation of the MRegisterInfo class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef SPARCV8REGISTERINFO_H
15 #define SPARCV8REGISTERINFO_H
16
17 #include "llvm/Target/MRegisterInfo.h"
18 #include "SparcV8GenRegisterInfo.h.inc"
19
20 namespace llvm {
21
22 class Type;
23
24 struct SparcV8RegisterInfo : public SparcV8GenRegisterInfo {
25   SparcV8RegisterInfo();
26
27   /// Code Generation virtual methods...
28   void storeRegToStackSlot(MachineBasicBlock &MBB,
29                            MachineBasicBlock::iterator MBBI,
30                            unsigned SrcReg, int FrameIndex,
31                            const TargetRegisterClass *RC) const;
32
33   void loadRegFromStackSlot(MachineBasicBlock &MBB,
34                             MachineBasicBlock::iterator MBBI,
35                             unsigned DestReg, int FrameIndex,
36                             const TargetRegisterClass *RC) const;
37
38   void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
39                     unsigned DestReg, unsigned SrcReg,
40                     const TargetRegisterClass *RC) const;
41   
42   virtual MachineInstr* foldMemoryOperand(MachineInstr* MI,
43                                           unsigned OpNum,
44                                           int FrameIndex) const;
45
46   void eliminateCallFramePseudoInstr(MachineFunction &MF,
47                                      MachineBasicBlock &MBB,
48                                      MachineBasicBlock::iterator I) const;
49
50   void eliminateFrameIndex(MachineBasicBlock::iterator II) const;
51
52   void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
53
54   void emitPrologue(MachineFunction &MF) const;
55   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
56 };
57
58 } // end namespace llvm
59
60 #endif