LLVM 18.0.0git
Classes | Public Member Functions | Friends | List of all members
llvm::sroa::AllocaSlices Class Reference

Representation of the alloca slices. More...

Classes

class  partition_iterator
 An iterator over partitions of the alloca's slices. More...
 
class  SliceBuilder
 Builder for the alloca slices. More...
 

Public Member Functions

 AllocaSlices (const DataLayout &DL, AllocaInst &AI)
 Construct the slices of a particular alloca.
 
bool isEscaped () const
 Test whether a pointer to the allocation escapes our analysis.
 
void erase (iterator Start, iterator Stop)
 Erase a range of slices.
 
void insert (ArrayRef< Slice > NewSlices)
 Insert new slices for this alloca.
 
iterator_range< partition_iteratorpartitions ()
 A forward range over the partitions of the alloca's slices.
 
ArrayRef< Instruction * > getDeadUsers () const
 Access the dead users for this alloca.
 
ArrayRef< Use * > getDeadUsesIfPromotable () const
 Access Uses that should be dropped if the alloca is promotable.
 
ArrayRef< Use * > getDeadOperands () const
 Access the dead operands referring to this alloca.
 
void print (raw_ostream &OS, const_iterator I, StringRef Indent=" ") const
 
void printSlice (raw_ostream &OS, const_iterator I, StringRef Indent=" ") const
 
void printUse (raw_ostream &OS, const_iterator I, StringRef Indent=" ") const
 
void print (raw_ostream &OS) const
 
void dump (const_iterator I) const
 
void dump () const
 

Friends

class AllocaSlices::SliceBuilder
 
using iterator = SmallVectorImpl< Slice >::iterator
 Support for iterating over the slices.
 
using range = iterator_range< iterator >
 
using const_iterator = SmallVectorImpl< Slice >::const_iterator
 
using const_range = iterator_range< const_iterator >
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 

Detailed Description

Representation of the alloca slices.

This class represents the slices of an alloca which are formed by its various uses. If a pointer escapes, we can't fully build a representation for the slices used and we reflect that in this structure. The uses are stored, sorted by increasing beginning offset and with unsplittable slices starting at a particular offset before splittable slices.

Definition at line 442 of file SROA.cpp.

Member Typedef Documentation

◆ const_iterator

Definition at line 461 of file SROA.cpp.

◆ const_range

Definition at line 462 of file SROA.cpp.

◆ iterator

Support for iterating over the slices.

Definition at line 455 of file SROA.cpp.

◆ range

Definition at line 456 of file SROA.cpp.

Constructor & Destructor Documentation

◆ AllocaSlices()

AllocaSlices::AllocaSlices ( const DataLayout DL,
AllocaInst AI 
)

Member Function Documentation

◆ begin() [1/2]

iterator llvm::sroa::AllocaSlices::begin ( )
inline

Definition at line 458 of file SROA.cpp.

References llvm::SmallVectorTemplateCommon< T, typename >::begin().

Referenced by partitions(), print(), and printSlice().

◆ begin() [2/2]

const_iterator llvm::sroa::AllocaSlices::begin ( ) const
inline

Definition at line 464 of file SROA.cpp.

References llvm::SmallVectorTemplateCommon< T, typename >::begin().

◆ dump() [1/2]

LLVM_DUMP_METHOD void AllocaSlices::dump ( ) const

Definition at line 1344 of file SROA.cpp.

References llvm::dbgs(), and print().

◆ dump() [2/2]

LLVM_DUMP_METHOD void AllocaSlices::dump ( const_iterator  I) const

Definition at line 1341 of file SROA.cpp.

References llvm::dbgs(), I, and print().

◆ end() [1/2]

iterator llvm::sroa::AllocaSlices::end ( )
inline

Definition at line 459 of file SROA.cpp.

References llvm::SmallVectorTemplateCommon< T, typename >::end().

Referenced by partitions(), and print().

◆ end() [2/2]

const_iterator llvm::sroa::AllocaSlices::end ( ) const
inline

Definition at line 465 of file SROA.cpp.

References llvm::SmallVectorTemplateCommon< T, typename >::end().

◆ erase()

void llvm::sroa::AllocaSlices::erase ( iterator  Start,
iterator  Stop 
)
inline

Erase a range of slices.

Definition at line 469 of file SROA.cpp.

References llvm::SmallVectorImpl< T >::erase().

◆ getDeadOperands()

ArrayRef< Use * > llvm::sroa::AllocaSlices::getDeadOperands ( ) const
inline

Access the dead operands referring to this alloca.

These are operands which have cannot actually be used to refer to the alloca as they are outside its range and the user doesn't correct for that. These mostly consist of PHI node inputs and the like which we just need to replace with undef.

Definition at line 503 of file SROA.cpp.

◆ getDeadUsers()

ArrayRef< Instruction * > llvm::sroa::AllocaSlices::getDeadUsers ( ) const
inline

Access the dead users for this alloca.

Definition at line 490 of file SROA.cpp.

◆ getDeadUsesIfPromotable()

ArrayRef< Use * > llvm::sroa::AllocaSlices::getDeadUsesIfPromotable ( ) const
inline

Access Uses that should be dropped if the alloca is promotable.

Definition at line 493 of file SROA.cpp.

◆ insert()

void llvm::sroa::AllocaSlices::insert ( ArrayRef< Slice >  NewSlices)
inline

Insert new slices for this alloca.

This moves the slices into the alloca's slices collection, and re-sorts everything so that the usual ordering properties of the alloca's slices hold.

Definition at line 476 of file SROA.cpp.

References llvm::SmallVectorImpl< T >::append(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::ArrayRef< T >::begin(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::ArrayRef< T >::end(), llvm::SmallVectorBase< Size_T >::size(), and llvm::sort().

◆ isEscaped()

bool llvm::sroa::AllocaSlices::isEscaped ( ) const
inline

Test whether a pointer to the allocation escapes our analysis.

If this is true, the slices are never fully built and should be ignored.

Definition at line 451 of file SROA.cpp.

◆ partitions()

iterator_range< AllocaSlices::partition_iterator > AllocaSlices::partitions ( )

A forward range over the partitions of the alloca's slices.

This accesses an iterator range over the partitions of the alloca's slices. It computes these partitions on the fly based on the overlapping offsets of the slices and the ability to split them. It will visit "empty" partitions to cover regions of the alloca only accessed via split slices.

Definition at line 832 of file SROA.cpp.

References begin(), end(), and llvm::make_range().

◆ print() [1/2]

void AllocaSlices::print ( raw_ostream OS) const

Definition at line 1328 of file SROA.cpp.

References begin(), E, end(), I, OS, and print().

◆ print() [2/2]

void AllocaSlices::print ( raw_ostream OS,
const_iterator  I,
StringRef  Indent = "  " 
) const

Definition at line 1309 of file SROA.cpp.

References I, OS, printSlice(), and printUse().

Referenced by dump(), and print().

◆ printSlice()

void AllocaSlices::printSlice ( raw_ostream OS,
const_iterator  I,
StringRef  Indent = "  " 
) const

Definition at line 1316 of file SROA.cpp.

References begin(), I, and OS.

Referenced by print(), and llvm::sroa::AllocaSliceRewriter::visit().

◆ printUse()

void AllocaSlices::printUse ( raw_ostream OS,
const_iterator  I,
StringRef  Indent = "  " 
) const

Definition at line 1323 of file SROA.cpp.

References I, and OS.

Referenced by print().

Friends And Related Function Documentation

◆ AllocaSlices::SliceBuilder

friend class AllocaSlices::SliceBuilder
friend

Definition at line 520 of file SROA.cpp.


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