1 //===- PPCRegisterInfo.h - PowerPC 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 PowerPC implementation of the MRegisterInfo class.
12 //===----------------------------------------------------------------------===//
14 #ifndef POWERPC32_REGISTERINFO_H
15 #define POWERPC32_REGISTERINFO_H
18 #include "PPCGenRegisterInfo.h.inc"
25 class PPCRegisterInfo : public PPCGenRegisterInfo {
26 std::map<unsigned, unsigned> ImmToIdxMap;
27 const PPCSubtarget &Subtarget;
28 const TargetInstrInfo &TII;
30 PPCRegisterInfo(const PPCSubtarget &SubTarget, const TargetInstrInfo &tii);
32 /// getRegisterNumbering - Given the enum value for some register, e.g.
33 /// PPC::F14, return the number that it corresponds to (e.g. 14).
34 static unsigned getRegisterNumbering(unsigned RegEnum);
36 /// Code Generation virtual methods...
37 void storeRegToStackSlot(MachineBasicBlock &MBB,
38 MachineBasicBlock::iterator MBBI,
39 unsigned SrcReg, int FrameIndex,
40 const TargetRegisterClass *RC) const;
42 void loadRegFromStackSlot(MachineBasicBlock &MBB,
43 MachineBasicBlock::iterator MBBI,
44 unsigned DestReg, int FrameIndex,
45 const TargetRegisterClass *RC) const;
47 void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
48 unsigned DestReg, unsigned SrcReg,
49 const TargetRegisterClass *RC) const;
51 /// foldMemoryOperand - PowerPC (like most RISC's) can only fold spills into
52 /// copy instructions, turning them into load/store instructions.
53 virtual MachineInstr* foldMemoryOperand(MachineInstr* MI, unsigned OpNum,
54 int FrameIndex) const;
56 const unsigned *getCalleeSaveRegs() const;
58 const TargetRegisterClass* const* getCalleeSaveRegClasses() const;
60 void eliminateCallFramePseudoInstr(MachineFunction &MF,
61 MachineBasicBlock &MBB,
62 MachineBasicBlock::iterator I) const;
64 void eliminateFrameIndex(MachineBasicBlock::iterator II) const;
66 void emitPrologue(MachineFunction &MF) const;
67 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
69 // Debug information queries.
70 unsigned getRARegister() const;
71 unsigned getFrameRegister(MachineFunction &MF) const;
72 void getInitialFrameState(std::vector<MachineMove *> &Moves) const;
75 } // end namespace llvm