LLVM 20.0.0git
|
Class to build a trie of call stack contexts for a particular profiled allocation call, along with their associated allocation types. More...
#include "llvm/Analysis/MemoryProfileInfo.h"
Public Member Functions | |
CallStackTrie ()=default | |
~CallStackTrie () | |
bool | empty () const |
void | addCallStack (AllocationType AllocType, ArrayRef< uint64_t > StackIds, uint64_t TotalSize=0) |
Add a call stack context with the given allocation type to the Trie. | |
void | addCallStack (MDNode *MIB) |
Add the call stack context along with its allocation type from the MIB metadata to the Trie. | |
bool | buildAndAttachMIBMetadata (CallBase *CI) |
Build and attach the minimal necessary MIB metadata. | |
Class to build a trie of call stack contexts for a particular profiled allocation call, along with their associated allocation types.
The allocation will be at the root of the trie, which is then used to compute the minimum lists of context ids needed to associate a call context with a single allocation type.
Definition at line 52 of file MemoryProfileInfo.h.
|
default |
|
inline |
Definition at line 86 of file MemoryProfileInfo.h.
void CallStackTrie::addCallStack | ( | AllocationType | AllocType, |
ArrayRef< uint64_t > | StackIds, | ||
uint64_t | TotalSize = 0 |
||
) |
Add a call stack context with the given allocation type to the Trie.
The context is represented by the list of stack ids (computed during matching via a debug location hash), expected to be in order from the allocation call down to the bottom of the call stack (i.e. callee to caller order).
Definition at line 138 of file MemoryProfileInfo.cpp.
References assert(), and llvm::First.
Referenced by addCallStack(), and addCallStack().
void CallStackTrie::addCallStack | ( | MDNode * | MIB | ) |
Add the call stack context along with its allocation type from the MIB metadata to the Trie.
Definition at line 174 of file MemoryProfileInfo.cpp.
References addCallStack(), assert(), llvm::memprof::getMIBAllocType(), llvm::memprof::getMIBStackNode(), llvm::memprof::getMIBTotalSize(), llvm::MDNode::getNumOperands(), and llvm::MDNode::operands().
Build and attach the minimal necessary MIB metadata.
If the alloc has a single allocation type, add a function attribute instead. The reason for adding an attribute in this case is that it matches how the behavior for allocation calls will be communicated to lib call simplification after cloning or another optimization to distinguish the allocation types, which is lower overhead and more direct than maintaining this metadata. Returns true if memprof metadata attached, false if not (attribute added).
Definition at line 255 of file MemoryProfileInfo.cpp.
References addAllocTypeAttribute(), assert(), llvm::errs(), llvm::MDNode::get(), llvm::memprof::getAllocTypeAttributeString(), llvm::Value::getContext(), llvm::memprof::hasSingleAllocType(), MemProfReportHintedSizes, llvm::NotCold, and llvm::Instruction::setMetadata().
Referenced by readMemprof().
|
inline |
Definition at line 88 of file MemoryProfileInfo.h.
Referenced by readMemprof().