LLVM 22.0.0git
ProfDataUtils.h File Reference

This file contains the declarations for profiling metadata utility functions. More...

Go to the source code of this file.

Classes

struct  llvm::MDProfLabels

Namespaces

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

Functions

LLVM_ABI bool llvm::hasProfMD (const Instruction &I)
 Checks if an Instruction has MD_prof Metadata.
LLVM_ABI bool llvm::isBranchWeightMD (const MDNode *ProfileData)
 Checks if an MDNode contains Branch Weight Metadata.
LLVM_ABI bool llvm::isValueProfileMD (const MDNode *ProfileData)
 Checks if an MDNode contains value profiling Metadata.
LLVM_ABI bool llvm::hasBranchWeightMD (const Instruction &I)
 Checks if an instructions has Branch Weight Metadata.
LLVM_ABI bool llvm::hasValidBranchWeightMD (const Instruction &I)
 Checks if an instructions has valid Branch Weight Metadata.
LLVM_ABI MDNodellvm::getBranchWeightMDNode (const Instruction &I)
 Get the branch weights metadata node.
LLVM_ABI MDNodellvm::getValidBranchWeightMDNode (const Instruction &I)
 Get the valid branch weights metadata node.
LLVM_ABI bool llvm::hasBranchWeightOrigin (const Instruction &I)
 Check if Branch Weight Metadata has an "expected" field from an llvm.expect* intrinsic.
LLVM_ABI bool llvm::hasBranchWeightOrigin (const MDNode *ProfileData)
 Check if Branch Weight Metadata has an "expected" field from an llvm.expect* intrinsic.
LLVM_ABI unsigned llvm::getBranchWeightOffset (const MDNode *ProfileData)
 Return the offset to the first branch weight data.
LLVM_ABI unsigned llvm::getNumBranchWeights (const MDNode &ProfileData)
LLVM_ABI bool llvm::extractBranchWeights (const MDNode *ProfileData, SmallVectorImpl< uint32_t > &Weights)
 Extract branch weights from MD_prof metadata.
LLVM_ABI void llvm::extractFromBranchWeightMD32 (const MDNode *ProfileData, SmallVectorImpl< uint32_t > &Weights)
 Faster version of extractBranchWeights() that skips checks and must only be called with "branch_weights" metadata nodes.
LLVM_ABI void llvm::extractFromBranchWeightMD64 (const MDNode *ProfileData, SmallVectorImpl< uint64_t > &Weights)
 Faster version of extractBranchWeights() that skips checks and must only be called with "branch_weights" metadata nodes.
LLVM_ABI bool llvm::extractBranchWeights (const Instruction &I, SmallVectorImpl< uint32_t > &Weights)
 Extract branch weights attatched to an Instruction.
LLVM_ABI bool llvm::extractBranchWeights (const Instruction &I, uint64_t &TrueVal, uint64_t &FalseVal)
 Extract branch weights from a conditional branch or select Instruction.
LLVM_ABI bool llvm::extractProfTotalWeight (const MDNode *ProfileData, uint64_t &TotalWeights)
 Retrieve the total of all weights from MD_prof data.
LLVM_ABI bool llvm::extractProfTotalWeight (const Instruction &I, uint64_t &TotalWeights)
 Retrieve the total of all weights from an instruction.
LLVM_ABI void llvm::setBranchWeights (Instruction &I, ArrayRef< uint32_t > Weights, bool IsExpected)
 Create a new branch_weights metadata node and add or overwrite a prof metadata reference to instruction I.
LLVM_ABI SmallVector< uint32_tllvm::downscaleWeights (ArrayRef< uint64_t > Weights, std::optional< uint64_t > KnownMaxCount=std::nullopt)
 downscale the given weights preserving the ratio.
uint64_t llvm::calculateCountScale (uint64_t MaxCount)
 Calculate what to divide by to scale counts.
uint32_t llvm::scaleBranchCount (uint64_t Count, uint64_t Scale)
 Scale an individual branch count.
LLVM_ABI void llvm::setExplicitlyUnknownBranchWeights (Instruction &I, StringRef PassName)
 Specify that the branch weights for this terminator cannot be known at compile time.
LLVM_ABI void llvm::setExplicitlyUnknownBranchWeightsIfProfiled (Instruction &I, Function &F, StringRef PassName)
 Like setExplicitlyUnknownBranchWeights(...), but only sets unknown branch weights in the new instruction if the parent function of the original instruction has an entry count.
LLVM_ABI void llvm::setExplicitlyUnknownFunctionEntryCount (Function &F, StringRef PassName)
 Analogous to setExplicitlyUnknownBranchWeights, but for functions and their entry counts.
LLVM_ABI bool llvm::isExplicitlyUnknownProfileMetadata (const MDNode &MD)
LLVM_ABI bool llvm::hasExplicitlyUnknownBranchWeights (const Instruction &I)
LLVM_ABI void llvm::scaleProfData (Instruction &I, uint64_t S, uint64_t T)
 Scaling the profile data attached to 'I' using the ratio of S/T.
SmallVector< uint64_t, 2 > llvm::getDisjunctionWeights (const SmallVector< uint32_t, 2 > &B1, const SmallVector< uint32_t, 2 > &B2)
 Get the branch weights of a branch conditioned on b1 || b2, where b1 and b2 are 2 booleans that are the conditions of 2 branches for which we have the branch weights B1 and B2, respectively.

Variables

LLVM_ABI const charllvm::LLVMLoopEstimatedTripCount = "llvm.loop.estimated_trip_count"
 Profile-based loop metadata that should be accessed only by using llvm::getLoopEstimatedTripCount and llvm::setLoopEstimatedTripCount.

Detailed Description

This file contains the declarations for profiling metadata utility functions.

Definition in file ProfDataUtils.h.