MBlazeRegisterInfo.h revision 0a67d92938d77b6a8cde6e1676750264b274cebc
1a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck//===- MBlazeRegisterInfo.h - MBlaze Register Information Impl --*- C++ -*-===// 2a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck// 3a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck// The LLVM Compiler Infrastructure 4a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck// 5a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck// This file is distributed under the University of Illinois Open Source 6a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck// License. See LICENSE.TXT for details. 7a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck// 8a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck//===----------------------------------------------------------------------===// 9a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck// 10a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck// This file contains the MBlaze implementation of the TargetRegisterInfo 11a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck// class. 12a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck// 13a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck//===----------------------------------------------------------------------===// 14a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck 15a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck#ifndef MBLAZEREGISTERINFO_H 16a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck#define MBLAZEREGISTERINFO_H 17a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck 18a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck#include "MBlaze.h" 19a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck#include "llvm/Target/TargetRegisterInfo.h" 20a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck#include "MBlazeGenRegisterInfo.h.inc" 21a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck 22a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Pecknamespace llvm { 23a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peckclass MBlazeSubtarget; 24a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peckclass TargetInstrInfo; 25a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peckclass Type; 26a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck 27a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Pecknamespace MBlaze { 280a67d92938d77b6a8cde6e1676750264b274cebcWesley Peck /// SubregIndex - The index of various sized subregister classes. Note that 290a67d92938d77b6a8cde6e1676750264b274cebcWesley Peck /// these indices must be kept in sync with the class indices in the 30a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck /// MBlazeRegisterInfo.td file. 31a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck enum SubregIndex { 32a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck SUBREG_FPEVEN = 1, SUBREG_FPODD = 2 33a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck }; 34a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck} 35a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck 36a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peckstruct MBlazeRegisterInfo : public MBlazeGenRegisterInfo { 37a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck const MBlazeSubtarget &Subtarget; 38a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck const TargetInstrInfo &TII; 390a67d92938d77b6a8cde6e1676750264b274cebcWesley Peck 40a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck MBlazeRegisterInfo(const MBlazeSubtarget &Subtarget, 41a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck const TargetInstrInfo &tii); 42a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck 43a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck /// getRegisterNumbering - Given the enum value for some register, e.g. 44a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck /// MBlaze::RA, return the number that it corresponds to (e.g. 31). 45a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck static unsigned getRegisterNumbering(unsigned RegEnum); 46c2bf2bbe93c7ce44bedc8485cc24927423404835Wesley Peck static unsigned getRegisterFromNumbering(unsigned RegEnum); 47a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck 48a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck /// Get PIC indirect call register 49a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck static unsigned getPICCallReg(); 50a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck 51a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck /// Adjust the MBlaze stack frame. 52a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck void adjustMBlazeStackFrame(MachineFunction &MF) const; 53a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck 54a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck /// Code Generation virtual methods... 55a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck const unsigned *getCalleeSavedRegs(const MachineFunction* MF = 0) const; 56a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck 57a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck BitVector getReservedRegs(const MachineFunction &MF) const; 58a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck 59a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck bool hasFP(const MachineFunction &MF) const; 60a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck 61a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck void eliminateCallFramePseudoInstr(MachineFunction &MF, 62a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck MachineBasicBlock &MBB, 63a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck MachineBasicBlock::iterator I) const; 64a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck 65a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck /// Stack Frame Processing Methods 66fcb4a8ead3cd8d9540d5eaa448af5d14a0ee341aJim Grosbach void eliminateFrameIndex(MachineBasicBlock::iterator II, 67fcb4a8ead3cd8d9540d5eaa448af5d14a0ee341aJim Grosbach int SPAdj, RegScavenger *RS = NULL) const; 68a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck 69a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck void processFunctionBeforeFrameFinalized(MachineFunction &MF) const; 70a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck 71a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck void emitPrologue(MachineFunction &MF) const; 72a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const; 730a67d92938d77b6a8cde6e1676750264b274cebcWesley Peck 74a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck /// Debug information queries. 75a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck unsigned getRARegister() const; 76a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck unsigned getFrameRegister(const MachineFunction &MF) const; 77a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck 78a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck /// Exception handling queries. 79a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck unsigned getEHExceptionRegister() const; 80a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck unsigned getEHHandlerRegister() const; 81a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck 82c2bf2bbe93c7ce44bedc8485cc24927423404835Wesley Peck /// targetHandlesStackFrameRounding - Returns true if the target is 83c2bf2bbe93c7ce44bedc8485cc24927423404835Wesley Peck /// responsible for rounding up the stack frame (probably at emitPrologue 84c2bf2bbe93c7ce44bedc8485cc24927423404835Wesley Peck /// time). 85c2bf2bbe93c7ce44bedc8485cc24927423404835Wesley Peck bool targetHandlesStackFrameRounding() const { return true; } 86c2bf2bbe93c7ce44bedc8485cc24927423404835Wesley Peck 87a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck int getDwarfRegNum(unsigned RegNum, bool isEH) const; 88a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck}; 89a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck 90a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck} // end namespace llvm 91a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck 92a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck#endif 93