LLVM API Documentation

llvm::VirtRegMap Class Reference

#include <VirtRegMap.h>

Collaboration diagram for llvm::VirtRegMap:

Collaboration graph
[legend]

List of all members.

Public Types

enum  { NO_PHYS_REG = 0, NO_STACK_SLOT = (1L << 30)-1, MAX_STACK_SLOT = (1L << 18)-1 }
enum  ModRef { isRef = 1, isMod = 2, isModRef = 3 }
typedef std::multimap
< MachineInstr *, std::pair
< unsigned, ModRef > > 
MI2VirtMapTy

Public Member Functions

 VirtRegMap (MachineFunction &mf)
void grow ()
bool hasPhys (unsigned virtReg) const
 returns true if the specified virtual register is mapped to a physical register
unsigned getPhys (unsigned virtReg) const
 returns the physical register mapped to the specified virtual register
void assignVirt2Phys (unsigned virtReg, unsigned physReg)
 creates a mapping for the specified virtual register to the specified physical register
void clearVirt (unsigned virtReg)
 clears the specified virtual register's, physical register mapping
void clearAllVirt ()
 clears all virtual to physical register mappings
void setIsSplitFromReg (unsigned virtReg, unsigned SReg)
 records virtReg is a split live interval from SReg.
unsigned getPreSplitReg (unsigned virtReg)
 returns the live interval virtReg is split from.
bool isAssignedReg (unsigned virtReg) const
 returns true if the specified virtual register is not mapped to a stack slot or rematerialized.
int getStackSlot (unsigned virtReg) const
 returns the stack slot mapped to the specified virtual register
int getReMatId (unsigned virtReg) const
 returns the rematerialization id mapped to the specified virtual register
int assignVirt2StackSlot (unsigned virtReg)
 create a mapping for the specifed virtual register to the next available stack slot
void assignVirt2StackSlot (unsigned virtReg, int frameIndex)
 create a mapping for the specified virtual register to the specified stack slot
int assignVirtReMatId (unsigned virtReg)
 assign an unique re-materialization id to the specified virtual register.
void assignVirtReMatId (unsigned virtReg, int id)
 assign an unique re-materialization id to the specified virtual register.
bool isReMaterialized (unsigned virtReg) const
 returns true if the specified virtual register is being re-materialized.
MachineInstrgetReMaterializedMI (unsigned virtReg) const
 returns the original machine instruction being re-issued to re-materialize the specified virtual register.
void setVirtIsReMaterialized (unsigned virtReg, MachineInstr *def)
 records the specified virtual register will be re-materialized and the original instruction which will be re-issed for this purpose. If parameter all is true, then all uses of the registers are rematerialized and it's safe to delete the definition.
void addKillPoint (unsigned virtReg, unsigned index)
 record the last use (kill) of a split virtual register.
unsigned getKillPoint (unsigned virtReg) const
void removeKillPoint (unsigned virtReg)
 remove the last use (kill) of a split virtual register.
bool isSpillPt (MachineInstr *Pt) const
 returns true if the specified MachineInstr is a spill point.
std::vector< std::pair
< unsigned, bool > > & 
getSpillPtSpills (MachineInstr *Pt)
 returns the virtual registers that should be spilled due to splitting right after the specified MachineInstr.
void addSpillPoint (unsigned virtReg, bool isKill, MachineInstr *Pt)
 records the specified MachineInstr as a spill point for virtReg.
void transferSpillPts (MachineInstr *Old, MachineInstr *New)
 
  • transfer spill point information from one instruction to another.

bool isRestorePt (MachineInstr *Pt) const
 returns true if the specified MachineInstr is a restore point.
std::vector< unsigned > & getRestorePtRestores (MachineInstr *Pt)
 returns the virtual registers that should be restoreed due to splitting right after the specified MachineInstr.
void addRestorePoint (unsigned virtReg, MachineInstr *Pt)
 records the specified MachineInstr as a restore point for virtReg.
void transferRestorePts (MachineInstr *Old, MachineInstr *New)
 
  • transfer restore point information from one instruction to another.

void addEmergencySpill (unsigned PhysReg, MachineInstr *MI)
 records that the specified physical register must be spilled around the specified machine instr.
bool hasEmergencySpills (MachineInstr *MI) const
 returns true if one or more physical registers must be spilled around the specified instruction.
std::vector< unsigned > & getEmergencySpills (MachineInstr *MI)
 returns the physical registers to be spilled and restored around the instruction.
void transferEmergencySpills (MachineInstr *Old, MachineInstr *New)
 
  • transfer emergency spill information from one instruction to another.

int getEmergencySpillSlot (const TargetRegisterClass *RC)
 return or get a emergency spill slot for the register class.
int getLowSpillSlot () const
 Return lowest spill slot index.
int getHighSpillSlot () const
 Return highest spill slot index.
void addSpillSlotUse (int FrameIndex, MachineInstr *MI)
 Records a spill slot use.
bool isSpillSlotUsed (int FrameIndex) const
 Returns true if spill slot has been used.
void setIsImplicitlyDefined (unsigned VirtReg)
 Mark the specified register as being implicitly defined.
bool isImplicitlyDefined (unsigned VirtReg) const
 Returns true if the virtual register is implicitly defined.
void virtFolded (unsigned VirtReg, MachineInstr *OldMI, MachineInstr *NewMI, ModRef MRInfo)
 Updates information about the specified virtual register's value folded into newMI machine instruction.
void virtFolded (unsigned VirtReg, MachineInstr *MI, ModRef MRInfo)
 Updates information about the specified virtual register's value folded into the specified machine instruction.
std::pair
< MI2VirtMapTy::const_iterator,
MI2VirtMapTy::const_iterator > 
getFoldedVirts (MachineInstr *MI) const
 returns the virtual registers' values folded in memory operands of this instruction
void RemoveMachineInstrFromMaps (MachineInstr *MI)
void print (std::ostream &OS) const
void print (std::ostream *OS) const
void dump () const


Detailed Description

Definition at line 33 of file VirtRegMap.h.


Member Typedef Documentation

typedef std::multimap<MachineInstr*, std::pair<unsigned, ModRef> > llvm::VirtRegMap::MI2VirtMapTy

Definition at line 43 of file VirtRegMap.h.


Member Enumeration Documentation

anonymous enum

Enumerator:
NO_PHYS_REG 
NO_STACK_SLOT 
MAX_STACK_SLOT 

Definition at line 35 of file VirtRegMap.h.

Enumerator:
isRef 
isMod 
isModRef 

Definition at line 41 of file VirtRegMap.h.


Constructor & Destructor Documentation

VirtRegMap::VirtRegMap ( MachineFunction mf  )  [explicit]


Member Function Documentation

void VirtRegMap::grow (  ) 

bool llvm::VirtRegMap::hasPhys ( unsigned  virtReg  )  const [inline]

returns true if the specified virtual register is mapped to a physical register

Definition at line 134 of file VirtRegMap.h.

References getPhys(), and NO_PHYS_REG.

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

unsigned llvm::VirtRegMap::getPhys ( unsigned  virtReg  )  const [inline]

returns the physical register mapped to the specified virtual register

Definition at line 140 of file VirtRegMap.h.

References llvm::TargetRegisterInfo::isVirtualRegister().

Referenced by llvm::LiveIntervals::conflictsWithPhysRegDef(), hasPhys(), and ReMaterialize().

void llvm::VirtRegMap::assignVirt2Phys ( unsigned  virtReg,
unsigned  physReg 
) [inline]

creates a mapping for the specified virtual register to the specified physical register

Definition at line 147 of file VirtRegMap.h.

References llvm::TargetRegisterInfo::isPhysicalRegister(), llvm::TargetRegisterInfo::isVirtualRegister(), and NO_PHYS_REG.

void llvm::VirtRegMap::clearVirt ( unsigned  virtReg  )  [inline]

clears the specified virtual register's, physical register mapping

Definition at line 158 of file VirtRegMap.h.

References llvm::TargetRegisterInfo::isVirtualRegister(), and NO_PHYS_REG.

void llvm::VirtRegMap::clearAllVirt (  )  [inline]

clears all virtual to physical register mappings

Definition at line 166 of file VirtRegMap.h.

References grow().

void llvm::VirtRegMap::setIsSplitFromReg ( unsigned  virtReg,
unsigned  SReg 
) [inline]

records virtReg is a split live interval from SReg.

Definition at line 172 of file VirtRegMap.h.

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

unsigned llvm::VirtRegMap::getPreSplitReg ( unsigned  virtReg  )  [inline]

returns the live interval virtReg is split from.

Definition at line 177 of file VirtRegMap.h.

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

bool llvm::VirtRegMap::isAssignedReg ( unsigned  virtReg  )  const [inline]

returns true if the specified virtual register is not mapped to a stack slot or rematerialized.

Definition at line 183 of file VirtRegMap.h.

References getReMatId(), getStackSlot(), NO_PHYS_REG, and NO_STACK_SLOT.

int llvm::VirtRegMap::getStackSlot ( unsigned  virtReg  )  const [inline]

returns the stack slot mapped to the specified virtual register

Definition at line 194 of file VirtRegMap.h.

References llvm::TargetRegisterInfo::isVirtualRegister().

Referenced by llvm::LiveIntervals::addIntervalsForSpills(), addStackInterval(), and isAssignedReg().

int llvm::VirtRegMap::getReMatId ( unsigned  virtReg  )  const [inline]

returns the rematerialization id mapped to the specified virtual register

Definition at line 201 of file VirtRegMap.h.

References llvm::TargetRegisterInfo::isVirtualRegister().

Referenced by isAssignedReg().

int VirtRegMap::assignVirt2StackSlot ( unsigned  virtReg  ) 

void VirtRegMap::assignVirt2StackSlot ( unsigned  virtReg,
int  frameIndex 
)

create a mapping for the specified virtual register to the specified stack slot

Definition at line 110 of file VirtRegMap.cpp.

References llvm::MachineFunction::getFrameInfo(), llvm::MachineFrameInfo::getObjectIndexBegin(), llvm::TargetRegisterInfo::isVirtualRegister(), and NO_STACK_SLOT.

int VirtRegMap::assignVirtReMatId ( unsigned  virtReg  ) 

assign an unique re-materialization id to the specified virtual register.

Definition at line 120 of file VirtRegMap.cpp.

References llvm::TargetRegisterInfo::isVirtualRegister(), and NO_STACK_SLOT.

void VirtRegMap::assignVirtReMatId ( unsigned  virtReg,
int  id 
)

assign an unique re-materialization id to the specified virtual register.

Definition at line 128 of file VirtRegMap.cpp.

References llvm::TargetRegisterInfo::isVirtualRegister(), and NO_STACK_SLOT.

bool llvm::VirtRegMap::isReMaterialized ( unsigned  virtReg  )  const [inline]

returns true if the specified virtual register is being re-materialized.

Definition at line 222 of file VirtRegMap.h.

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

MachineInstr* llvm::VirtRegMap::getReMaterializedMI ( unsigned  virtReg  )  const [inline]

returns the original machine instruction being re-issued to re-materialize the specified virtual register.

Definition at line 228 of file VirtRegMap.h.

Referenced by llvm::LiveIntervals::addIntervalsForSpills(), and ReMaterialize().

void llvm::VirtRegMap::setVirtIsReMaterialized ( unsigned  virtReg,
MachineInstr def 
) [inline]

records the specified virtual register will be re-materialized and the original instruction which will be re-issed for this purpose. If parameter all is true, then all uses of the registers are rematerialized and it's safe to delete the definition.

Definition at line 236 of file VirtRegMap.h.

void llvm::VirtRegMap::addKillPoint ( unsigned  virtReg,
unsigned  index 
) [inline]

record the last use (kill) of a split virtual register.

Definition at line 241 of file VirtRegMap.h.

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

unsigned llvm::VirtRegMap::getKillPoint ( unsigned  virtReg  )  const [inline]

Definition at line 245 of file VirtRegMap.h.

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

void llvm::VirtRegMap::removeKillPoint ( unsigned  virtReg  )  [inline]

remove the last use (kill) of a split virtual register.

Definition at line 250 of file VirtRegMap.h.

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

bool llvm::VirtRegMap::isSpillPt ( MachineInstr Pt  )  const [inline]

returns true if the specified MachineInstr is a spill point.

Definition at line 255 of file VirtRegMap.h.

std::vector<std::pair<unsigned,bool> >& llvm::VirtRegMap::getSpillPtSpills ( MachineInstr Pt  )  [inline]

returns the virtual registers that should be spilled due to splitting right after the specified MachineInstr.

Definition at line 261 of file VirtRegMap.h.

void llvm::VirtRegMap::addSpillPoint ( unsigned  virtReg,
bool  isKill,
MachineInstr Pt 
) [inline]

records the specified MachineInstr as a spill point for virtReg.

Definition at line 266 of file VirtRegMap.h.

Referenced by llvm::LiveIntervals::addIntervalsForSpills(), llvm::LiveIntervals::addIntervalsForSpillsFast(), and transferSpillPts().

void llvm::VirtRegMap::transferSpillPts ( MachineInstr Old,
MachineInstr New 
) [inline]

  • transfer spill point information from one instruction to another.

Definition at line 278 of file VirtRegMap.h.

References addSpillPoint(), and I.

bool llvm::VirtRegMap::isRestorePt ( MachineInstr Pt  )  const [inline]

returns true if the specified MachineInstr is a restore point.

Definition at line 293 of file VirtRegMap.h.

std::vector<unsigned>& llvm::VirtRegMap::getRestorePtRestores ( MachineInstr Pt  )  [inline]

returns the virtual registers that should be restoreed due to splitting right after the specified MachineInstr.

Definition at line 299 of file VirtRegMap.h.

void llvm::VirtRegMap::addRestorePoint ( unsigned  virtReg,
MachineInstr Pt 
) [inline]

records the specified MachineInstr as a restore point for virtReg.

Definition at line 304 of file VirtRegMap.h.

Referenced by llvm::LiveIntervals::addIntervalsForSpills(), llvm::LiveIntervals::addIntervalsForSpillsFast(), and transferRestorePts().

void llvm::VirtRegMap::transferRestorePts ( MachineInstr Old,
MachineInstr New 
) [inline]

  • transfer restore point information from one instruction to another.

Definition at line 316 of file VirtRegMap.h.

References addRestorePoint(), and I.

void llvm::VirtRegMap::addEmergencySpill ( unsigned  PhysReg,
MachineInstr MI 
) [inline]

records that the specified physical register must be spilled around the specified machine instr.

Definition at line 331 of file VirtRegMap.h.

Referenced by llvm::LiveIntervals::spillPhysRegAroundRegDefsUses(), and transferEmergencySpills().

bool llvm::VirtRegMap::hasEmergencySpills ( MachineInstr MI  )  const [inline]

returns true if one or more physical registers must be spilled around the specified instruction.

Definition at line 343 of file VirtRegMap.h.

std::vector<unsigned>& llvm::VirtRegMap::getEmergencySpills ( MachineInstr MI  )  [inline]

returns the physical registers to be spilled and restored around the instruction.

Definition at line 349 of file VirtRegMap.h.

void llvm::VirtRegMap::transferEmergencySpills ( MachineInstr Old,
MachineInstr New 
) [inline]

  • transfer emergency spill information from one instruction to another.

Definition at line 355 of file VirtRegMap.h.

References addEmergencySpill(), and I.

int VirtRegMap::getEmergencySpillSlot ( const TargetRegisterClass RC  ) 

int llvm::VirtRegMap::getLowSpillSlot (  )  const [inline]

Return lowest spill slot index.

Definition at line 372 of file VirtRegMap.h.

int llvm::VirtRegMap::getHighSpillSlot (  )  const [inline]

Return highest spill slot index.

Definition at line 377 of file VirtRegMap.h.

void VirtRegMap::addSpillSlotUse ( int  FrameIndex,
MachineInstr MI 
)

Records a spill slot use.

Definition at line 150 of file VirtRegMap.cpp.

References llvm::MachineFunction::getFrameInfo(), and llvm::MachineFrameInfo::isFixedObjectIndex().

bool llvm::VirtRegMap::isSpillSlotUsed ( int  FrameIndex  )  const [inline]

Returns true if spill slot has been used.

Definition at line 385 of file VirtRegMap.h.

void llvm::VirtRegMap::setIsImplicitlyDefined ( unsigned  VirtReg  )  [inline]

Mark the specified register as being implicitly defined.

Definition at line 391 of file VirtRegMap.h.

References llvm::TargetRegisterInfo::FirstVirtualRegister, and llvm::BitVector::set().

bool llvm::VirtRegMap::isImplicitlyDefined ( unsigned  VirtReg  )  const [inline]

Returns true if the virtual register is implicitly defined.

Definition at line 396 of file VirtRegMap.h.

References llvm::TargetRegisterInfo::FirstVirtualRegister.

void VirtRegMap::virtFolded ( unsigned  VirtReg,
MachineInstr OldMI,
MachineInstr NewMI,
ModRef  MRInfo 
)

Updates information about the specified virtual register's value folded into newMI machine instruction.

Definition at line 163 of file VirtRegMap.cpp.

References E, and I.

void VirtRegMap::virtFolded ( unsigned  VirtReg,
MachineInstr MI,
ModRef  MRInfo 
)

Updates information about the specified virtual register's value folded into the specified machine instruction.

Definition at line 177 of file VirtRegMap.cpp.

std::pair<MI2VirtMapTy::const_iterator, MI2VirtMapTy::const_iterator> llvm::VirtRegMap::getFoldedVirts ( MachineInstr MI  )  const [inline]

returns the virtual registers' values folded in memory operands of this instruction

Definition at line 412 of file VirtRegMap.h.

void VirtRegMap::RemoveMachineInstrFromMaps ( MachineInstr MI  ) 

RemoveMachineInstrFromMaps - MI is being erased, remove it from the the folded instruction map and spill point map.

Definition at line 182 of file VirtRegMap.cpp.

References FI, llvm::MachineFunction::getFrameInfo(), llvm::MachineOperand::getIndex(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::isFI(), and llvm::MachineFrameInfo::isFixedObjectIndex().

void VirtRegMap::print ( std::ostream &  OS  )  const

void llvm::VirtRegMap::print ( std::ostream *  OS  )  const [inline]

Definition at line 421 of file VirtRegMap.h.

References print().

void VirtRegMap::dump (  )  const

Definition at line 222 of file VirtRegMap.cpp.

References llvm::cerr(), and print().


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.