LLVM API Documentation

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
 NoRegister = 0
 FirstVirtualRegister = 1024
enum  { NoRegister = 0, FirstVirtualRegister = 1024 }

Public Member Functions

std::vector< bool > getAllocatableSet (MachineFunction &MF) const
const TargetRegisterDescoperator[] (unsigned RegNo) const
const TargetRegisterDescget (unsigned RegNo) const
const unsigned * getAliasSet (unsigned RegNo) const
const char * getName (unsigned RegNo) const
unsigned getNumRegs () const
bool areAliases (unsigned regA, unsigned regB) const
virtual const unsigned * getCalleeSaveRegs () const =0
virtual const TargetRegisterClass
*const * 
getCalleeSaveRegClasses () 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 TargetRegisterClass *RC) const =0
virtual void loadRegFromStackSlot (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, int FrameIndex, const TargetRegisterClass *RC) 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
virtual int getDwarfRegNum (unsigned RegNum) const =0
 Debug information queries.
virtual unsigned getFrameRegister (MachineFunction &MF) const =0
virtual unsigned getRARegister () const =0
virtual void getLocation (MachineFunction &MF, unsigned Index, MachineLocation &ML) const
virtual void getInitialFrameState (std::vector< MachineMove * > &Moves) const

Static Public Member Functions

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

Protected Member Functions

 MRegisterInfo (const TargetRegisterDesc *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 TargetRegisterDesc 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 142 of file MRegisterInfo.h.


Member Typedef Documentation

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

Definition at line 144 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 159 of file MRegisterInfo.h.


Constructor & Destructor Documentation

MRegisterInfo::MRegisterInfo ( const TargetRegisterDesc D,
unsigned  NR,
regclass_iterator  RegClassBegin,
regclass_iterator  RegClassEnd,
int  CallFrameSetupOpcode = -1,
int  CallFrameDestroyOpcode = -1 
) [protected]

Definition at line 22 of file MRegisterInfo.cpp.

References FirstVirtualRegister.

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

Definition at line 33 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 230 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.

Referenced by llvm::ScheduleDAG::EmitNode(), and llvm::LiveIntervals::runOnMachineFunction().

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 310 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 286 of file MRegisterInfo.h.

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

const TargetRegisterDesc& 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 204 of file MRegisterInfo.h.

References operator[]().

Referenced by getAliasSet(), getName(), llvm::X86IntelAsmPrinter::printOp(), llvm::X86IntelAsmPrinter::printOperand(), and llvm::X86ATTAsmPrinter::printOperand().

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 212 of file MRegisterInfo.h.

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

Referenced by llvm::PhysRegTracker::addRegUse(), areAliases(), AvailableSpills::ClobberPhysReg(), llvm::PhysRegTracker::delRegUse(), llvm::LiveIntervals::runOnMachineFunction(), and updateSpillWeights().

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

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

Definition at line 35 of file MRegisterInfo.cpp.

References E, I, MF, RC, regclass_begin(), and regclass_end().

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

virtual const TargetRegisterClass* const* llvm::MRegisterInfo::getCalleeSaveRegClasses (  )  const [pure virtual]

getCalleeSaveRegClasses - Return a null-terminated list of the preferred register classes to spill each callee-saved register with. The order and length of this list match the getCalleeSaveRegs() list.

Implemented in llvm::SparcV9RegisterInfo.

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

getCalleeSaveRegs - Return a null-terminated list of all of the callee-save registers on this target.

Implemented in llvm::SparcV9RegisterInfo.

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

Definition at line 299 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 298 of file MRegisterInfo.h.

Referenced by eliminateCallFramePseudoInstr().

virtual int llvm::MRegisterInfo::getDwarfRegNum ( unsigned  RegNum  )  const [pure virtual]

Debug information queries.

getDwarfRegNum - Map a target register to an equivalent dwarf register number. Returns -1 if there is no equivalent value.

Implemented in llvm::SparcV9RegisterInfo.

virtual unsigned llvm::MRegisterInfo::getFrameRegister ( MachineFunction MF  )  const [pure virtual]

getFrameRegister - This method should return the register used as a base for values allocated in the current stack frame.

Implemented in llvm::SparcV9RegisterInfo.

Referenced by getLocation().

void MRegisterInfo::getInitialFrameState ( std::vector< MachineMove * > &  Moves  )  const [virtual]

getInitialFrameState - Returns a list of machine moves that are assumed on entry to all functions. Note that LabelID is ignored (assumed to be the beginning of the function.)

Definition at line 61 of file MRegisterInfo.cpp.

void MRegisterInfo::getLocation ( MachineFunction MF,
unsigned  Index,
MachineLocation ML 
) const [virtual]

getLocation - This method should return the actual location of a frame variable given the frame index. The location is returned in ML. Subclasses should override this method for special handling of frame variables and call MRegisterInfo::getLocation for the default action.

Definition at line 51 of file MRegisterInfo.cpp.

References llvm::MachineFunction::getFrameInfo(), getFrameRegister(), llvm::MachineFrameInfo::getObjectOffset(), llvm::MachineFrameInfo::getStackSize(), MF, and llvm::MachineLocation::set().

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

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

Definition at line 218 of file MRegisterInfo.h.

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

Referenced by AvailableSpills::addAvailable(), llvm::VirtRegMap::print(), llvm::MachineFunction::print(), and llvm::LiveInterval::print().

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

Definition at line 254 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 224 of file MRegisterInfo.h.

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

virtual unsigned llvm::MRegisterInfo::getRARegister (  )  const [pure virtual]

getRARegister - This method should return the register where the return address can be found.

Implemented in llvm::SparcV9RegisterInfo.

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 179 of file MRegisterInfo.h.

References FirstVirtualRegister.

Referenced by llvm::PhysRegTracker::addRegUse(), llvm::VirtRegMap::assignVirt2Phys(), llvm::PhysRegTracker::delRegUse(), llvm::SDNode::dump(), llvm::PhysRegTracker::isRegAvail(), llvm::AlphaTargetLowering::LowerArguments(), OutputReg(), llvm::LiveInterval::print(), llvm::X86IntelAsmPrinter::printOp(), llvm::X86IntelAsmPrinter::printOperand(), llvm::X86ATTAsmPrinter::printOperand(), 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 186 of file MRegisterInfo.h.

References FirstVirtualRegister.

Referenced by llvm::VirtRegMap::assignVirt2Phys(), llvm::VirtRegMap::assignVirt2StackSlot(), llvm::VirtRegMap::clearVirt(), llvm::ScheduleDAG::EmitNode(), llvm::VirtRegMap::getPhys(), llvm::VirtRegMap::getStackSlot(), llvm::LiveVariables::getVarInfo(), 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 TargetRegisterClass RC 
) const [pure virtual]

Implemented in llvm::SparcV9RegisterInfo.

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

Definition at line 195 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 326 of file MRegisterInfo.h.

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

Register class iterators

Definition at line 251 of file MRegisterInfo.h.

Referenced by llvm::ScheduleDAG::EmitNode(), getAllocatableSet(), getNumRegClasses(), isAllocatableRegister(), and llvm::LiveIntervals::runOnMachineFunction().

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

Definition at line 252 of file MRegisterInfo.h.

Referenced by llvm::ScheduleDAG::EmitNode(), getAllocatableSet(), getNumRegClasses(), isAllocatableRegister(), and llvm::LiveIntervals::runOnMachineFunction().

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

Implemented in llvm::SparcV9RegisterInfo.


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