LLVM 24.0.0git
llvm::VPIRMetadata Class Reference

Helper to manage IR metadata for recipes. More...

#include "Transforms/Vectorize/VPlan.h"

Inheritance diagram for llvm::VPIRMetadata:
[legend]

Public Member Functions

 VPIRMetadata ()=default
 VPIRMetadata (Instruction &I)
 Adds metatadata that can be preserved from the original instruction I.
 VPIRMetadata (const VPIRMetadata &Other)=default
 Copy constructor for cloning.
VPIRMetadataoperator= (const VPIRMetadata &Other)=default
void applyMetadata (Instruction &I) const
 Add all metadata to I.
void setMetadata (unsigned Kind, MDNode *Node)
 Set metadata with kind Kind to Node.
void intersect (const VPIRMetadata &MD)
 Intersect this VPIRMetadata object with MD, keeping only metadata nodes that are common to both.
MDNodegetMetadata (unsigned Kind) const
 Get metadata of kind Kind. Returns nullptr if not found.
void setExecutionFrequency (std::optional< VPExecutionFrequency > Freq, LLVMContext &Ctx)
 Record that the recipe executes with frequency Freq, relative to the entry of the loop region.
std::optional< VPExecutionFrequencygetExecutionFrequency () const
 Returns the frequency recorded by setExecutionFrequency, if any.
void clearExecutionFrequency ()
 Drop the frequency recorded by setExecutionFrequency, if any.
MDNodegetBranchWeights () const
 Returns the branch weights recorded for this terminator, preferring real profile data over an estimate, or nullptr if there are none.
bool hasEstimatedBranchWeights () const
 Returns true if the weights returned by getBranchWeights are estimated.
void setEstimatedBranchWeights (MDNode *Node)
 Set estimated branch weights to Node.
void print (raw_ostream &O, VPSlotTracker &SlotTracker) const
 Print metadata with node IDs.

Detailed Description

Helper to manage IR metadata for recipes.

It filters out metadata that cannot be propagated.

Definition at line 1192 of file VPlan.h.

Constructor & Destructor Documentation

◆ VPIRMetadata() [1/3]

◆ VPIRMetadata() [2/3]

llvm::VPIRMetadata::VPIRMetadata ( Instruction & I)
inline

Adds metatadata that can be preserved from the original instruction I.

Definition at line 1221 of file VPlan.h.

References llvm::getMetadataToPropagate(), and I.

◆ VPIRMetadata() [3/3]

llvm::VPIRMetadata::VPIRMetadata ( const VPIRMetadata & Other)
default

Copy constructor for cloning.

References llvm::Other, and VPIRMetadata().

Member Function Documentation

◆ applyMetadata()

◆ clearExecutionFrequency()

void VPIRMetadata::clearExecutionFrequency ( )

Drop the frequency recorded by setExecutionFrequency, if any.

Definition at line 2136 of file VPlanRecipes.cpp.

References llvm::erase_if(), and P.

Referenced by getCommonMetadata(), and mergeReplicateRegionsIntoSuccessors().

◆ getBranchWeights()

MDNode * llvm::VPIRMetadata::getBranchWeights ( ) const
inline

Returns the branch weights recorded for this terminator, preferring real profile data over an estimate, or nullptr if there are none.

Definition at line 1275 of file VPlan.h.

References getMetadata().

◆ getExecutionFrequency()

std::optional< VPExecutionFrequency > VPIRMetadata::getExecutionFrequency ( ) const

Returns the frequency recorded by setExecutionFrequency, if any.

Definition at line 2130 of file VPlanRecipes.cpp.

References getExecutionFrequencyFromMD().

Referenced by mergeReplicateRegionsIntoSuccessors().

◆ getMetadata()

MDNode * llvm::VPIRMetadata::getMetadata ( unsigned Kind) const
inline

Get metadata of kind Kind. Returns nullptr if not found.

Definition at line 1256 of file VPlan.h.

References llvm::find_if(), and P.

Referenced by getBranchWeights(), and setEstimatedBranchWeights().

◆ hasEstimatedBranchWeights()

bool llvm::VPIRMetadata::hasEstimatedBranchWeights ( ) const
inline

Returns true if the weights returned by getBranchWeights are estimated.

Definition at line 1281 of file VPlan.h.

◆ intersect()

void VPIRMetadata::intersect ( const VPIRMetadata & MD)

Intersect this VPIRMetadata object with MD, keeping only metadata nodes that are common to both.

Definition at line 2143 of file VPlanRecipes.cpp.

References llvm::SmallVectorImpl< T >::emplace_back(), llvm::Other, and VPIRMetadata().

Referenced by llvm::VPlanTransforms::createInterleaveGroups(), and getCommonMetadata().

◆ operator=()

VPIRMetadata & llvm::VPIRMetadata::operator= ( const VPIRMetadata & Other)
default

◆ print()

◆ setEstimatedBranchWeights()

void llvm::VPIRMetadata::setEstimatedBranchWeights ( MDNode * Node)
inline

Set estimated branch weights to Node.

Definition at line 1286 of file VPlan.h.

References assert(), getMetadata(), and setMetadata().

◆ setExecutionFrequency()

void VPIRMetadata::setExecutionFrequency ( std::optional< VPExecutionFrequency > Freq,
LLVMContext & Ctx )

◆ setMetadata()

void llvm::VPIRMetadata::setMetadata ( unsigned Kind,
MDNode * Node )
inline

Set metadata with kind Kind to Node.

If metadata with Kind already exists, it will be replaced. Otherwise, it will be added.

Definition at line 1240 of file VPlan.h.

References llvm::find_if(), and P.

Referenced by setEstimatedBranchWeights(), and setExecutionFrequency().


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