1 //===- SPURegisterInfo.h - Cell SPU Register Information Impl ----*- 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 Cell SPU implementation of the TargetRegisterInfo
13 //===----------------------------------------------------------------------===//
15 #ifndef SPU_REGISTERINFO_H
16 #define SPU_REGISTERINFO_H
19 #include "SPUGenRegisterInfo.h.inc"
23 class TargetInstrInfo;
26 class SPURegisterInfo : public SPUGenRegisterInfo {
28 const SPUSubtarget &Subtarget;
29 const TargetInstrInfo &TII;
31 //! Predicate: Does the machine function use the link register?
32 bool usesLR(MachineFunction &MF) const;
35 SPURegisterInfo(const SPUSubtarget &subtarget, const TargetInstrInfo &tii);
37 //! Translate a register's enum value to a register number
39 This method translates a register's enum value to it's regiser number,
42 static unsigned getRegisterNumbering(unsigned RegEnum);
44 /// getPointerRegClass - Return the register class to use to hold pointers.
45 /// This is used for addressing modes.
46 virtual const TargetRegisterClass *
47 getPointerRegClass(unsigned Kind = 0) const;
49 //! Return the array of callee-saved registers
50 virtual const unsigned* getCalleeSavedRegs(const MachineFunction *MF) const;
52 //! Allow for scavenging, so we can get scratch registers when needed.
53 virtual bool requiresRegisterScavenging(const MachineFunction &MF) const
56 //! Return the reserved registers
57 BitVector getReservedRegs(const MachineFunction &MF) const;
59 //! Eliminate the call frame setup pseudo-instructions
60 void eliminateCallFramePseudoInstr(MachineFunction &MF,
61 MachineBasicBlock &MBB,
62 MachineBasicBlock::iterator I) const;
63 //! Convert frame indicies into machine operands
64 void eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj,
65 RegScavenger *RS = NULL) const;
67 void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
68 RegScavenger *RS = NULL) const;
70 //! Get return address register (LR, aka R0)
71 unsigned getRARegister() const;
72 //! Get the stack frame register (SP, aka R1)
73 unsigned getFrameRegister(const MachineFunction &MF) const;
75 //------------------------------------------------------------------------
77 //------------------------------------------------------------------------
79 //! Get DWARF debugging register number
80 int getDwarfRegNum(unsigned RegNum, bool isEH) const;
82 //! Convert D-form load/store to X-form load/store
84 Converts a regiser displacement load/store into a register-indexed
85 load/store for large stack frames, when the stack frame exceeds the
86 range of a s10 displacement.
88 int convertDFormToXForm(int dFormOpcode) const;
90 //! Acquire an unused register in an emergency.
91 unsigned findScratchRegister(MachineBasicBlock::iterator II,
93 const TargetRegisterClass *RC,
97 } // end namespace llvm