LLVM API Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

llvm::MRegisterInfo Class Reference

#include <MRegisterInfo.h>

Inheritance diagram for llvm::MRegisterInfo:

Inheritance graph
[legend]
Collaboration diagram for llvm::MRegisterInfo:

Collaboration graph
[legend]
List of all members.

Public Types

typedef const TargetRegisterClass
*const * 
regclass_iterator
enum  { NoRegister = 0, FirstVirtualRegister = 1024 }

Public Member Functions

std::vector< bool > getAllocatableSet (MachineFunction &MF) const
const MRegisterDescoperator[] (unsigned RegNo) const
const MRegisterDescget (unsigned RegNo) const
const unsigned * getAliasSet (unsigned RegNo) const
const char * getName (unsigned RegNo) const
unsigned getSpillSize (unsigned RegNo) const
unsigned getSpillAlignment (unsigned RegNo) const
unsigned getNumRegs () const
bool areAliases (unsigned regA, unsigned regB) const
virtual const unsigned * getCalleeSaveRegs () const =0
regclass_iterator regclass_begin () const
regclass_iterator regclass_end () const
unsigned getNumRegClasses () const
virtual void storeRegToStackSlot (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned SrcReg, int FrameIndex) const =0
virtual void loadRegFromStackSlot (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, int FrameIndex) const =0
virtual void copyRegToReg (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, unsigned SrcReg, const TargetRegisterClass *RC) const =0
virtual MachineInstrfoldMemoryOperand (MachineInstr *MI, unsigned OpNum, int FrameIndex) const
int getCallFrameSetupOpcode () const
int getCallFrameDestroyOpcode () const
virtual void eliminateCallFramePseudoInstr (MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const
virtual void processFunctionBeforeFrameFinalized (MachineFunction &MF) const
virtual void eliminateFrameIndex (MachineBasicBlock::iterator MI) const =0
virtual void emitPrologue (MachineFunction &MF) const =0
virtual void emitEpilogue (MachineFunction &MF, MachineBasicBlock &MBB) const =0

Static Public Member Functions

static bool isPhysicalRegister (unsigned Reg)
static bool isVirtualRegister (unsigned Reg)

Protected Member Functions

 MRegisterInfo (const MRegisterDesc *D, unsigned NR, regclass_iterator RegClassBegin, regclass_iterator RegClassEnd, int CallFrameSetupOpcode=-1, int CallFrameDestroyOpcode=-1)
virtual ~MRegisterInfo ()

Detailed Description

MRegisterInfo base class - We assume that the target defines a static array of MRegisterDesc objects that represent all of the machine registers that the target has. As such, we simply have to track a pointer to this array so that we can turn register number into a register descriptor.

Definition at line 113 of file MRegisterInfo.h.


Member Typedef Documentation

typedef const TargetRegisterClass* const* llvm::MRegisterInfo::regclass_iterator
 

Definition at line 115 of file MRegisterInfo.h.


Member Enumeration Documentation

anonymous enum
 

Enumerator:
NoRegister  NoRegister - This 'hard' register is a 'noop' register for all backends. This is used as the destination register for instructions that do not produce a value. Some frontends may use this as an operand register to mean special things, for example, the Sparc backend uses R0 to mean g0 which always PRODUCES the value 0. The X86 backend does not use this value as an operand register, except for memory references.
FirstVirtualRegister  FirstVirtualRegister - This is the first register number that is considered to be a 'virtual' register, which is part of the SSA namespace. This must be the same for all targets, which means that each target is limited to 1024 registers.

Definition at line 130 of file MRegisterInfo.h.


Constructor & Destructor Documentation

llvm::MRegisterInfo::MRegisterInfo const MRegisterDesc D,
unsigned  NR,
regclass_iterator  RegClassBegin,
regclass_iterator  RegClassEnd,
int  CallFrameSetupOpcode = -1,
int  CallFrameDestroyOpcode = -1
[protected]
 

Definition at line 18 of file MRegisterInfo.cpp.

References FirstVirtualRegister.

llvm::MRegisterInfo::~MRegisterInfo  )  [protected, virtual]
 

Definition at line 29 of file MRegisterInfo.cpp.


Member Function Documentation

bool llvm::MRegisterInfo::areAliases unsigned  regA,
unsigned  regB
const [inline]
 

areAliases - Returns true if the two registers alias each other, false otherwise

Definition at line 211 of file MRegisterInfo.h.

References getAliasSet().

virtual void llvm::MRegisterInfo::copyRegToReg MachineBasicBlock MBB,
MachineBasicBlock::iterator  MI,
unsigned  DestReg,
unsigned  SrcReg,
const TargetRegisterClass RC
const [pure virtual]
 

Implemented in llvm::SparcV9RegisterInfo.

virtual void llvm::MRegisterInfo::eliminateCallFramePseudoInstr MachineFunction MF,
MachineBasicBlock MBB,
MachineBasicBlock::iterator  MI
const [inline, virtual]
 

eliminateCallFramePseudoInstr - This method is called during prolog/epilog code insertion to eliminate call frame setup and destroy pseudo instructions (but only if the Target is using them). It is responsible for eliminating these instructions, replacing them with concrete instructions. This method need only be implemented if using call frame setup/destroy pseudo instructions.

Definition at line 284 of file MRegisterInfo.h.

References getCallFrameDestroyOpcode(), and getCallFrameSetupOpcode().

virtual void llvm::MRegisterInfo::eliminateFrameIndex MachineBasicBlock::iterator  MI  )  const [pure virtual]
 

eliminateFrameIndex - This method must be overriden to eliminate abstract frame indices from instructions which may use them. The instruction referenced by the iterator contains an MO_FrameIndex operand which must be eliminated by this method. This method may modify or replace the specified instruction, as long as it keeps the iterator pointing the the finished product. The return value is the number of instructions added to (negative if removed from) the basic block.

Implemented in llvm::SparcV9RegisterInfo.

virtual void llvm::MRegisterInfo::emitEpilogue MachineFunction MF,
MachineBasicBlock MBB
const [pure virtual]
 

Implemented in llvm::SparcV9RegisterInfo.

virtual void llvm::MRegisterInfo::emitPrologue MachineFunction MF  )  const [pure virtual]
 

emitProlog/emitEpilog - These methods insert prolog and epilog code into the function. The return value is the number of instructions added to (negative if removed from) the basic block (entry for prologue).

Implemented in llvm::SparcV9RegisterInfo.

virtual MachineInstr* llvm::MRegisterInfo::foldMemoryOperand MachineInstr MI,
unsigned  OpNum,
int  FrameIndex
const [inline, virtual]
 

foldMemoryOperand - Attempt to fold a load or store of the specified stack slot into the specified machine instruction for the specified operand. If this is possible, a new instruction is returned with the specified operand folded, otherwise NULL is returned. The client is responsible for removing the old instruction and adding the new one in the instruction stream

Definition at line 260 of file MRegisterInfo.h.

Referenced by llvm::LiveIntervals::addIntervalsForSpills().

const MRegisterDesc& llvm::MRegisterInfo::get unsigned  RegNo  )  const [inline]
 

Provide a get method, equivalent to [], but more useful if we have a pointer to this object.

Definition at line 175 of file MRegisterInfo.h.

References operator[]().

Referenced by getAliasSet(), getName(), getSpillAlignment(), and getSpillSize().

const unsigned* llvm::MRegisterInfo::getAliasSet unsigned  RegNo  )  const [inline]
 

getAliasSet - Return the set of registers aliased by the specified register, or a null list of there are none. The list returned is zero terminated.

Definition at line 181 of file MRegisterInfo.h.

References llvm::MRegisterDesc::AliasSet, and get().

Referenced by llvm::PhysRegTracker::addRegUse(), areAliases(), llvm::PhysRegTracker::delRegUse(), and updateSpillWeights().

std::vector< bool > llvm::MRegisterInfo::getAllocatableSet MachineFunction MF  )  const
 

getAllocatableSet - Returns a bitset indexed by register number indicating if a register is allocatable or not.

Definition at line 31 of file MRegisterInfo.cpp.

References llvm::TargetRegisterClass::allocation_order_begin(), llvm::TargetRegisterClass::allocation_order_end(), E, I, regclass_begin(), and regclass_end().

Referenced by llvm::LiveVariables::runOnMachineFunction(), and llvm::LiveIntervals::runOnMachineFunction().

virtual const unsigned* llvm::MRegisterInfo::getCalleeSaveRegs  )  const [pure virtual]
 

Implemented in llvm::SparcV9RegisterInfo.

int llvm::MRegisterInfo::getCallFrameDestroyOpcode  )  const [inline]
 

Definition at line 273 of file MRegisterInfo.h.

Referenced by eliminateCallFramePseudoInstr().

int llvm::MRegisterInfo::getCallFrameSetupOpcode  )  const [inline]
 

getCallFrameSetup/DestroyOpcode - These methods return the opcode of the frame setup/destroy instructions if they exist (-1 otherwise). Some targets use pseudo instructions in order to abstract away the difference between operating with a frame pointer and operating without, through the use of these two instructions.

Definition at line 272 of file MRegisterInfo.h.

Referenced by eliminateCallFramePseudoInstr().

const char* llvm::MRegisterInfo::getName unsigned  RegNo  )  const [inline]
 

getName - Return the symbolic target specific name for the specified physical register.

Definition at line 187 of file MRegisterInfo.h.

References get(), and llvm::MRegisterDesc::Name.

Referenced by llvm::VirtRegMap::print().

unsigned llvm::MRegisterInfo::getNumRegClasses  )  const [inline]
 

Definition at line 229 of file MRegisterInfo.h.

References regclass_begin(), and regclass_end().

unsigned llvm::MRegisterInfo::getNumRegs  )  const [inline]
 

getNumRegs - Return the number of registers this target has (useful for sizing arrays holding per register information)

Definition at line 205 of file MRegisterInfo.h.

Referenced by llvm::LiveVariables::runOnMachineFunction().

unsigned llvm::MRegisterInfo::getSpillAlignment unsigned  RegNo  )  const [inline]
 

getSpillAlignment - Return the alignment required by a stack slot used to spill register into.

Definition at line 199 of file MRegisterInfo.h.

References get(), and llvm::MRegisterDesc::SpillAlignment.

unsigned llvm::MRegisterInfo::getSpillSize unsigned  RegNo  )  const [inline]
 

getSpillSize - Return the size in bits required of a stack slot used to spill register into.

Definition at line 193 of file MRegisterInfo.h.

References get(), and llvm::MRegisterDesc::SpillSize.

static bool llvm::MRegisterInfo::isPhysicalRegister unsigned  Reg  )  [inline, static]
 

isPhysicalRegister - Return true if the specified register number is in the physical register namespace.

Definition at line 150 of file MRegisterInfo.h.

References FirstVirtualRegister.

Referenced by llvm::PhysRegTracker::addRegUse(), llvm::VirtRegMap::assignVirt2Phys(), llvm::PhysRegTracker::delRegUse(), llvm::PhysRegTracker::isRegAvail(), OutputReg(), and llvm::LiveVariables::runOnMachineFunction().

static bool llvm::MRegisterInfo::isVirtualRegister unsigned  Reg  )  [inline, static]
 

isVirtualRegister - Return true if the specified register number is in the virtual register namespace.

Definition at line 157 of file MRegisterInfo.h.

References FirstVirtualRegister.

Referenced by llvm::VirtRegMap::assignVirt2Phys(), llvm::VirtRegMap::assignVirt2StackSlot(), llvm::VirtRegMap::clearVirt(), llvm::VirtRegMap::getPhys(), llvm::VirtRegMap::getStackSlot(), llvm::LiveVariables::getVarInfo(), getX86RegNum(), llvm::LiveVariables::instructionChanged(), llvm::LiveVariables::runOnMachineFunction(), and llvm::LiveIntervals::runOnMachineFunction().

virtual void llvm::MRegisterInfo::loadRegFromStackSlot MachineBasicBlock MBB,
MachineBasicBlock::iterator  MI,
unsigned  DestReg,
int  FrameIndex
const [pure virtual]
 

Implemented in llvm::SparcV9RegisterInfo.

const MRegisterDesc& llvm::MRegisterInfo::operator[] unsigned  RegNo  )  const [inline]
 

Definition at line 166 of file MRegisterInfo.h.

Referenced by get().

virtual void llvm::MRegisterInfo::processFunctionBeforeFrameFinalized MachineFunction MF  )  const [inline, virtual]
 

processFunctionBeforeFrameFinalized - This method is called immediately before the specified functions frame layout (MF.getFrameInfo()) is finalized. Once the frame is finalized, MO_FrameIndex operands are replaced with direct constants. This method is optional. The return value is the number of instructions added to (negative if removed from) the basic block

Definition at line 300 of file MRegisterInfo.h.

regclass_iterator llvm::MRegisterInfo::regclass_begin  )  const [inline]
 

Register class iterators

Definition at line 226 of file MRegisterInfo.h.

Referenced by getAllocatableSet(), and getNumRegClasses().

regclass_iterator llvm::MRegisterInfo::regclass_end  )  const [inline]
 

Definition at line 227 of file MRegisterInfo.h.

Referenced by getAllocatableSet(), and getNumRegClasses().

virtual void llvm::MRegisterInfo::storeRegToStackSlot MachineBasicBlock MBB,
MachineBasicBlock::iterator  MI,
unsigned  SrcReg,
int  FrameIndex
const [pure virtual]
 

Implemented in llvm::SparcV9RegisterInfo.


The documentation for this class was generated from the following files: