LLVM API Documentation
00001 //===- PPCRegisterInfo.h - PowerPC Register Information Impl -----*- C++ -*-==// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file was developed by the LLVM research group and is distributed under 00006 // the University of Illinois Open Source License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file contains the PowerPC implementation of the MRegisterInfo class. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef POWERPC32_REGISTERINFO_H 00015 #define POWERPC32_REGISTERINFO_H 00016 00017 #include "PPC.h" 00018 #include "PPCGenRegisterInfo.h.inc" 00019 #include <map> 00020 00021 namespace llvm { 00022 class PPCSubtarget; 00023 class Type; 00024 00025 class PPCRegisterInfo : public PPCGenRegisterInfo { 00026 std::map<unsigned, unsigned> ImmToIdxMap; 00027 const PPCSubtarget &Subtarget; 00028 public: 00029 PPCRegisterInfo(const PPCSubtarget &SubTarget); 00030 00031 /// getRegisterNumbering - Given the enum value for some register, e.g. 00032 /// PPC::F14, return the number that it corresponds to (e.g. 14). 00033 static unsigned getRegisterNumbering(unsigned RegEnum); 00034 00035 /// Code Generation virtual methods... 00036 void storeRegToStackSlot(MachineBasicBlock &MBB, 00037 MachineBasicBlock::iterator MBBI, 00038 unsigned SrcReg, int FrameIndex, 00039 const TargetRegisterClass *RC) const; 00040 00041 void loadRegFromStackSlot(MachineBasicBlock &MBB, 00042 MachineBasicBlock::iterator MBBI, 00043 unsigned DestReg, int FrameIndex, 00044 const TargetRegisterClass *RC) const; 00045 00046 void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, 00047 unsigned DestReg, unsigned SrcReg, 00048 const TargetRegisterClass *RC) const; 00049 00050 /// foldMemoryOperand - PowerPC (like most RISC's) can only fold spills into 00051 /// copy instructions, turning them into load/store instructions. 00052 virtual MachineInstr* foldMemoryOperand(MachineInstr* MI, unsigned OpNum, 00053 int FrameIndex) const; 00054 00055 const unsigned *getCalleeSaveRegs() const; 00056 00057 const TargetRegisterClass* const* getCalleeSaveRegClasses() const; 00058 00059 void eliminateCallFramePseudoInstr(MachineFunction &MF, 00060 MachineBasicBlock &MBB, 00061 MachineBasicBlock::iterator I) const; 00062 00063 void eliminateFrameIndex(MachineBasicBlock::iterator II) const; 00064 00065 void emitPrologue(MachineFunction &MF) const; 00066 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const; 00067 00068 // Debug information queries. 00069 unsigned getRARegister() const; 00070 unsigned getFrameRegister(MachineFunction &MF) const; 00071 void getInitialFrameState(std::vector<MachineMove *> &Moves) const; 00072 }; 00073 00074 } // end namespace llvm 00075 00076 #endif