Eliminate PowerPC.td and PPC32.td, consolidating them into PPC.td
[oota-llvm.git] / lib / Target / PowerPC / PPCRegisterInfo.h
1 //===- PPC32RegisterInfo.h - PowerPC32 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 PowerPC implementation of the MRegisterInfo class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef POWERPC32_REGISTERINFO_H
15 #define POWERPC32_REGISTERINFO_H
16
17 #include "PowerPC.h"
18 #include "PPCGenRegisterInfo.h.inc"
19 #include <map>
20
21 namespace llvm {
22
23 class Type;
24
25 class PPC32RegisterInfo : public PPCGenRegisterInfo {
26   std::map<unsigned, unsigned> ImmToIdxMap;
27 public:
28   PPC32RegisterInfo();
29
30   /// Code Generation virtual methods...
31   void storeRegToStackSlot(MachineBasicBlock &MBB,
32                            MachineBasicBlock::iterator MBBI,
33                            unsigned SrcReg, int FrameIndex,
34                            const TargetRegisterClass *RC) const;
35
36   void loadRegFromStackSlot(MachineBasicBlock &MBB,
37                             MachineBasicBlock::iterator MBBI,
38                             unsigned DestReg, int FrameIndex,
39                             const TargetRegisterClass *RC) const;
40
41   void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
42                     unsigned DestReg, unsigned SrcReg,
43                     const TargetRegisterClass *RC) const;
44
45   unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const;
46     
47   /// foldMemoryOperand - PowerPC (like most RISC's) can only fold spills into
48   /// copy instructions, turning them into load/store instructions.
49   virtual MachineInstr* foldMemoryOperand(MachineInstr* MI, unsigned OpNum,
50                                           int FrameIndex) const;
51   
52   void eliminateCallFramePseudoInstr(MachineFunction &MF,
53                                      MachineBasicBlock &MBB,
54                                      MachineBasicBlock::iterator I) const;
55
56   void eliminateFrameIndex(MachineBasicBlock::iterator II) const;
57
58   void emitPrologue(MachineFunction &MF) const;
59   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
60 };
61
62 } // end namespace llvm
63
64 #endif