struct LiveVariables::VarInfo

Declaration

struct LiveVariables::VarInfo { /* full declaration omitted */ };

Description

VarInfo - This represents the regions where a virtual register is live in the program. We represent this with three different pieces of information: the set of blocks in which the instruction is live throughout, the set of blocks in which the instruction is actually used, and the set of non-phi instructions that are the last users of the value. In the common case where a value is defined and killed in the same block, There is one killing instruction, and AliveBlocks is empty. Otherwise, the value is live out of the block. If the value is live throughout any blocks, these blocks are listed in AliveBlocks. Blocks where the liveness range ends are not included in AliveBlocks, instead being captured by the Kills set. In these blocks, the value is live into the block (unless the value is defined and killed in the same block) and lives until the specified instruction. Note that there cannot ever be a value whose Kills set contains two instructions from the same basic block. PHI nodes complicate things a bit. If a PHI node is the last user of a value in one of its predecessor blocks, it is not listed in the kills set, but does include the predecessor block in the AliveBlocks set (unless that block also defines the value). This leads to the (perfectly sensical) situation where a value is defined in a block, and the last use is a phi node in the successor. In this case, AliveBlocks is empty (the value is not live across any blocks) and Kills is empty (phi nodes are not included). This is sensical because the value must be live to the end of the block, but is not live in any successor blocks.

Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:79

Member Variables

public SparseBitVector<> AliveBlocks
AliveBlocks - Set of blocks in which this value is alive completely through. This is a bit set which uses the basic block number as an index.
public std::vector<MachineInstr*> Kills
Kills - List of MachineInstruction's which are the last use of this virtual register (kill it) in their basic block.

Method Overview

  • public void dump() const
  • public llvm::MachineInstr * findKill(const llvm::MachineBasicBlock * MBB) const
  • public bool isLiveIn(const llvm::MachineBasicBlock & MBB, unsigned int Reg, llvm::MachineRegisterInfo & MRI)
  • public bool removeKill(llvm::MachineInstr & MI)

Methods

void dump() const

Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:112

llvm::MachineInstr* findKill(
    const llvm::MachineBasicBlock* MBB) const

Description

findKill - Find a kill instruction in MBB. Return NULL if none is found.

Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:103

Parameters

const llvm::MachineBasicBlock* MBB

bool isLiveIn(const llvm::MachineBasicBlock& MBB,
              unsigned int Reg,
              llvm::MachineRegisterInfo& MRI)

Description

isLiveIn - Is Reg live in to MBB? This means that Reg is live through MBB, or it is killed in MBB. If Reg is only used by PHI instructions in MBB, it is not considered live in.

Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:108

Parameters

const llvm::MachineBasicBlock& MBB
unsigned int Reg
llvm::MachineRegisterInfo& MRI

bool removeKill(llvm::MachineInstr& MI)

Description

removeKill - Delete a kill corresponding to the specified machine instruction. Returns true if there was a kill corresponding to this instruction, false otherwise.

Declared at: llvm/include/llvm/CodeGen/LiveVariables.h:94

Parameters

llvm::MachineInstr& MI