Go to the documentation of this file.
28 #ifndef LLVM_CODEGEN_LIVEVARIABLES_H
29 #define LLVM_CODEGEN_LIVEVARIABLES_H
44 class MachineBasicBlock;
45 class MachineRegisterInfo;
90 std::vector<MachineInstr*>
Kills;
96 std::vector<MachineInstr *>::iterator
I =
find(
Kills, &
MI);
136 std::vector<MachineInstr *> PhysRegDef;
141 std::vector<MachineInstr *> PhysRegUse;
143 std::vector<SmallVector<unsigned, 4>> PHIVarInfo;
208 bool AddIfNotFound =
false) {
209 if (
MI.addRegisterKilled(IncomingReg,
TRI, AddIfNotFound))
221 bool Removed =
false;
222 for (
unsigned i = 0,
e =
MI.getNumOperands();
i !=
e; ++
i) {
231 assert(Removed &&
"Register is not used by this instruction!");
244 bool AddIfNotFound =
false) {
245 if (
MI.addRegisterDead(IncomingReg,
TRI, AddIfNotFound))
257 bool Removed =
false;
258 for (
unsigned i = 0,
e =
MI.getNumOperands();
i !=
e; ++
i) {
266 assert(Removed &&
"Register is not defined by this instruction!");
bool isLiveIn(const MachineBasicBlock &MBB, Register Reg, MachineRegisterInfo &MRI)
isLiveIn - Is Reg live in to MBB? This means that Reg is live through MBB, or it is killed in MBB.
void addVirtualRegisterKilled(Register IncomingReg, MachineInstr &MI, bool AddIfNotFound=false)
addVirtualRegisterKilled - Add information about the fact that the specified register is killed after...
void addVirtualRegisterDead(Register IncomingReg, MachineInstr &MI, bool AddIfNotFound=false)
addVirtualRegisterDead - Add information about the fact that the specified register is dead after bei...
This is an optimization pass for GlobalISel generic memory operations.
bool runOnMachineFunction(MachineFunction &MF) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
bool isLiveIn(Register Reg, const MachineBasicBlock &MBB)
void MarkVirtRegAliveInBlock(VarInfo &VRInfo, MachineBasicBlock *DefBlock, MachineBasicBlock *BB)
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
void setIsKill(bool Val=true)
std::vector< MachineInstr * > Kills
Kills - List of MachineInstruction's which are the last use of this virtual register (kill it) in the...
Reg
All possible values of the reg field in the ModR/M byte.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
unsigned const TargetRegisterInfo * TRI
MachineInstr * findKill(const MachineBasicBlock *MBB) const
findKill - Find a kill instruction in MBB. Return NULL if none is found.
bool removeKill(MachineInstr &MI)
removeKill - Delete a kill corresponding to the specified machine instruction.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
VarInfo - This represents the regions where a virtual register is live in the program.
bool removeVirtualRegisterKilled(Register Reg, MachineInstr &MI)
removeVirtualRegisterKilled - Remove the specified kill of the virtual register from the live variabl...
void recomputeForSingleDefVirtReg(Register Reg)
Recompute liveness from scratch for a virtual register Reg that is known to have a single def that do...
Represent the analysis usage information of a pass.
void initializeLiveVariablesPass(PassRegistry &)
void replaceKillInstruction(Register Reg, MachineInstr &OldMI, MachineInstr &NewMI)
replaceKillInstruction - Update register kill info by replacing a kill instruction with a new one.
MachineOperand class - Representation of each machine instruction operand.
void HandleVirtRegDef(Register reg, MachineInstr &MI)
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
void addNewBlock(MachineBasicBlock *BB, MachineBasicBlock *DomBB, MachineBasicBlock *SuccBB)
addNewBlock - Add a new basic block BB between DomBB and SuccBB.
void setIsDead(bool Val=true)
bool isReg() const
isReg - Tests if this is a MO_Register operand.
Representation of each machine instruction.
auto find(R &&Range, const T &Val)
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
bool test(unsigned Idx) const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Register getReg() const
getReg - Returns the register number.
bool isLiveOut(Register Reg, const MachineBasicBlock &MBB)
isLiveOut - Determine if Reg is live out from MBB, when not considering PHI nodes.
unsigned const MachineRegisterInfo * MRI
Wrapper class representing virtual and physical registers.
void setPHIJoin(Register Reg)
setPHIJoin - Mark Reg as a phi join register.
bool isPHIJoin(Register Reg)
isPHIJoin - Return true if Reg is a phi join register.
void removeVirtualRegistersKilled(MachineInstr &MI)
removeVirtualRegistersKilled - Remove all killed info for the specified instruction.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
void HandleVirtRegUse(Register reg, MachineBasicBlock *MBB, MachineInstr &MI)
VarInfo & getVarInfo(Register Reg)
getVarInfo - Return the VarInfo structure for the specified VIRTUAL register.
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
bool removeVirtualRegisterDead(Register Reg, MachineInstr &MI)
removeVirtualRegisterDead - Remove the specified kill of the virtual register from the live variable ...
VirtRegInfo - Information about a virtual register used by a set of operands.
bool RegisterDefIsDead(MachineInstr &MI, Register Reg) const
RegisterDefIsDead - Return true if the specified instruction defines the specified register,...
SparseBitVector AliveBlocks
AliveBlocks - Set of blocks in which this value is alive completely through.