LLVM API Documentation

PPCRegisterInfo.h

Go to the documentation of this file.
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 
00023 class Type;
00024 
00025 class PPCRegisterInfo : public PPCGenRegisterInfo {
00026   std::map<unsigned, unsigned> ImmToIdxMap;
00027 public:
00028   PPCRegisterInfo();
00029 
00030   /// Code Generation virtual methods...
00031   void storeRegToStackSlot(MachineBasicBlock &MBB,
00032                            MachineBasicBlock::iterator MBBI,
00033                            unsigned SrcReg, int FrameIndex,
00034                            const TargetRegisterClass *RC) const;
00035 
00036   void loadRegFromStackSlot(MachineBasicBlock &MBB,
00037                             MachineBasicBlock::iterator MBBI,
00038                             unsigned DestReg, int FrameIndex,
00039                             const TargetRegisterClass *RC) const;
00040 
00041   void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
00042                     unsigned DestReg, unsigned SrcReg,
00043                     const TargetRegisterClass *RC) const;
00044 
00045   /// foldMemoryOperand - PowerPC (like most RISC's) can only fold spills into
00046   /// copy instructions, turning them into load/store instructions.
00047   virtual MachineInstr* foldMemoryOperand(MachineInstr* MI, unsigned OpNum,
00048                                           int FrameIndex) const;
00049   
00050   void eliminateCallFramePseudoInstr(MachineFunction &MF,
00051                                      MachineBasicBlock &MBB,
00052                                      MachineBasicBlock::iterator I) const;
00053 
00054   void eliminateFrameIndex(MachineBasicBlock::iterator II) const;
00055 
00056   void emitPrologue(MachineFunction &MF) const;
00057   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
00058 
00059   // Debug information queries.
00060   unsigned getRARegister() const;
00061   unsigned getFrameRegister(MachineFunction &MF) const;
00062   void getInitialFrameState(std::vector<MachineMove *> &Moves) const;
00063 };
00064 
00065 } // end namespace llvm
00066 
00067 #endif