LLVM 20.0.0git
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
llvm::Dependence Class Reference

Dependence - This class represents a dependence between two memory memory references in a function. More...

#include "llvm/Analysis/DependenceAnalysis.h"

Inheritance diagram for llvm::Dependence:
Inheritance graph
[legend]

Classes

struct  DVEntry
 Dependence::DVEntry - Each level in the distance/direction vector has a direction (or perhaps a union of several directions), and perhaps a distance. More...
 

Public Member Functions

 Dependence (Instruction *Source, Instruction *Destination)
 
virtual ~Dependence ()=default
 
InstructiongetSrc () const
 getSrc - Returns the source instruction for this dependence.
 
InstructiongetDst () const
 getDst - Returns the destination instruction for this dependence.
 
bool isInput () const
 isInput - Returns true if this is an input dependence.
 
bool isOutput () const
 isOutput - Returns true if this is an output dependence.
 
bool isFlow () const
 isFlow - Returns true if this is a flow (aka true) dependence.
 
bool isAnti () const
 isAnti - Returns true if this is an anti dependence.
 
bool isOrdered () const
 isOrdered - Returns true if dependence is Output, Flow, or Anti
 
bool isUnordered () const
 isUnordered - Returns true if dependence is Input
 
virtual bool isLoopIndependent () const
 isLoopIndependent - Returns true if this is a loop-independent dependence.
 
virtual bool isConfused () const
 isConfused - Returns true if this dependence is confused (the compiler understands nothing and makes worst-case assumptions).
 
virtual bool isConsistent () const
 isConsistent - Returns true if this dependence is consistent (occurs every time the source and destination are executed).
 
virtual unsigned getLevels () const
 getLevels - Returns the number of common loops surrounding the source and destination of the dependence.
 
virtual unsigned getDirection (unsigned Level) const
 getDirection - Returns the direction associated with a particular level.
 
virtual const SCEVgetDistance (unsigned Level) const
 getDistance - Returns the distance (or NULL) associated with a particular level.
 
virtual bool isDirectionNegative () const
 Check if the direction vector is negative.
 
virtual bool normalize (ScalarEvolution *SE)
 If the direction vector is negative, normalize the direction vector to make it non-negative.
 
virtual bool isPeelFirst (unsigned Level) const
 isPeelFirst - Returns true if peeling the first iteration from this loop will break this dependence.
 
virtual bool isPeelLast (unsigned Level) const
 isPeelLast - Returns true if peeling the last iteration from this loop will break this dependence.
 
virtual bool isSplitable (unsigned Level) const
 isSplitable - Returns true if splitting this loop will break the dependence.
 
virtual bool isScalar (unsigned Level) const
 isScalar - Returns true if a particular level is scalar; that is, if no subscript in the source or destination mention the induction variable associated with the loop at this level.
 
const DependencegetNextPredecessor () const
 getNextPredecessor - Returns the value of the NextPredecessor field.
 
const DependencegetNextSuccessor () const
 getNextSuccessor - Returns the value of the NextSuccessor field.
 
void setNextPredecessor (const Dependence *pred)
 setNextPredecessor - Sets the value of the NextPredecessor field.
 
void setNextSuccessor (const Dependence *succ)
 setNextSuccessor - Sets the value of the NextSuccessor field.
 
void dump (raw_ostream &OS) const
 dump - For debugging purposes, dumps a dependence to OS.
 

Protected Member Functions

 Dependence (Dependence &&)=default
 
Dependenceoperator= (Dependence &&)=default
 

Protected Attributes

InstructionSrc
 
InstructionDst
 

Friends

class DependenceInfo
 

Detailed Description

Dependence - This class represents a dependence between two memory memory references in a function.

It contains minimal information and is used in the very common situation where the compiler is unable to determine anything beyond the existence of a dependence; that is, it represents a confused dependence (see also FullDependence). In most cases (for output, flow, and anti dependences), the dependence implies an ordering, where the source must precede the destination; in contrast, input dependences are unordered.

When a dependence graph is built, each Dependence will be a member of the set of predecessor edges for its destination instruction and a set if successor edges for its source instruction. These sets are represented as singly-linked lists, with the "next" fields stored in the dependence itelf.

Definition at line 71 of file DependenceAnalysis.h.

Constructor & Destructor Documentation

◆ Dependence() [1/2]

llvm::Dependence::Dependence ( Dependence &&  )
protecteddefault

◆ Dependence() [2/2]

llvm::Dependence::Dependence ( Instruction Source,
Instruction Destination 
)
inline

Definition at line 77 of file DependenceAnalysis.h.

◆ ~Dependence()

virtual llvm::Dependence::~Dependence ( )
virtualdefault

Member Function Documentation

◆ dump()

void Dependence::dump ( raw_ostream OS) const

◆ getDirection()

virtual unsigned llvm::Dependence::getDirection ( unsigned  Level) const
inlinevirtual

getDirection - Returns the direction associated with a particular level.

Reimplemented in llvm::FullDependence.

Definition at line 157 of file DependenceAnalysis.h.

References llvm::Dependence::DVEntry::ALL.

Referenced by dump().

◆ getDistance()

virtual const SCEV * llvm::Dependence::getDistance ( unsigned  Level) const
inlinevirtual

getDistance - Returns the distance (or NULL) associated with a particular level.

Reimplemented in llvm::FullDependence.

Definition at line 161 of file DependenceAnalysis.h.

Referenced by dump().

◆ getDst()

Instruction * llvm::Dependence::getDst ( ) const
inline

getDst - Returns the destination instruction for this dependence.

Definition at line 112 of file DependenceAnalysis.h.

References Dst.

Referenced by llvm::DependenceInfo::getSplitIteration().

◆ getLevels()

virtual unsigned llvm::Dependence::getLevels ( ) const
inlinevirtual

getLevels - Returns the number of common loops surrounding the source and destination of the dependence.

Reimplemented in llvm::FullDependence.

Definition at line 153 of file DependenceAnalysis.h.

Referenced by dump().

◆ getNextPredecessor()

const Dependence * llvm::Dependence::getNextPredecessor ( ) const
inline

getNextPredecessor - Returns the value of the NextPredecessor field.

Definition at line 192 of file DependenceAnalysis.h.

◆ getNextSuccessor()

const Dependence * llvm::Dependence::getNextSuccessor ( ) const
inline

getNextSuccessor - Returns the value of the NextSuccessor field.

Definition at line 196 of file DependenceAnalysis.h.

◆ getSrc()

Instruction * llvm::Dependence::getSrc ( ) const
inline

getSrc - Returns the source instruction for this dependence.

Definition at line 108 of file DependenceAnalysis.h.

References Src.

Referenced by llvm::DependenceInfo::getSplitIteration().

◆ isAnti()

bool Dependence::isAnti ( ) const

isAnti - Returns true if this is an anti dependence.

Definition at line 248 of file DependenceAnalysis.cpp.

References Dst, llvm::Instruction::mayReadFromMemory(), llvm::Instruction::mayWriteToMemory(), and Src.

Referenced by dump(), and isOrdered().

◆ isConfused()

virtual bool llvm::Dependence::isConfused ( ) const
inlinevirtual

isConfused - Returns true if this dependence is confused (the compiler understands nothing and makes worst-case assumptions).

Reimplemented in llvm::FullDependence.

Definition at line 145 of file DependenceAnalysis.h.

Referenced by dump().

◆ isConsistent()

virtual bool llvm::Dependence::isConsistent ( ) const
inlinevirtual

isConsistent - Returns true if this dependence is consistent (occurs every time the source and destination are executed).

Reimplemented in llvm::FullDependence.

Definition at line 149 of file DependenceAnalysis.h.

Referenced by dump().

◆ isDirectionNegative()

virtual bool llvm::Dependence::isDirectionNegative ( ) const
inlinevirtual

Check if the direction vector is negative.

A negative direction vector means Src and Dst are reversed in the actual program.

Reimplemented in llvm::FullDependence.

Definition at line 165 of file DependenceAnalysis.h.

◆ isFlow()

bool Dependence::isFlow ( ) const

isFlow - Returns true if this is a flow (aka true) dependence.

Definition at line 242 of file DependenceAnalysis.cpp.

References Dst, llvm::Instruction::mayReadFromMemory(), llvm::Instruction::mayWriteToMemory(), and Src.

Referenced by dump(), and isOrdered().

◆ isInput()

bool Dependence::isInput ( ) const

isInput - Returns true if this is an input dependence.

Definition at line 230 of file DependenceAnalysis.cpp.

References Dst, llvm::Instruction::mayReadFromMemory(), and Src.

Referenced by dump(), and isUnordered().

◆ isLoopIndependent()

virtual bool llvm::Dependence::isLoopIndependent ( ) const
inlinevirtual

isLoopIndependent - Returns true if this is a loop-independent dependence.

Reimplemented in llvm::FullDependence.

Definition at line 140 of file DependenceAnalysis.h.

Referenced by dump().

◆ isOrdered()

bool llvm::Dependence::isOrdered ( ) const
inline

isOrdered - Returns true if dependence is Output, Flow, or Anti

Definition at line 132 of file DependenceAnalysis.h.

References isAnti(), isFlow(), and isOutput().

◆ isOutput()

bool Dependence::isOutput ( ) const

isOutput - Returns true if this is an output dependence.

Definition at line 236 of file DependenceAnalysis.cpp.

References Dst, llvm::Instruction::mayWriteToMemory(), and Src.

Referenced by dump(), and isOrdered().

◆ isPeelFirst()

virtual bool llvm::Dependence::isPeelFirst ( unsigned  Level) const
inlinevirtual

isPeelFirst - Returns true if peeling the first iteration from this loop will break this dependence.

Reimplemented in llvm::FullDependence.

Definition at line 175 of file DependenceAnalysis.h.

Referenced by dump().

◆ isPeelLast()

virtual bool llvm::Dependence::isPeelLast ( unsigned  Level) const
inlinevirtual

isPeelLast - Returns true if peeling the last iteration from this loop will break this dependence.

Reimplemented in llvm::FullDependence.

Definition at line 179 of file DependenceAnalysis.h.

Referenced by dump().

◆ isScalar()

bool Dependence::isScalar ( unsigned  Level) const
virtual

isScalar - Returns true if a particular level is scalar; that is, if no subscript in the source or destination mention the induction variable associated with the loop at this level.

Reimplemented in llvm::FullDependence.

Definition at line 257 of file DependenceAnalysis.cpp.

Referenced by dump().

◆ isSplitable()

virtual bool llvm::Dependence::isSplitable ( unsigned  Level) const
inlinevirtual

isSplitable - Returns true if splitting this loop will break the dependence.

Reimplemented in llvm::FullDependence.

Definition at line 183 of file DependenceAnalysis.h.

Referenced by dump(), and llvm::DependenceInfo::getSplitIteration().

◆ isUnordered()

bool llvm::Dependence::isUnordered ( ) const
inline

isUnordered - Returns true if dependence is Input

Definition at line 136 of file DependenceAnalysis.h.

References isInput().

◆ normalize()

virtual bool llvm::Dependence::normalize ( ScalarEvolution SE)
inlinevirtual

If the direction vector is negative, normalize the direction vector to make it non-negative.

Normalization is done by reversing Src and Dst, plus reversing the dependence directions and distances in the vector.

Reimplemented in llvm::FullDependence.

Definition at line 171 of file DependenceAnalysis.h.

◆ operator=()

Dependence & llvm::Dependence::operator= ( Dependence &&  )
protecteddefault

◆ setNextPredecessor()

void llvm::Dependence::setNextPredecessor ( const Dependence pred)
inline

setNextPredecessor - Sets the value of the NextPredecessor field.

Definition at line 200 of file DependenceAnalysis.h.

References pred.

◆ setNextSuccessor()

void llvm::Dependence::setNextSuccessor ( const Dependence succ)
inline

setNextSuccessor - Sets the value of the NextSuccessor field.

Definition at line 204 of file DependenceAnalysis.h.

Friends And Related Function Documentation

◆ DependenceInfo

friend class DependenceInfo
friend

Definition at line 215 of file DependenceAnalysis.h.

Member Data Documentation

◆ Dst

Instruction * llvm::Dependence::Dst
protected

◆ Src

Instruction* llvm::Dependence::Src
protected

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