LLVM 19.0.0git
Classes | Namespaces | Functions
LivePhysRegs.h File Reference

This file implements the LivePhysRegs utility for tracking liveness of physical registers. More...

#include "llvm/ADT/SparseSet.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/MC/MCRegister.h"
#include "llvm/MC/MCRegisterInfo.h"
#include <cassert>
#include <utility>

Go to the source code of this file.

Classes

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

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
 

Functions

raw_ostream & llvm::operator<< (raw_ostream &OS, const LivePhysRegs &LR)
 
void llvm::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 llvm::recomputeLivenessFlags (MachineBasicBlock &MBB)
 Recomputes dead and kill flags in MBB.
 
void llvm::addLiveIns (MachineBasicBlock &MBB, const LivePhysRegs &LiveRegs)
 Adds registers contained in LiveRegs to the block live-in list of MBB.
 
void llvm::computeAndAddLiveIns (LivePhysRegs &LiveRegs, MachineBasicBlock &MBB)
 Convenience function combining computeLiveIns() and addLiveIns().
 
static bool llvm::recomputeLiveIns (MachineBasicBlock &MBB)
 Convenience function for recomputing live-in's for a MBB.
 

Detailed Description

This file implements the LivePhysRegs utility for tracking liveness of physical registers.

This can be used for ad-hoc liveness tracking after register allocation. You can start with the live-ins/live-outs at the beginning/end of a block and update the information while walking the instructions inside the block. This implementation tracks the liveness on a sub-register granularity.

We assume that the high bits of a physical super-register are not preserved unless the instruction has an implicit-use operand reading the super- register.

X86 Example: ymm0 = ... xmm0 = ... (Kills xmm0, all xmm0s sub-registers, and ymm0)

ymm0 = ... xmm0 = ..., implicit ymm0 (ymm0 and all its sub-registers are alive)

Definition in file LivePhysRegs.h.