LLVM 19.0.0git
Public Member Functions | List of all members
llvm::LiveRangeUpdater Class Reference

Helper class for performant LiveRange bulk updates. More...

#include "llvm/CodeGen/LiveInterval.h"

Public Member Functions

 LiveRangeUpdater (LiveRange *lr=nullptr)
 Create a LiveRangeUpdater for adding segments to LR.
 
 ~LiveRangeUpdater ()
 
void add (LiveRange::Segment)
 Add a segment to LR and coalesce when possible, just like LR.addSegment().
 
void add (SlotIndex Start, SlotIndex End, VNInfo *VNI)
 
bool isDirty () const
 Return true if the LR is currently in an invalid state, and flush() needs to be called.
 
void flush ()
 Flush the updater state to LR so it is valid and contains all added segments.
 
void setDest (LiveRange *lr)
 Select a different destination live range.
 
LiveRangegetDest () const
 Get the current destination live range.
 
void dump () const
 
void print (raw_ostream &) const
 

Detailed Description

Helper class for performant LiveRange bulk updates.

Calling LiveRange::addSegment() repeatedly can be expensive on large live ranges because segments after the insertion point may need to be shifted. The LiveRangeUpdater class can defer the shifting when adding many segments in order.

The LiveRange will be in an invalid state until flush() is called.

Definition at line 941 of file LiveInterval.h.

Constructor & Destructor Documentation

◆ LiveRangeUpdater()

llvm::LiveRangeUpdater::LiveRangeUpdater ( LiveRange lr = nullptr)
inline

Create a LiveRangeUpdater for adding segments to LR.

LR will temporarily be in an invalid state until flush() is called.

Definition at line 952 of file LiveInterval.h.

◆ ~LiveRangeUpdater()

llvm::LiveRangeUpdater::~LiveRangeUpdater ( )
inline

Definition at line 954 of file LiveInterval.h.

References flush().

Member Function Documentation

◆ add() [1/2]

void LiveRangeUpdater::add ( LiveRange::Segment  Seg)

◆ add() [2/2]

void llvm::LiveRangeUpdater::add ( SlotIndex  Start,
SlotIndex  End,
VNInfo VNI 
)
inline

Definition at line 961 of file LiveInterval.h.

References add(), and End.

◆ dump()

LLVM_DUMP_METHOD void LiveRangeUpdater::dump ( ) const

Definition at line 1151 of file LiveInterval.cpp.

References llvm::errs(), and llvm::LiveRange::print().

◆ flush()

void LiveRangeUpdater::flush ( )

Flush the updater state to LR so it is valid and contains all added segments.

Definition at line 1275 of file LiveInterval.cpp.

References assert(), llvm::LiveRange::begin(), llvm::SmallVectorImpl< T >::erase(), llvm::SmallVectorImpl< T >::insert(), llvm::LiveRange::segments, and llvm::LiveRange::verify().

Referenced by setDest(), and ~LiveRangeUpdater().

◆ getDest()

LiveRange * llvm::LiveRangeUpdater::getDest ( ) const
inline

Get the current destination live range.

Definition at line 981 of file LiveInterval.h.

◆ isDirty()

bool llvm::LiveRangeUpdater::isDirty ( ) const
inline

Return true if the LR is currently in an invalid state, and flush() needs to be called.

Definition at line 967 of file LiveInterval.h.

References llvm::SlotIndex::isValid().

Referenced by setDest().

◆ print()

void LiveRangeUpdater::print ( raw_ostream OS) const

◆ setDest()

void llvm::LiveRangeUpdater::setDest ( LiveRange lr)
inline

Select a different destination live range.

Definition at line 974 of file LiveInterval.h.

References flush(), and isDirty().


The documentation for this class was generated from the following files: