class LivePhysRegs

Declaration

class LivePhysRegs { /* full declaration omitted */ };

Description

A set of physical registers with utility functions to track liveness when walking backward/forward through a basic block.

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:50

Member Variables

private const llvm::TargetRegisterInfo* TRI = nullptr
private llvm::LivePhysRegs::RegisterSet LiveRegs

Method Overview

  • public LivePhysRegs(const llvm::TargetRegisterInfo & TRI)
  • public LivePhysRegs(const llvm::LivePhysRegs &)
  • public LivePhysRegs()
  • private void addBlockLiveIns(const llvm::MachineBasicBlock & MBB)
  • public void addLiveIns(const llvm::MachineBasicBlock & MBB)
  • public void addLiveInsNoPristines(const llvm::MachineBasicBlock & MBB)
  • public void addLiveOuts(const llvm::MachineBasicBlock & MBB)
  • public void addLiveOutsNoPristines(const llvm::MachineBasicBlock & MBB)
  • private void addPristines(const llvm::MachineFunction & MF)
  • public void addReg(llvm::MCPhysReg Reg)
  • public void addUses(const llvm::MachineInstr & MI)
  • public bool available(const llvm::MachineRegisterInfo & MRI, llvm::MCPhysReg Reg) const
  • public llvm::LivePhysRegs::const_iterator begin() const
  • public void clear()
  • public bool contains(llvm::MCPhysReg Reg) const
  • public void dump() const
  • public bool empty() const
  • public llvm::LivePhysRegs::const_iterator end() const
  • public void init(const llvm::TargetRegisterInfo & TRI)
  • public void print(llvm::raw_ostream & OS) const
  • public void removeDefs(const llvm::MachineInstr & MI)
  • public void removeReg(llvm::MCPhysReg Reg)
  • public void removeRegsInMask(const llvm::MachineOperand & MO, SmallVectorImpl<std::pair<MCPhysReg, const MachineOperand *>> * Clobbers = nullptr)
  • public void stepBackward(const llvm::MachineInstr & MI)
  • public void stepForward(const llvm::MachineInstr & MI, SmallVectorImpl<std::pair<MCPhysReg, const MachineOperand *>> & Clobbers)

Methods

LivePhysRegs(const llvm::TargetRegisterInfo& TRI)

Description

Constructs and initializes an empty set.

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:60

Parameters

const llvm::TargetRegisterInfo& TRI

LivePhysRegs(const llvm::LivePhysRegs&)

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:64

Parameters

const llvm::LivePhysRegs&

LivePhysRegs()

Description

Constructs an unitialized set. init() needs to be called to initialize it.

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:57

void addBlockLiveIns(
    const llvm::MachineBasicBlock& MBB)

Description

Adds live-in registers from basic block \p MBB, taking associated lane masks into consideration.

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:169

Parameters

const llvm::MachineBasicBlock& MBB

void addLiveIns(
    const llvm::MachineBasicBlock& MBB)

Description

Adds all live-in registers of basic block \p MBB. Live in registers are the registers in the blocks live-in list and the pristine registers.

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:136

Parameters

const llvm::MachineBasicBlock& MBB

void addLiveInsNoPristines(
    const llvm::MachineBasicBlock& MBB)

Description

Adds all live-in registers of basic block \p MBB but skips pristine registers.

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:140

Parameters

const llvm::MachineBasicBlock& MBB

void addLiveOuts(
    const llvm::MachineBasicBlock& MBB)

Description

Adds all live-out registers of basic block \p MBB. Live out registers are the union of the live-in registers of the successor blocks and pristine registers. Live out registers of the end block are the callee saved registers. If a register is not added by this method, it is guaranteed to not be live out from MBB, although a sub-register may be. This is true both before and after regalloc.

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:149

Parameters

const llvm::MachineBasicBlock& MBB

void addLiveOutsNoPristines(
    const llvm::MachineBasicBlock& MBB)

Description

Adds all live-out registers of basic block \p MBB but skips pristine registers.

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:153

Parameters

const llvm::MachineBasicBlock& MBB

void addPristines(const llvm::MachineFunction& MF)

Description

Adds pristine registers. Pristine registers are callee saved registers that are unused in the function.

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:173

Parameters

const llvm::MachineFunction& MF

void addReg(llvm::MCPhysReg Reg)

Description

Adds a physical register and all its sub-registers to the set.

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:81

Parameters

llvm::MCPhysReg Reg

void addUses(const llvm::MachineInstr& MI)

Description

Add uses to the set.

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:117

Parameters

const llvm::MachineInstr& MI

bool available(
    const llvm::MachineRegisterInfo& MRI,
    llvm::MCPhysReg Reg) const

Description

Returns true if register \p Reg and no aliasing register is in the set.

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:111

Parameters

const llvm::MachineRegisterInfo& MRI
llvm::MCPhysReg Reg

llvm::LivePhysRegs::const_iterator begin() const

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:157

void clear()

Description

Clears the set.

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:75

bool contains(llvm::MCPhysReg Reg) const

Description

Returns true if register \p Reg is contained in the set. This also works if only the super register of \p Reg has been defined, because addReg() always adds all sub-registers to the set as well. Note: Returns false if just some sub registers are live, use available() when searching a free register.

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

Parameters

llvm::MCPhysReg Reg

void dump() const

Description

Dumps the currently live registers to the debug output.

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:164

bool empty() const

Description

Returns true if the set is empty.

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:78

llvm::LivePhysRegs::const_iterator end() const

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:158

void init(const llvm::TargetRegisterInfo& TRI)

Description

(re-)initializes and clears the set.

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:68

Parameters

const llvm::TargetRegisterInfo& TRI

void print(llvm::raw_ostream& OS) const

Description

Prints the currently live registers to \p OS.

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:161

Parameters

llvm::raw_ostream& OS

void removeDefs(const llvm::MachineInstr& MI)

Description

Remove defined registers and regmask kills from the set.

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:114

Parameters

const llvm::MachineInstr& MI

void removeReg(llvm::MCPhysReg Reg)

Description

Removes a physical register, all its sub-registers, and all its super-registers from the set.

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:91

Parameters

llvm::MCPhysReg Reg

void removeRegsInMask(
    const llvm::MachineOperand& MO,
    SmallVectorImpl<
        std::pair<MCPhysReg,
                  const MachineOperand*>>*
        Clobbers = nullptr)

Description

Removes physical registers clobbered by the regmask operand \p MO.

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:99

Parameters

const llvm::MachineOperand& MO
SmallVectorImpl< std::pair<MCPhysReg, const MachineOperand*>>* Clobbers = nullptr

void stepBackward(const llvm::MachineInstr& MI)

Description

Simulates liveness when stepping backwards over an instruction(bundle). Remove Defs, add uses. This is the recommended way of calculating liveness.

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:122

Parameters

const llvm::MachineInstr& MI

void stepForward(
    const llvm::MachineInstr& MI,
    SmallVectorImpl<
        std::pair<MCPhysReg,
                  const MachineOperand*>>&
        Clobbers)

Description

Simulates liveness when stepping forward over an instruction(bundle). Remove killed-uses, add defs. This is the not recommended way, because it depends on accurate kill flags. If possible use stepBackward() instead of this function. The clobbers set will be the list of registers either defined or clobbered by a regmask. The operand will identify whether this is a regmask or register operand.

Declared at: llvm/include/llvm/CodeGen/LivePhysRegs.h:130

Parameters

const llvm::MachineInstr& MI
SmallVectorImpl< std::pair<MCPhysReg, const MachineOperand*>>& Clobbers