29#ifndef LLVM_CODEGEN_LIVEPHYSREGS_H
30#define LLVM_CODEGEN_LIVEPHYSREGS_H
63 LiveRegs.setUniverse(TRI.getNumRegs());
73 LiveRegs.setUniverse(TRI.getNumRegs());
77 void clear() { LiveRegs.clear(); }
80 bool empty()
const {
return LiveRegs.empty(); }
84 assert(TRI &&
"LivePhysRegs is not initialized.");
87 if (TRI->isConstantPhysReg(
Reg))
90 LiveRegs.insert(SubReg);
96 assert(TRI &&
"LivePhysRegs is not initialized.");
99 LiveRegs.erase((*R).id());
105 SmallVectorImpl<std::pair<MCPhysReg, const MachineOperand *>> *Clobbers =
137 SmallVectorImpl<std::pair<MCPhysReg, const MachineOperand *>> &Clobbers);
198 const MachineBasicBlock &
MBB);
209 MachineBasicBlock &
MBB);
218 std::vector<MachineBasicBlock::RegisterMaskPair> OldLiveIns;
220 MBB.clearLiveIns(OldLiveIns);
222 MBB.sortUniqueLiveIns();
224 const std::vector<MachineBasicBlock::RegisterMaskPair> &NewLiveIns =
226 return OldLiveIns != NewLiveIns;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static void addBlockLiveOuts(LiveRegUnits &LiveUnits, const MachineBasicBlock &MBB)
Add live-out registers of basic block MBB to LiveUnits.
static void addBlockLiveIns(LiveRegUnits &LiveUnits, const MachineBasicBlock &MBB)
Add live-in registers of basic block MBB to LiveUnits.
Promote Memory to Register
This file defines the SparseSet class derived from the version described in Briggs,...
Represent a constant reference to an array (0 or more elements consecutively in memory),...
A set of physical registers with utility functions to track liveness when walking backward/forward th...
void addReg(MCRegister Reg)
Adds a physical register and all its sub-registers to the set.
RegisterSet::const_iterator const_iterator
const_iterator end() const
void clear()
Clears the set.
LLVM_ABI void stepForward(const MachineInstr &MI, SmallVectorImpl< std::pair< MCPhysReg, const MachineOperand * > > &Clobbers)
Simulates liveness when stepping forward over an instruction(bundle).
LivePhysRegs(const LivePhysRegs &)=delete
LLVM_ABI void print(raw_ostream &OS) const
Prints the currently live registers to OS.
LLVM_ABI void stepBackward(const MachineInstr &MI)
Simulates liveness when stepping backwards over an instruction(bundle).
void init(const TargetRegisterInfo &TRI)
(re-)initializes and clears the set.
LLVM_ABI void addLiveIns(const MachineBasicBlock &MBB)
Adds all live-in registers of basic block MBB.
LLVM_ABI bool available(const MachineRegisterInfo &MRI, MCRegister Reg) const
Returns true if register Reg and no aliasing register is in the set.
LLVM_ABI void addUses(const MachineInstr &MI)
Add uses to the set.
LLVM_ABI void removeDefs(const MachineInstr &MI)
Remove defined registers and regmask kills from the set.
LLVM_ABI void addLiveOutsNoPristines(const MachineBasicBlock &MBB)
Adds all live-out registers of basic block MBB but skips pristine registers.
LivePhysRegs(const TargetRegisterInfo &TRI)
Constructs and initializes an empty set.
LLVM_ABI void addLiveOuts(const MachineBasicBlock &MBB)
Adds all live-out registers of basic block MBB.
LivePhysRegs()=default
Constructs an unitialized set. init() needs to be called to initialize it.
void removeReg(MCRegister Reg)
Removes a physical register, all its sub-registers, and all its super-registers from the set.
const_iterator begin() const
LLVM_ABI void addLiveInsNoPristines(const MachineBasicBlock &MBB)
Adds all live-in registers of basic block MBB but skips pristine registers.
bool contains(MCRegister Reg) const
Returns true if register Reg is contained in the set.
LivePhysRegs & operator=(const LivePhysRegs &)=delete
LLVM_ABI void removeRegsInMask(const MachineOperand &MO, SmallVectorImpl< std::pair< MCPhysReg, const MachineOperand * > > *Clobbers=nullptr)
Removes physical registers clobbered by the regmask operand MO.
bool empty() const
Returns true if the set is empty.
LLVM_ABI void dump() const
Dumps the currently live registers to the debug output.
MCRegAliasIterator enumerates all registers aliasing Reg.
Wrapper class representing physical registers. Should be passed by value.
MachineInstrBundleIterator< MachineInstr > iterator
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
SparseSet - Fast set implementation for objects that can be identified by small unsigned keys.
typename DenseT::const_iterator const_iterator
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void recomputeLivenessFlags(MachineBasicBlock &MBB)
Recomputes dead and kill flags in MBB.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
LLVM_ABI bool isPhysRegUsedAfter(Register Reg, MachineBasicBlock::iterator MBI)
Check if physical register Reg is used after MBI.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
LLVM_ABI void computeAndAddLiveIns(LivePhysRegs &LiveRegs, MachineBasicBlock &MBB)
Convenience function combining computeLiveIns() and addLiveIns().
LLVM_ABI void computeLiveIns(LivePhysRegs &LiveRegs, const MachineBasicBlock &MBB)
Computes registers live-in to MBB assuming all of its successors live-in lists are up-to-date.
void fullyRecomputeLiveIns(ArrayRef< MachineBasicBlock * > MBBs)
Convenience function for recomputing live-in's for a set of MBBs until the computation converges.
LLVM_ABI void addLiveIns(MachineBasicBlock &MBB, const LivePhysRegs &LiveRegs)
Adds registers contained in LiveRegs to the block live-in list of MBB.
static bool recomputeLiveIns(MachineBasicBlock &MBB)
Convenience function for recomputing live-in's for a MBB.
Pair of physical register and lane mask.