2007-12-05 02:24:05 +01:00
|
|
|
//===- SPURegisterInfo.h - Cell SPU Register Information Impl ----*- C++ -*-==//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 21:36:04 +01:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2007-12-05 02:24:05 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2008-02-10 19:45:23 +01:00
|
|
|
// This file contains the Cell SPU implementation of the TargetRegisterInfo
|
|
|
|
// class.
|
2007-12-05 02:24:05 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef SPU_REGISTERINFO_H
|
|
|
|
#define SPU_REGISTERINFO_H
|
|
|
|
|
|
|
|
#include "SPU.h"
|
|
|
|
#include "SPUGenRegisterInfo.h.inc"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
class SPUSubtarget;
|
|
|
|
class TargetInstrInfo;
|
|
|
|
class Type;
|
|
|
|
|
|
|
|
class SPURegisterInfo : public SPUGenRegisterInfo {
|
|
|
|
private:
|
|
|
|
const SPUSubtarget &Subtarget;
|
|
|
|
const TargetInstrInfo &TII;
|
|
|
|
|
|
|
|
//! Predicate: Does the machine function use the link register?
|
|
|
|
bool usesLR(MachineFunction &MF) const;
|
|
|
|
|
|
|
|
public:
|
|
|
|
SPURegisterInfo(const SPUSubtarget &subtarget, const TargetInstrInfo &tii);
|
2010-11-15 01:06:54 +01:00
|
|
|
|
2007-12-05 02:24:05 +01:00
|
|
|
//! Translate a register's enum value to a register number
|
|
|
|
/*!
|
|
|
|
This method translates a register's enum value to it's regiser number,
|
|
|
|
e.g. SPU::R14 -> 14.
|
|
|
|
*/
|
|
|
|
static unsigned getRegisterNumbering(unsigned RegEnum);
|
|
|
|
|
2009-02-06 18:43:24 +01:00
|
|
|
/// getPointerRegClass - Return the register class to use to hold pointers.
|
|
|
|
/// This is used for addressing modes.
|
2009-07-29 22:31:52 +02:00
|
|
|
virtual const TargetRegisterClass *
|
|
|
|
getPointerRegClass(unsigned Kind = 0) const;
|
2009-02-06 18:43:24 +01:00
|
|
|
|
2007-12-05 02:24:05 +01:00
|
|
|
//! Return the array of callee-saved registers
|
|
|
|
virtual const unsigned* getCalleeSavedRegs(const MachineFunction *MF) const;
|
|
|
|
|
2010-03-29 19:38:47 +02:00
|
|
|
//! Allow for scavenging, so we can get scratch registers when needed.
|
|
|
|
virtual bool requiresRegisterScavenging(const MachineFunction &MF) const
|
|
|
|
{ return true; }
|
|
|
|
|
2007-12-05 02:24:05 +01:00
|
|
|
//! Return the reserved registers
|
|
|
|
BitVector getReservedRegs(const MachineFunction &MF) const;
|
|
|
|
|
|
|
|
//! Eliminate the call frame setup pseudo-instructions
|
|
|
|
void eliminateCallFramePseudoInstr(MachineFunction &MF,
|
|
|
|
MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator I) const;
|
|
|
|
//! Convert frame indicies into machine operands
|
2010-08-27 01:32:16 +02:00
|
|
|
void eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj,
|
|
|
|
RegScavenger *RS = NULL) const;
|
2007-12-05 02:24:05 +01:00
|
|
|
|
|
|
|
//! Get return address register (LR, aka R0)
|
|
|
|
unsigned getRARegister() const;
|
|
|
|
//! Get the stack frame register (SP, aka R1)
|
2009-11-12 22:00:03 +01:00
|
|
|
unsigned getFrameRegister(const MachineFunction &MF) const;
|
2007-12-05 02:24:05 +01:00
|
|
|
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
// New methods added:
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
|
|
|
|
//! Get DWARF debugging register number
|
|
|
|
int getDwarfRegNum(unsigned RegNum, bool isEH) const;
|
2010-03-29 19:38:47 +02:00
|
|
|
|
|
|
|
//! Convert D-form load/store to X-form load/store
|
|
|
|
/*!
|
|
|
|
Converts a regiser displacement load/store into a register-indexed
|
|
|
|
load/store for large stack frames, when the stack frame exceeds the
|
|
|
|
range of a s10 displacement.
|
|
|
|
*/
|
|
|
|
int convertDFormToXForm(int dFormOpcode) const;
|
|
|
|
|
|
|
|
//! Acquire an unused register in an emergency.
|
|
|
|
unsigned findScratchRegister(MachineBasicBlock::iterator II,
|
|
|
|
RegScavenger *RS,
|
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
int SPAdj) const;
|
|
|
|
|
2007-12-05 02:24:05 +01:00
|
|
|
};
|
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif
|