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;
30 /// getRegisterNumbering - Given the enum value for some register, e.g.
31 /// PPC::F14, return the number that it corresponds to (e.g. 14).
32 static unsigned getRegisterNumbering(unsigned RegEnum);
34 /// Code Generation virtual methods...
35 void storeRegToStackSlot(MachineBasicBlock &MBB,
36 MachineBasicBlock::iterator MBBI,
37 unsigned SrcReg, int FrameIndex,
38 const TargetRegisterClass *RC) const;
40 void loadRegFromStackSlot(MachineBasicBlock &MBB,
41 MachineBasicBlock::iterator MBBI,
42 unsigned DestReg, int FrameIndex,
43 const TargetRegisterClass *RC) const;
45 void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
46 unsigned DestReg, unsigned SrcReg,
47 const TargetRegisterClass *RC) const;
49 /// foldMemoryOperand - PowerPC (like most RISC's) can only fold spills into
50 /// copy instructions, turning them into load/store instructions.
51 virtual MachineInstr* foldMemoryOperand(MachineInstr* MI, unsigned OpNum,
52 int FrameIndex) const;
54 const unsigned *getCalleeSaveRegs() const;
56 const TargetRegisterClass* const* getCalleeSaveRegClasses() const;
58 void eliminateCallFramePseudoInstr(MachineFunction &MF,
59 MachineBasicBlock &MBB,
60 MachineBasicBlock::iterator I) const;
62 void eliminateFrameIndex(MachineBasicBlock::iterator II) const;
64 void emitPrologue(MachineFunction &MF) const;
65 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
67 // Debug information queries.
68 unsigned getRARegister() const;
69 unsigned getFrameRegister(MachineFunction &MF) const;
70 void getInitialFrameState(std::vector<MachineMove *> &Moves) const;
73 } // end namespace llvm