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 void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
45 unsigned DestReg, const MachineInstr *Orig) const;
47 //! Return the array of callee-saved registers
48 virtual const unsigned* getCalleeSavedRegs(const MachineFunction *MF) const;
50 //! Return the register class array of the callee-saved registers
51 virtual const TargetRegisterClass* const *
52 getCalleeSavedRegClasses(const MachineFunction *MF) const;
54 //! Return the reserved registers
55 BitVector getReservedRegs(const MachineFunction &MF) const;
57 //! Prediate: Target has dedicated frame pointer
58 bool hasFP(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,
65 RegScavenger *RS) const;
66 //! Determine the frame's layour
67 void determineFrameLayout(MachineFunction &MF) const;
69 void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
70 RegScavenger *RS = NULL) const;
71 //! Emit the function prologue
72 void emitPrologue(MachineFunction &MF) const;
73 //! Emit the function epilogue
74 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
75 //! Get return address register (LR, aka R0)
76 unsigned getRARegister() const;
77 //! Get the stack frame register (SP, aka R1)
78 unsigned getFrameRegister(MachineFunction &MF) const;
79 //! Perform target-specific stack frame setup.
80 void getInitialFrameState(std::vector<MachineMove> &Moves) const;
82 //------------------------------------------------------------------------
84 //------------------------------------------------------------------------
86 //! Return the array of argument passing registers
88 \note The size of this array is returned by getArgRegsSize().
90 static const unsigned *getArgRegs();
92 //! Return the size of the argument passing register array
93 static const unsigned getNumArgRegs();
95 //! Get DWARF debugging register number
96 int getDwarfRegNum(unsigned RegNum, bool isEH) const;
98 } // end namespace llvm