LLVM API Documentation
00001 //===- PPCRegisterInfo.h - PowerPC Register Information Impl -----*- C++ -*-==// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file contains the PowerPC implementation of the TargetRegisterInfo 00011 // class. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef POWERPC32_REGISTERINFO_H 00016 #define POWERPC32_REGISTERINFO_H 00017 00018 #include "PPC.h" 00019 #include "PPCGenRegisterInfo.h.inc" 00020 #include <map> 00021 00022 namespace llvm { 00023 class PPCSubtarget; 00024 class TargetInstrInfo; 00025 class Type; 00026 00027 class PPCRegisterInfo : public PPCGenRegisterInfo { 00028 std::map<unsigned, unsigned> ImmToIdxMap; 00029 const PPCSubtarget &Subtarget; 00030 const TargetInstrInfo &TII; 00031 public: 00032 PPCRegisterInfo(const PPCSubtarget &SubTarget, const TargetInstrInfo &tii); 00033 00034 /// getRegisterNumbering - Given the enum value for some register, e.g. 00035 /// PPC::F14, return the number that it corresponds to (e.g. 14). 00036 static unsigned getRegisterNumbering(unsigned RegEnum); 00037 00038 /// getPointerRegClass - Return the register class to use to hold pointers. 00039 /// This is used for addressing modes. 00040 virtual const TargetRegisterClass *getPointerRegClass(unsigned Kind=0) const; 00041 00042 /// Code Generation virtual methods... 00043 const unsigned *getCalleeSavedRegs(const MachineFunction* MF = 0) const; 00044 00045 const TargetRegisterClass* const* 00046 getCalleeSavedRegClasses(const MachineFunction *MF = 0) const; 00047 00048 BitVector getReservedRegs(const MachineFunction &MF) const; 00049 00050 /// targetHandlesStackFrameRounding - Returns true if the target is 00051 /// responsible for rounding up the stack frame (probably at emitPrologue 00052 /// time). 00053 bool targetHandlesStackFrameRounding() const { return true; } 00054 00055 /// requiresRegisterScavenging - We require a register scavenger. 00056 /// FIXME (64-bit): Should be inlined. 00057 bool requiresRegisterScavenging(const MachineFunction &MF) const; 00058 00059 bool hasFP(const MachineFunction &MF) const; 00060 00061 void eliminateCallFramePseudoInstr(MachineFunction &MF, 00062 MachineBasicBlock &MBB, 00063 MachineBasicBlock::iterator I) const; 00064 00065 void lowerDynamicAlloc(MachineBasicBlock::iterator II, 00066 int SPAdj, RegScavenger *RS) const; 00067 void lowerCRSpilling(MachineBasicBlock::iterator II, unsigned FrameIndex, 00068 int SPAdj, RegScavenger *RS) const; 00069 void eliminateFrameIndex(MachineBasicBlock::iterator II, 00070 int SPAdj, RegScavenger *RS = NULL) const; 00071 00072 /// determineFrameLayout - Determine the size of the frame and maximum call 00073 /// frame size. 00074 void determineFrameLayout(MachineFunction &MF) const; 00075 00076 void processFunctionBeforeCalleeSavedScan(MachineFunction &MF, 00077 RegScavenger *RS = NULL) const; 00078 void processFunctionBeforeFrameFinalized(MachineFunction &MF) const; 00079 00080 void emitPrologue(MachineFunction &MF) const; 00081 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const; 00082 00083 // Debug information queries. 00084 unsigned getRARegister() const; 00085 unsigned getFrameRegister(MachineFunction &MF) const; 00086 void getInitialFrameState(std::vector<MachineMove> &Moves) const; 00087 00088 // Exception handling queries. 00089 unsigned getEHExceptionRegister() const; 00090 unsigned getEHHandlerRegister() const; 00091 00092 int getDwarfRegNum(unsigned RegNum, bool isEH) const; 00093 }; 00094 00095 } // end namespace llvm 00096 00097 #endif