LLVM API Documentation

llvm::LiveVariables Class Reference

#include <LiveVariables.h>

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

List of all members.

Public Member Functions

 LiveVariables ()
virtual bool runOnMachineFunction (MachineFunction &MF)
bool RegisterDefIsDead (MachineInstr *MI, unsigned Reg) const
void replaceKillInstruction (unsigned Reg, MachineInstr *OldMI, MachineInstr *NewMI)
void addVirtualRegisterKilled (unsigned IncomingReg, MachineInstr *MI, bool AddIfNotFound=false)
bool removeVirtualRegisterKilled (unsigned reg, MachineInstr *MI)
void removeVirtualRegistersKilled (MachineInstr *MI)
void addVirtualRegisterDead (unsigned IncomingReg, MachineInstr *MI, bool AddIfNotFound=false)
bool removeVirtualRegisterDead (unsigned reg, MachineInstr *MI)
void getAnalysisUsage (AnalysisUsage &AU) const
virtual void releaseMemory ()
VarInfo & getVarInfo (unsigned RegIdx)
 getVarInfo - Get (possibly creating) a VarInfo object for the given vreg.
void MarkVirtRegAliveInBlock (VarInfo &VRInfo, MachineBasicBlock *DefBlock, MachineBasicBlock *BB)
void MarkVirtRegAliveInBlock (VarInfo &VRInfo, MachineBasicBlock *DefBlock, MachineBasicBlock *BB, std::vector< MachineBasicBlock * > &WorkList)
void HandleVirtRegDef (unsigned reg, MachineInstr *MI)
void HandleVirtRegUse (unsigned reg, MachineBasicBlock *MBB, MachineInstr *MI)

Static Public Attributes

static char ID = 0

Classes

struct  VarInfo


Detailed Description

Definition at line 42 of file LiveVariables.h.


Constructor & Destructor Documentation

llvm::LiveVariables::LiveVariables (  )  [inline]

Definition at line 45 of file LiveVariables.h.


Member Function Documentation

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 504 of file LiveVariables.cpp.

References llvm::MachineInstr::addOperand(), llvm::MachineBasicBlock::back(), llvm::SmallVectorImpl< T >::begin(), llvm::MachineBasicBlock::begin(), llvm::MachineFunction::begin(), llvm::SmallPtrSet< PtrType, SmallSize >::count(), llvm::MachineOperand::CreateReg(), llvm::df_ext_begin(), llvm::df_ext_end(), E, llvm::MachineBasicBlock::empty(), llvm::SmallVectorImpl< T >::empty(), llvm::MachineFunction::end(), llvm::SmallVectorImpl< T >::end(), llvm::MachineBasicBlock::end(), Entry, llvm::TargetRegisterInfo::FirstVirtualRegister, llvm::MachineInstr::getDesc(), llvm::MachineBasicBlock::getNumber(), llvm::MachineFunction::getNumBlockIDs(), llvm::MachineInstr::getNumOperands(), llvm::TargetRegisterInfo::getNumRegs(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::TargetMachine::getRegisterInfo(), llvm::TargetRegisterInfo::getReservedRegs(), llvm::MachineFunction::getTarget(), getVarInfo(), llvm::MachineRegisterInfo::getVRegDef(), HandleVirtRegDef(), HandleVirtRegUse(), II, llvm::MachineOperand::isDef(), llvm::TargetRegisterInfo::isPhysicalRegister(), llvm::MachineOperand::isReg(), llvm::TargetInstrDesc::isReturn(), llvm::MachineOperand::isUse(), llvm::TargetRegisterInfo::isVirtualRegister(), llvm::MachineBasicBlock::livein_begin(), llvm::MachineBasicBlock::livein_end(), llvm::MachineRegisterInfo::liveout_begin(), llvm::MachineRegisterInfo::liveout_end(), MarkVirtRegAliveInBlock(), llvm::TargetInstrInfo::PHI, llvm::SmallVectorImpl< T >::push_back(), llvm::MachineInstr::readsRegister(), llvm::MipsISD::Ret, llvm::SmallVectorImpl< T >::size(), and Visited.

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

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

void LiveVariables::replaceKillInstruction ( unsigned  Reg,
MachineInstr *  OldMI,
MachineInstr *  NewMI 
)

replaceKillInstruction - Update register kill info by replacing a kill instruction with a new one.

replaceKillInstruction - Update register kill info by replacing a kill instruction with a new one.

Definition at line 666 of file LiveVariables.cpp.

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

Referenced by llvm::X86InstrInfo::convertToThreeAddress().

void llvm::LiveVariables::addVirtualRegisterKilled ( unsigned  IncomingReg,
MachineInstr *  MI,
bool  AddIfNotFound = false 
) [inline]

addVirtualRegisterKilled - Add information about the fact that the specified register is killed after being used by the specified instruction. If AddIfNotFound is true, add a implicit operand if it's not found.

Definition at line 188 of file LiveVariables.h.

References llvm::MachineInstr::addRegisterKilled(), getVarInfo(), and llvm::LiveVariables::VarInfo::Kills.

Referenced by llvm::ARMInstrInfo::convertToThreeAddress().

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

removeVirtualRegisterKilled - Remove the specified kill of the 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 198 of file LiveVariables.h.

References llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), getVarInfo(), llvm::MachineOperand::isKill(), llvm::MachineOperand::isReg(), and llvm::MachineOperand::setIsKill().

void LiveVariables::removeVirtualRegistersKilled ( MachineInstr *  MI  ) 

removeVirtualRegistersKilled - Remove all killed info for the specified instruction.

removeVirtualRegistersKilled - Remove all killed info for the specified instruction.

Definition at line 674 of file LiveVariables.cpp.

References llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), getVarInfo(), llvm::MachineOperand::isKill(), llvm::MachineOperand::isReg(), llvm::TargetRegisterInfo::isVirtualRegister(), llvm::LiveVariables::VarInfo::removeKill(), and llvm::MachineOperand::setIsKill().

void llvm::LiveVariables::addVirtualRegisterDead ( unsigned  IncomingReg,
MachineInstr *  MI,
bool  AddIfNotFound = false 
) [inline]

addVirtualRegisterDead - Add information about the fact that the specified register is dead after being used by the specified instruction. If AddIfNotFound is true, add a implicit operand if it's not found.

Definition at line 223 of file LiveVariables.h.

References llvm::MachineInstr::addRegisterDead(), getVarInfo(), and llvm::LiveVariables::VarInfo::Kills.

Referenced by llvm::ARMInstrInfo::convertToThreeAddress().

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

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

Definition at line 233 of file LiveVariables.h.

References llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), getVarInfo(), llvm::MachineOperand::isDef(), llvm::MachineOperand::isReg(), and llvm::MachineOperand::setIsDead().

void LiveVariables::getAnalysisUsage ( AnalysisUsage &   )  const [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 48 of file LiveVariables.cpp.

References llvm::AnalysisUsage::addRequiredID(), llvm::AnalysisUsage::setPreservesAll(), and llvm::UnreachableMachineBlockElimID.

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 252 of file LiveVariables.h.

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

void LiveVariables::MarkVirtRegAliveInBlock ( VarInfo &  VRInfo,
MachineBasicBlock *  DefBlock,
MachineBasicBlock *  BB 
)

Definition at line 114 of file LiveVariables.cpp.

References llvm::BasicBlock::back(), Pred, and WorkList.

Referenced by HandleVirtRegUse(), and runOnMachineFunction().

void LiveVariables::MarkVirtRegAliveInBlock ( VarInfo &  VRInfo,
MachineBasicBlock *  DefBlock,
MachineBasicBlock *  BB,
std::vector< MachineBasicBlock * > &  WorkList 
)

void LiveVariables::HandleVirtRegDef ( unsigned  reg,
MachineInstr *  MI 
)

void LiveVariables::HandleVirtRegUse ( unsigned  reg,
MachineBasicBlock *  MBB,
MachineInstr *  MI 
)


Member Data Documentation

char LiveVariables::ID = 0 [static]

Definition at line 44 of file LiveVariables.h.


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