1 //===- SystemZRegisterInfo.cpp - SystemZ Register Information -------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the SystemZ implementation of the TargetRegisterInfo class.
12 //===----------------------------------------------------------------------===//
15 #include "SystemZRegisterInfo.h"
16 #include "SystemZSubtarget.h"
17 #include "llvm/CodeGen/MachineInstrBuilder.h"
18 #include "llvm/CodeGen/MachineFrameInfo.h"
19 #include "llvm/CodeGen/MachineFunction.h"
20 #include "llvm/Target/TargetMachine.h"
21 #include "llvm/Target/TargetOptions.h"
22 #include "llvm/ADT/BitVector.h"
25 SystemZRegisterInfo::SystemZRegisterInfo(SystemZTargetMachine &tm,
26 const TargetInstrInfo &tii)
27 : SystemZGenRegisterInfo(SystemZ::NOP, SystemZ::NOP),
32 SystemZRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
33 static const unsigned CalleeSavedRegs[] = {
34 SystemZ::R6D, SystemZ::R7D, SystemZ::R8D, SystemZ::R9D,
35 SystemZ::R10D, SystemZ::R11D, SystemZ::R12D, SystemZ::R13D,
36 SystemZ::F1, SystemZ::F3, SystemZ::F5, SystemZ::F7,
40 return CalleeSavedRegs;
43 const TargetRegisterClass* const*
44 SystemZRegisterInfo::getCalleeSavedRegClasses(const MachineFunction *MF) const {
45 static const TargetRegisterClass * const CalleeSavedRegClasses[] = {
46 &SystemZ::GR64RegClass, &SystemZ::GR64RegClass,
47 &SystemZ::GR64RegClass, &SystemZ::GR64RegClass,
48 &SystemZ::GR64RegClass, &SystemZ::GR64RegClass,
49 &SystemZ::GR64RegClass, &SystemZ::GR64RegClass,
50 &SystemZ::FP64RegClass, &SystemZ::FP64RegClass,
51 &SystemZ::FP64RegClass, &SystemZ::FP64RegClass, 0
53 return CalleeSavedRegClasses;
56 BitVector SystemZRegisterInfo::getReservedRegs(const MachineFunction &MF) const {
57 BitVector Reserved(getNumRegs());
59 Reserved.set(SystemZ::R11D);
60 Reserved.set(SystemZ::R14D);
61 Reserved.set(SystemZ::R15D);
65 // needsFP - Return true if the specified function should have a dedicated frame
66 // pointer register. This is true if the function has variable sized allocas or
67 // if frame pointer elimination is disabled.
69 bool SystemZRegisterInfo::hasFP(const MachineFunction &MF) const {
70 const MachineFrameInfo *MFI = MF.getFrameInfo();
71 return NoFramePointerElim || MFI->hasVarSizedObjects();
74 void SystemZRegisterInfo::
75 eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
76 MachineBasicBlock::iterator I) const {
77 assert(0 && "Not implemented yet!");
80 void SystemZRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
81 int SPAdj, RegScavenger *RS) const {
82 assert(0 && "Not implemented yet!");
85 void SystemZRegisterInfo::emitPrologue(MachineFunction &MF) const {
89 void SystemZRegisterInfo::emitEpilogue(MachineFunction &MF,
90 MachineBasicBlock &MBB) const {
94 unsigned SystemZRegisterInfo::getRARegister() const {
95 assert(0 && "What is the return address register");
99 unsigned SystemZRegisterInfo::getFrameRegister(MachineFunction &MF) const {
100 assert(0 && "What is the frame register");
104 unsigned SystemZRegisterInfo::getEHExceptionRegister() const {
105 assert(0 && "What is the exception register");
109 unsigned SystemZRegisterInfo::getEHHandlerRegister() const {
110 assert(0 && "What is the exception handler register");
114 int SystemZRegisterInfo::getDwarfRegNum(unsigned RegNum, bool isEH) const {
115 assert(0 && "What is the dwarf register number");
119 #include "SystemZGenRegisterInfo.inc"