SparcRegisterInfo.h revision 9efce638d307b2c71bd7f0258d47501661434c27
1005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonov//===- SparcRegisterInfo.h - Sparc Register Information Impl ----*- C++ -*-===// 2005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonov// 3005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonov// The LLVM Compiler Infrastructure 4005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonov// 5005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonov// This file was developed by the LLVM research group and is distributed under 6005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonov// the University of Illinois Open Source License. See LICENSE.TXT for details. 7005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonov// 8005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonov//===----------------------------------------------------------------------===// 9005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonov// 10005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonov// This file contains the Sparc implementation of the MRegisterInfo class. 11005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonov// 12005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonov//===----------------------------------------------------------------------===// 13005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonov 14005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonov#ifndef SPARCREGISTERINFO_H 15005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonov#define SPARCREGISTERINFO_H 16005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonov 17005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonov#include "llvm/Target/MRegisterInfo.h" 18005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonov#include "SparcGenRegisterInfo.h.inc" 19005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonov 20005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonovnamespace llvm { 21005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonov 22005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonovclass SparcSubtarget; 23005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonovclass TargetInstrInfo; 24005159e92420a102516ee6e29ef2178c818da5d0Alexey Samsonovclass Type; 25 26struct SparcRegisterInfo : public SparcGenRegisterInfo { 27 SparcSubtarget &Subtarget; 28 const TargetInstrInfo &TII; 29 30 SparcRegisterInfo(SparcSubtarget &st, const TargetInstrInfo &tii); 31 32 /// Code Generation virtual methods... 33 void storeRegToStackSlot(MachineBasicBlock &MBB, 34 MachineBasicBlock::iterator MBBI, 35 unsigned SrcReg, int FrameIndex, 36 const TargetRegisterClass *RC) const; 37 38 void loadRegFromStackSlot(MachineBasicBlock &MBB, 39 MachineBasicBlock::iterator MBBI, 40 unsigned DestReg, int FrameIndex, 41 const TargetRegisterClass *RC) const; 42 43 void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, 44 unsigned DestReg, unsigned SrcReg, 45 const TargetRegisterClass *DestRC, 46 const TargetRegisterClass *SrcRC) const; 47 48 void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, 49 unsigned DestReg, const MachineInstr *Orig) const; 50 51 virtual MachineInstr* foldMemoryOperand(MachineInstr* MI, 52 unsigned OpNum, 53 int FrameIndex) const; 54 55 virtual MachineInstr* foldMemoryOperand(MachineInstr* MI, 56 unsigned OpNum, 57 MachineInstr* LoadMI) const { 58 return 0; 59 } 60 61 const unsigned *getCalleeSavedRegs(const MachineFunction *MF = 0) const; 62 63 const TargetRegisterClass* const* getCalleeSavedRegClasses( 64 const MachineFunction *MF = 0) const; 65 66 BitVector getReservedRegs(const MachineFunction &MF) const; 67 68 bool hasFP(const MachineFunction &MF) const; 69 70 void eliminateCallFramePseudoInstr(MachineFunction &MF, 71 MachineBasicBlock &MBB, 72 MachineBasicBlock::iterator I) const; 73 74 void eliminateFrameIndex(MachineBasicBlock::iterator II, 75 int SPAdj, RegScavenger *RS = NULL) const; 76 77 void processFunctionBeforeFrameFinalized(MachineFunction &MF) const; 78 79 void emitPrologue(MachineFunction &MF) const; 80 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const; 81 82 // Debug information queries. 83 unsigned getRARegister() const; 84 unsigned getFrameRegister(MachineFunction &MF) const; 85 86 // Exception handling queries. 87 unsigned getEHExceptionRegister() const; 88 unsigned getEHHandlerRegister() const; 89}; 90 91} // end namespace llvm 92 93#endif 94