LLVM API Documentation

llvm::LiveVariables Class Reference

#include <LiveVariables.h>

Inheritance diagram for llvm::LiveVariables:

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

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::vector< unsigned
>::iterator 
killed_iterator

Public Member Functions

virtual bool runOnMachineFunction (MachineFunction &MF)
std::vector< unsigned > & getKillsVector (MachineInstr *MI)
std::vector< unsigned > & getDeadDefsVector (MachineInstr *MI)
killed_iterator killed_begin (MachineInstr *MI)
killed_iterator killed_end (MachineInstr *MI)
std::pair< killed_iterator,
killed_iterator
killed_range (MachineInstr *MI)
bool KillsRegister (MachineInstr *MI, unsigned Reg) const
killed_iterator dead_begin (MachineInstr *MI)
killed_iterator dead_end (MachineInstr *MI)
std::pair< killed_iterator,
killed_iterator
dead_range (MachineInstr *MI)
bool RegisterDefIsDead (MachineInstr *MI, unsigned Reg) const
void instructionChanged (MachineInstr *OldMI, MachineInstr *NewMI)
void addVirtualRegisterKilled (unsigned IncomingReg, MachineInstr *MI)
bool removeVirtualRegisterKilled (unsigned reg, MachineBasicBlock *MBB, MachineInstr *MI)
void removeVirtualRegistersKilled (MachineInstr *MI)
void addVirtualRegisterDead (unsigned IncomingReg, MachineInstr *MI)
bool removeVirtualRegisterDead (unsigned reg, MachineBasicBlock *MBB, MachineInstr *MI)
void removeVirtualRegistersDead (MachineInstr *MI)
virtual void getAnalysisUsage (AnalysisUsage &AU) const
virtual void releaseMemory ()
VarInfogetVarInfo (unsigned RegIdx)
void MarkVirtRegAliveInBlock (VarInfo &VRInfo, MachineBasicBlock *BB)
void HandleVirtRegUse (VarInfo &VRInfo, MachineBasicBlock *MBB, MachineInstr *MI)

Classes

struct  VarInfo

Detailed Description

Definition at line 39 of file LiveVariables.h.


Member Typedef Documentation

typedef std::vector<unsigned>::iterator llvm::LiveVariables::killed_iterator

killed_iterator - Iterate over registers killed by a machine instruction

Definition at line 148 of file LiveVariables.h.


Member Function Documentation

void llvm::LiveVariables::addVirtualRegisterDead ( unsigned  IncomingReg,
MachineInstr MI 
) [inline]

addVirtualRegisterDead - Add information about the fact that the specified register is dead after being used by the specified instruction.

Definition at line 261 of file LiveVariables.h.

References getVarInfo(), I, llvm::LiveVariables::VarInfo::Kills, MI, and V.

void llvm::LiveVariables::addVirtualRegisterKilled ( unsigned  IncomingReg,
MachineInstr MI 
) [inline]

addVirtualRegisterKilled - Add information about the fact that the specified register is killed after being used by the specified instruction.

Definition at line 209 of file LiveVariables.h.

References getVarInfo(), I, llvm::LiveVariables::VarInfo::Kills, MI, and V.

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

killed_iterator llvm::LiveVariables::dead_begin ( MachineInstr MI  )  [inline]

Definition at line 180 of file LiveVariables.h.

References getDeadDefsVector(), and MI.

killed_iterator llvm::LiveVariables::dead_end ( MachineInstr MI  )  [inline]

Definition at line 183 of file LiveVariables.h.

References getDeadDefsVector(), and MI.

std::pair<killed_iterator, killed_iterator> llvm::LiveVariables::dead_range ( MachineInstr MI  )  [inline]

Definition at line 187 of file LiveVariables.h.

References getDeadDefsVector(), MI, and V.

Referenced by instructionChanged().

virtual void llvm::LiveVariables::getAnalysisUsage ( AnalysisUsage AU  )  const [inline, virtual]

getAnalysisUsage - This function should be overriden by passes that need analysis information to do their job. If a pass specifies that it uses a particular analysis result to this function, it can then use the getAnalysis<AnalysisType>() function, below.

Reimplemented from llvm::Pass.

Definition at line 310 of file LiveVariables.h.

References llvm::AnalysisUsage::setPreservesAll().

std::vector<unsigned>& llvm::LiveVariables::getDeadDefsVector ( MachineInstr MI  )  [inline]

Definition at line 155 of file LiveVariables.h.

References I, and MI.

Referenced by dead_begin(), dead_end(), dead_range(), and removeVirtualRegisterDead().

std::vector<unsigned>& llvm::LiveVariables::getKillsVector ( MachineInstr MI  )  [inline]

Definition at line 150 of file LiveVariables.h.

References I, and MI.

Referenced by killed_begin(), killed_end(), killed_range(), and removeVirtualRegisterKilled().

LiveVariables::VarInfo & LiveVariables::getVarInfo ( unsigned  RegIdx  ) 

getVarInfo - Return the VarInfo structure for the specified VIRTUAL register.

Definition at line 62 of file LiveVariables.cpp.

References llvm::MRegisterInfo::FirstVirtualRegister, and llvm::MRegisterInfo::isVirtualRegister().

Referenced by addVirtualRegisterDead(), addVirtualRegisterKilled(), instructionChanged(), removeVirtualRegisterDead(), removeVirtualRegisterKilled(), removeVirtualRegistersDead(), removeVirtualRegistersKilled(), and runOnMachineFunction().

void LiveVariables::HandleVirtRegUse ( VarInfo VRInfo,
MachineBasicBlock MBB,
MachineInstr MI 
)

Definition at line 124 of file LiveVariables.cpp.

References llvm::LiveVariables::VarInfo::DefInst, E, llvm::MachineInstr::getParent(), llvm::LiveVariables::VarInfo::Kills, MarkVirtRegAliveInBlock(), MBB, MI, PI, llvm::MachineBasicBlock::pred_begin(), and llvm::MachineBasicBlock::pred_end().

Referenced by runOnMachineFunction().

void LiveVariables::instructionChanged ( MachineInstr OldMI,
MachineInstr NewMI 
)

instructionChanged - When the address of an instruction changes, this method should be called so that live variables can update its internal data structures. This removes the records for OldMI, transfering them to the records for NewMI.

Definition at line 370 of file LiveVariables.cpp.

References dead_range(), llvm::LiveVariables::VarInfo::DefInst, E, llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), getVarInfo(), I, llvm::MRegisterInfo::isVirtualRegister(), killed_range(), llvm::LiveVariables::VarInfo::Kills, llvm::LiveVariables::VarInfo::removeKill(), llvm::tie(), and V.

killed_iterator llvm::LiveVariables::killed_begin ( MachineInstr MI  )  [inline]

killed_begin/end - Get access to the range of registers killed by a machine instruction.

Definition at line 164 of file LiveVariables.h.

References getKillsVector(), and MI.

killed_iterator llvm::LiveVariables::killed_end ( MachineInstr MI  )  [inline]

Definition at line 167 of file LiveVariables.h.

References getKillsVector(), and MI.

std::pair<killed_iterator, killed_iterator> llvm::LiveVariables::killed_range ( MachineInstr MI  )  [inline]

Definition at line 171 of file LiveVariables.h.

References getKillsVector(), MI, and V.

Referenced by instructionChanged().

bool LiveVariables::KillsRegister ( MachineInstr MI,
unsigned  Reg 
) const

KillsRegister - Return true if the specified instruction kills the specified register.

Definition at line 75 of file LiveVariables.cpp.

References I, and MI.

void LiveVariables::MarkVirtRegAliveInBlock ( VarInfo VRInfo,
MachineBasicBlock BB 
)

Definition at line 96 of file LiveVariables.cpp.

References llvm::LiveVariables::VarInfo::AliveBlocks, llvm::LiveVariables::VarInfo::DefInst, E, llvm::MachineBasicBlock::getNumber(), llvm::MachineInstr::getParent(), llvm::LiveVariables::VarInfo::Kills, MBB, PI, llvm::MachineBasicBlock::pred_begin(), and llvm::MachineBasicBlock::pred_end().

Referenced by HandleVirtRegUse(), and runOnMachineFunction().

bool LiveVariables::RegisterDefIsDead ( MachineInstr MI,
unsigned  Reg 
) const

RegisterDefIsDead - Return true if the specified instruction defines the specified register, but that definition is dead.

Definition at line 85 of file LiveVariables.cpp.

References I, and MI.

virtual void llvm::LiveVariables::releaseMemory (  )  [inline, virtual]

releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memory when it is no longer needed. The default behavior of passes is to hold onto memory for the entire duration of their lifetime (which is the entire compile time). For pipelined passes, this is not a big deal because that memory gets recycled every time the pass is invoked on another program unit. For IP passes, it is more important to free memory when it is unused.

Optionally implement this function to release pass memory when it is no longer used.

Reimplemented from llvm::Pass.

Definition at line 314 of file LiveVariables.h.

bool llvm::LiveVariables::removeVirtualRegisterDead ( unsigned  reg,
MachineBasicBlock MBB,
MachineInstr MI 
) [inline]

removeVirtualRegisterDead - Remove the specified virtual register from the live variable information. Returns true if the variable was marked dead at the specified instruction, false otherwise.

Definition at line 280 of file LiveVariables.h.

References getDeadDefsVector(), getVarInfo(), MI, and V.

bool llvm::LiveVariables::removeVirtualRegisterKilled ( unsigned  reg,
MachineBasicBlock MBB,
MachineInstr MI 
) [inline]

removeVirtualRegisterKilled - Remove the specified virtual register from the live variable information. Returns true if the variable was marked as killed by the specified instruction, false otherwise.

Definition at line 228 of file LiveVariables.h.

References getKillsVector(), getVarInfo(), MI, and V.

void llvm::LiveVariables::removeVirtualRegistersDead ( MachineInstr MI  )  [inline]

removeVirtualRegistersDead - Remove all of the specified dead registers from the live variable information.

Definition at line 297 of file LiveVariables.h.

References getVarInfo(), I, MI, Regs, and llvm::LiveVariables::VarInfo::removeKill().

void llvm::LiveVariables::removeVirtualRegistersKilled ( MachineInstr MI  )  [inline]

removeVirtualRegistersKilled - Remove all killed info for the specified instruction.

Definition at line 245 of file LiveVariables.h.

References getVarInfo(), I, MI, Regs, and llvm::LiveVariables::VarInfo::removeKill().

bool LiveVariables::runOnMachineFunction ( MachineFunction MF  )  [virtual]

runOnMachineFunction - This method must be overloaded to perform the desired machine code transformation or analysis.

Implements llvm::MachineFunctionPass.

Definition at line 188 of file LiveVariables.cpp.

References llvm::MachineBasicBlock::back(), llvm::MachineInstr::begin(), llvm::MachineBasicBlock::begin(), llvm::MachineFunction::begin(), llvm::LiveVariables::VarInfo::DefInst, llvm::df_ext_begin(), llvm::df_ext_end(), E, llvm::MachineBasicBlock::empty(), llvm::MachineFunction::end(), llvm::MachineBasicBlock::end(), llvm::MRegisterInfo::FirstVirtualRegister, llvm::TargetInstrInfo::get(), llvm::MRegisterInfo::getAllocatableSet(), llvm::TargetMachine::getInstrInfo(), llvm::MachineOperand::getMachineBasicBlock(), llvm::MachineBasicBlock::getNumber(), llvm::MachineInstr::getNumOperands(), llvm::MRegisterInfo::getNumRegs(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::TargetMachine::getRegisterInfo(), llvm::MachineFunction::getTarget(), getVarInfo(), HandleVirtRegUse(), I, llvm::TargetInstrDescriptor::ImplicitDefs, llvm::TargetInstrDescriptor::ImplicitUses, llvm::MRegisterInfo::isPhysicalRegister(), llvm::TargetInstrInfo::isReturn(), llvm::MRegisterInfo::isVirtualRegister(), llvm::LiveVariables::VarInfo::Kills, llvm::MachineFunction::livein_begin(), llvm::MachineFunction::livein_end(), llvm::MachineFunction::liveout_begin(), llvm::MachineFunction::liveout_end(), MarkVirtRegAliveInBlock(), MBB, MF, MI, llvm::TargetInstrInfo::PHI, llvm::MachineBasicBlock::succ_begin(), llvm::MachineBasicBlock::succ_end(), TII, and Visited.


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