1 //===-- Nios2RegisterInfo.cpp - Nios2 Register Information -== ------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file contains the Nios2 implementation of the TargetRegisterInfo class. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #define DEBUG_TYPE "nios2-reg-info" 15 16 #include "Nios2RegisterInfo.h" 17 18 #include "Nios2.h" 19 #include "Nios2Subtarget.h" 20 21 #define GET_REGINFO_TARGET_DESC 22 #include "Nios2GenRegisterInfo.inc" 23 24 using namespace llvm; 25 26 Nios2RegisterInfo::Nios2RegisterInfo(const Nios2Subtarget &ST) 27 : Nios2GenRegisterInfo(Nios2::RA), Subtarget(ST) {} 28 29 const TargetRegisterClass *Nios2RegisterInfo::intRegClass(unsigned Size) const { 30 return &Nios2::CPURegsRegClass; 31 } 32 33 const MCPhysReg * 34 Nios2RegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const { 35 return CSR_SaveList; 36 } 37 38 BitVector Nios2RegisterInfo::getReservedRegs(const MachineFunction &MF) const { 39 static const MCPhysReg ReservedCPURegs[] = {Nios2::ZERO, Nios2::AT, Nios2::SP, 40 Nios2::RA, Nios2::PC, Nios2::GP}; 41 BitVector Reserved(getNumRegs()); 42 43 for (unsigned I = 0; I < array_lengthof(ReservedCPURegs); ++I) 44 Reserved.set(ReservedCPURegs[I]); 45 46 return Reserved; 47 } 48 49 void Nios2RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II, 50 int SPAdj, unsigned FIOperandNum, 51 RegScavenger *RS) const {} 52 53 unsigned Nios2RegisterInfo::getFrameRegister(const MachineFunction &MF) const { 54 return Nios2::SP; 55 } 56