LLVM API Documentation

llvm::TargetRegisterInfo Class Reference

#include <TargetRegisterInfo.h>

Collaboration diagram for llvm::TargetRegisterInfo:

Collaboration graph
[legend]

List of all members.

Public Types

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

Public Member Functions

const TargetRegisterClassgetPhysicalRegisterRegClass (unsigned Reg, MVT VT=MVT::Other) const
BitVector getAllocatableSet (MachineFunction &MF, const TargetRegisterClass *RC=NULL) const
const TargetRegisterDescoperator[] (unsigned RegNo) const
const TargetRegisterDescget (unsigned RegNo) const
const unsignedgetAliasSet (unsigned RegNo) const
const unsignedgetSubRegisters (unsigned RegNo) const
const unsignedgetSuperRegisters (unsigned RegNo) const
const char * getAsmName (unsigned RegNo) const
const char * getName (unsigned RegNo) const
unsigned getNumRegs () const
bool areAliases (unsigned regA, unsigned regB) const
bool regsOverlap (unsigned regA, unsigned regB) const
bool isSubRegister (unsigned regA, unsigned regB) const
bool isSuperRegister (unsigned regA, unsigned regB) const
virtual const unsignedgetCalleeSavedRegs (const MachineFunction *MF=0) const =0
virtual const
TargetRegisterClass *const * 
getCalleeSavedRegClasses (const MachineFunction *MF) const =0
virtual BitVector getReservedRegs (const MachineFunction &MF) const =0
virtual unsigned getSubReg (unsigned RegNo, unsigned Index) const =0
regclass_iterator regclass_begin () const
regclass_iterator regclass_end () const
unsigned getNumRegClasses () const
const TargetRegisterClassgetRegClass (unsigned i) const
virtual const TargetRegisterClassgetCrossCopyRegClass (const TargetRegisterClass *RC) const
virtual bool targetHandlesStackFrameRounding () const
virtual bool requiresRegisterScavenging (const MachineFunction &MF) const
virtual bool hasFP (const MachineFunction &MF) const =0
virtual bool hasReservedCallFrame (MachineFunction &MF) const
virtual bool needsStackRealignment (const MachineFunction &MF) const
int getCallFrameSetupOpcode () const
int getCallFrameDestroyOpcode () const
virtual void eliminateCallFramePseudoInstr (MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const
virtual void processFunctionBeforeCalleeSavedScan (MachineFunction &MF, RegScavenger *RS=NULL) const
virtual void processFunctionBeforeFrameFinalized (MachineFunction &MF) const
virtual void eliminateFrameIndex (MachineBasicBlock::iterator MI, int SPAdj, RegScavenger *RS=NULL) const =0
virtual void emitPrologue (MachineFunction &MF) const =0
virtual void emitEpilogue (MachineFunction &MF, MachineBasicBlock &MBB) const =0
virtual int getDwarfRegNum (unsigned RegNum, bool isEH) const =0
 Debug information queries.
virtual unsigned getFrameRegister (MachineFunction &MF) const =0
virtual int getFrameIndexOffset (MachineFunction &MF, int FI) const
virtual unsigned getRARegister () const =0
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

 TargetRegisterInfo (const TargetRegisterDesc *D, unsigned NR, regclass_iterator RegClassBegin, regclass_iterator RegClassEnd, int CallFrameSetupOpcode=-1, int CallFrameDestroyOpcode=-1, const unsigned *subregs=0, const unsigned subregsize=0)
virtual ~TargetRegisterInfo ()

Protected Attributes

const unsignedSubregHash
const unsigned SubregHashSize


Detailed Description

TargetRegisterInfo 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 239 of file TargetRegisterInfo.h.


Member Typedef Documentation

Definition at line 244 of file TargetRegisterInfo.h.


Member Enumeration Documentation

anonymous enum

Enumerator:
NoRegister  NoRegister - This physical register is not a real target register. It is useful as a sentinal.
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 263 of file TargetRegisterInfo.h.


Constructor & Destructor Documentation

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

Definition at line 23 of file TargetRegisterInfo.cpp.

References FirstVirtualRegister.

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

Definition at line 36 of file TargetRegisterInfo.cpp.


Member Function Documentation

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

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

const TargetRegisterClass * TargetRegisterInfo::getPhysicalRegisterRegClass ( unsigned  reg,
MVT  VT = MVT::Other 
) const

getPhysicalRegisterRegClass - Returns the Register Class of a physical register of the given type. If type is MVT::Other, then just return any register class the register belongs to.

getPhysicalRegisterRegClass - Returns the Register Class of a physical register of the given type. If type is MVT::Other, then just return any register class the register belongs to.

Definition at line 42 of file TargetRegisterInfo.cpp.

References llvm::TargetRegisterClass::contains(), E, llvm::TargetRegisterClass::hasSuperClass(), llvm::TargetRegisterClass::hasType(), I, isPhysicalRegister(), llvm::MVT::Other, regclass_begin(), and regclass_end().

Referenced by CheckForPhysRegDependency(), and llvm::ScheduleDAGSDNodes::EmitNode().

BitVector TargetRegisterInfo::getAllocatableSet ( MachineFunction MF,
const TargetRegisterClass RC = NULL 
) const

getAllocatableSet - Returns a bitset indexed by register number indicating if a register is allocatable or not. If a register class is specified, returns the subset for the class.

Definition at line 68 of file TargetRegisterInfo.cpp.

References E, getAllocatableSetForRC(), I, regclass_begin(), and regclass_end().

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

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

Definition at line 301 of file TargetRegisterInfo.h.

Referenced by get().

const TargetRegisterDesc& llvm::TargetRegisterInfo::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 310 of file TargetRegisterInfo.h.

References operator[]().

Referenced by OutputReg(), llvm::MachineOperand::print(), and llvm::X86IntelAsmPrinter::printOperand().

const unsigned* llvm::TargetRegisterInfo::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 318 of file TargetRegisterInfo.h.

Referenced by llvm::MachineInstr::addRegisterDead(), llvm::MachineInstr::addRegisterKilled(), llvm::PhysRegTracker::addRegUse(), areAliases(), llvm::ScheduleDAGInstrs::BuildSchedGraph(), llvm::PhysRegTracker::delRegUse(), llvm::LiveIntervals::spillPhysRegAroundRegDefsUses(), UpdateKills(), and updateSpillWeights().

const unsigned* llvm::TargetRegisterInfo::getSubRegisters ( unsigned  RegNo  )  const [inline]

getSubRegisters - Return the list of registers that are sub-registers of the specified register, or a null list of there are none. The list returned is zero terminated and sorted according to super-sub register relations. e.g. X86::RAX's sub-register list is EAX, AX, AL, AH.

Definition at line 327 of file TargetRegisterInfo.h.

Referenced by llvm::MachineInstr::addRegisterDead(), removeIntervalIfEmpty(), removeRange(), llvm::RegScavenger::setUnused(), llvm::RegScavenger::setUsed(), and llvm::LiveIntervals::spillPhysRegAroundRegDefsUses().

const unsigned* llvm::TargetRegisterInfo::getSuperRegisters ( unsigned  RegNo  )  const [inline]

getSuperRegisters - Return the list of registers that are super-registers of the specified register, or a null list of there are none. The list returned is zero terminated and sorted according to super-sub register relations. e.g. X86::AL's super-register list is RAX, EAX, AX.

Definition at line 336 of file TargetRegisterInfo.h.

Referenced by llvm::MachineInstr::addRegisterDead(), getMatchingSuperReg(), llvm::LiveIntervals::getRepresentativeReg(), and isSuperRegister().

const char* llvm::TargetRegisterInfo::getAsmName ( unsigned  RegNo  )  const [inline]

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

Definition at line 342 of file TargetRegisterInfo.h.

Referenced by llvm::X86ATTAsmPrinter::printAsmMRegister(), llvm::AsmPrinter::printImplicitDef(), and llvm::X86ATTAsmPrinter::printOperand().

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

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

Definition at line 348 of file TargetRegisterInfo.h.

References Name.

Referenced by llvm::VirtRegMap::print(), llvm::MachineFunction::print(), llvm::LiveInterval::print(), llvm::X86IntelAsmPrinter::printAsmMRegister(), and llvm::X86IntelAsmPrinter::printOp().

unsigned llvm::TargetRegisterInfo::getNumRegs (  )  const [inline]

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

Definition at line 354 of file TargetRegisterInfo.h.

Referenced by llvm::CCState::CCState(), llvm::RegScavenger::enterBasicBlock(), llvm::MachineRegisterInfo::MachineRegisterInfo(), and llvm::LiveVariables::runOnMachineFunction().

bool llvm::TargetRegisterInfo::areAliases ( unsigned  regA,
unsigned  regB 
) const [inline]

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

Definition at line 360 of file TargetRegisterInfo.h.

References getAliasSet().

Referenced by regsOverlap().

bool llvm::TargetRegisterInfo::regsOverlap ( unsigned  regA,
unsigned  regB 
) const [inline]

regsOverlap - Returns true if the two registers are equal or alias each other. The registers may be virtual register.

Definition at line 368 of file TargetRegisterInfo.h.

References areAliases(), and isVirtualRegister().

Referenced by canClobberPhysRegDefs(), llvm::LiveIntervals::conflictsWithPhysRegDef(), and EmitLiveInCopy().

bool llvm::TargetRegisterInfo::isSubRegister ( unsigned  regA,
unsigned  regB 
) const [inline]

bool llvm::TargetRegisterInfo::isSuperRegister ( unsigned  regA,
unsigned  regB 
) const [inline]

isSuperRegister - Returns true if regB is a super-register of regA.

Definition at line 397 of file TargetRegisterInfo.h.

References getSuperRegisters(), and SR.

Referenced by llvm::MachineInstr::addRegisterDead(), llvm::MachineInstr::addRegisterKilled(), RedefinesSuperRegPart(), and llvm::LiveIntervals::spillPhysRegAroundRegDefsUses().

virtual const unsigned* llvm::TargetRegisterInfo::getCalleeSavedRegs ( const MachineFunction MF = 0  )  const [pure virtual]

getCalleeSavedRegs - Return a null-terminated list of all of the callee saved registers on this target. The register should be in the order of desired callee-save stack frame offset. The first register is closed to the incoming stack pointer if stack grows down, and vice versa.

Referenced by llvm::RegScavenger::enterBasicBlock().

virtual const TargetRegisterClass* const* llvm::TargetRegisterInfo::getCalleeSavedRegClasses ( const MachineFunction MF  )  const [pure virtual]

getCalleeSavedRegClasses - 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.

virtual BitVector llvm::TargetRegisterInfo::getReservedRegs ( const MachineFunction MF  )  const [pure virtual]

getReservedRegs - Returns a bitset indexed by physical register number indicating if a register is a special register that has particular uses and should be considered unavailable at all times, e.g. SP, RA. This is used by register scavenger to determine what registers are free.

Referenced by llvm::RegScavenger::enterBasicBlock(), and llvm::LiveVariables::runOnMachineFunction().

virtual unsigned llvm::TargetRegisterInfo::getSubReg ( unsigned  RegNo,
unsigned  Index 
) const [pure virtual]

getSubReg - Returns the physical register number of sub-register "Index" for physical register RegNo. Return zero if the sub-register does not exist.

Referenced by findSuperReg(), getMatchingSuperReg(), llvm::LiveIntervals::getVNInfoSourceReg(), and ReMaterialize().

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

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

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

const TargetRegisterClass* llvm::TargetRegisterInfo::getRegClass ( unsigned  i  )  const [inline]

getRegClass - Returns the register class associated with the enumeration value. See class TargetOperandInfo.

Definition at line 442 of file TargetRegisterInfo.h.

References getNumRegClasses().

Referenced by getInstrOperandRegClass().

virtual const TargetRegisterClass* llvm::TargetRegisterInfo::getCrossCopyRegClass ( const TargetRegisterClass RC  )  const [inline, virtual]

getCrossCopyRegClass - Returns a legal register class to copy a register in the specified class to or from. Returns NULL if it is possible to copy between a two registers of the specified class.

Definition at line 457 of file TargetRegisterInfo.h.

virtual bool llvm::TargetRegisterInfo::targetHandlesStackFrameRounding (  )  const [inline, virtual]

targetHandlesStackFrameRounding - Returns true if the target is responsible for rounding up the stack frame (probably at emitPrologue time).

Definition at line 464 of file TargetRegisterInfo.h.

virtual bool llvm::TargetRegisterInfo::requiresRegisterScavenging ( const MachineFunction MF  )  const [inline, virtual]

requiresRegisterScavenging - returns true if the target requires (and can make use of) the register scavenger.

Definition at line 470 of file TargetRegisterInfo.h.

virtual bool llvm::TargetRegisterInfo::hasFP ( const MachineFunction MF  )  const [pure virtual]

hasFP - Return true if the specified function should have a dedicated frame pointer register. For most targets this is true only if the function has variable sized allocas or if frame pointer elimination is disabled.

Referenced by hasReservedCallFrame().

virtual bool llvm::TargetRegisterInfo::hasReservedCallFrame ( MachineFunction MF  )  const [inline, virtual]

Definition at line 484 of file TargetRegisterInfo.h.

References hasFP().

virtual bool llvm::TargetRegisterInfo::needsStackRealignment ( const MachineFunction MF  )  const [inline, virtual]

Definition at line 491 of file TargetRegisterInfo.h.

int llvm::TargetRegisterInfo::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 501 of file TargetRegisterInfo.h.

Referenced by eliminateCallFramePseudoInstr().

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

Definition at line 502 of file TargetRegisterInfo.h.

Referenced by eliminateCallFramePseudoInstr().

virtual void llvm::TargetRegisterInfo::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 513 of file TargetRegisterInfo.h.

References getCallFrameDestroyOpcode(), and getCallFrameSetupOpcode().

virtual void llvm::TargetRegisterInfo::processFunctionBeforeCalleeSavedScan ( MachineFunction MF,
RegScavenger RS = NULL 
) const [inline, virtual]

processFunctionBeforeCalleeSavedScan - This method is called immediately before PrologEpilogInserter scans the physical registers used to determine what callee saved registers should be spilled. This method is optional.

Definition at line 525 of file TargetRegisterInfo.h.

virtual void llvm::TargetRegisterInfo::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.

Definition at line 535 of file TargetRegisterInfo.h.

virtual void llvm::TargetRegisterInfo::eliminateFrameIndex ( MachineBasicBlock::iterator  MI,
int  SPAdj,
RegScavenger RS = NULL 
) 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. SPAdj is the SP adjustment due to call frame setup instruction.

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

emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.

virtual void llvm::TargetRegisterInfo::emitEpilogue ( MachineFunction MF,
MachineBasicBlock MBB 
) const [pure virtual]

virtual int llvm::TargetRegisterInfo::getDwarfRegNum ( unsigned  RegNum,
bool  isEH 
) 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. The second parameter allows targets to use different numberings for EH info and debugging info.

virtual unsigned llvm::TargetRegisterInfo::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.

int TargetRegisterInfo::getFrameIndexOffset ( MachineFunction MF,
int  FI 
) const [virtual]

getFrameIndexOffset - Returns the displacement from the frame register to the stack frame of the specified index.

getFrameIndexOffset - Returns the displacement from the frame register to the stack frame of the specified index. This is the default implementation which is likely incorrect for the target.

Definition at line 85 of file TargetRegisterInfo.cpp.

References llvm::MachineFunction::getFrameInfo(), llvm::TargetMachine::getFrameInfo(), llvm::MachineFrameInfo::getObjectOffset(), llvm::MachineFrameInfo::getOffsetAdjustment(), llvm::TargetFrameInfo::getOffsetOfLocalArea(), llvm::MachineFrameInfo::getStackSize(), llvm::MachineFunction::getTarget(), and MFI.

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

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

void TargetRegisterInfo::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.)

getInitialFrameState - Returns a list of machine moves that are assumed on entry to a function.

Definition at line 95 of file TargetRegisterInfo.cpp.


Member Data Documentation

Definition at line 241 of file TargetRegisterInfo.h.

Referenced by isSubRegister().

Definition at line 242 of file TargetRegisterInfo.h.

Referenced by isSubRegister().


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



This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.