LLVM: llvm::memprof::CallStackTrie Class Reference (original) (raw)
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](MemoryProfileInfo%5F8h%5Fsource.html)"
| Public Member Functions | |
|---|---|
| CallStackTrie (OptimizationRemarkEmitter *ORE=nullptr, uint64_t MaxColdSize=0) | |
| ~CallStackTrie () | |
| bool | empty () const |
| LLVM_ABI void | addCallStack (AllocationType AllocType, ArrayRef< uint64_t > StackIds, std::vector< ContextTotalSize > ContextSizeInfo={}) |
| Add a call stack context with the given allocation type to the Trie. | |
| LLVM_ABI void | addCallStack (MDNode *MIB) |
| Add the call stack context along with its allocation type from the MIB metadata to the Trie. | |
| LLVM_ABI bool | buildAndAttachMIBMetadata (CallBase *CI) |
| Build and attach the minimal necessary MIB metadata. | |
| LLVM_ABI void | addSingleAllocTypeAttribute (CallBase *CI, AllocationType AT, StringRef Descriptor) |
| Add an attribute for the given allocation type to the call instruction. |
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 75 of file MemoryProfileInfo.h.
◆ ~CallStackTrie()
| llvm::memprof::CallStackTrie::~CallStackTrie ( ) | inline |
|---|
◆ addCallStack() [1/2]
◆ addCallStack() [2/2]
| void CallStackTrie::addCallStack | ( | MDNode * | MIB | ) |
|---|
◆ addSingleAllocTypeAttribute()
Add an attribute for the given allocation type to the call instruction.
If hinted by reporting is enabled, a message is emitted with the given descriptor used to identify the category of single allocation type.
Definition at line 497 of file MemoryProfileInfo.cpp.
References A(), llvm::CallBase::addFnAttr(), DEBUG_TYPE, llvm::errs(), llvm::Attribute::get(), llvm::memprof::getAllocTypeAttributeString(), llvm::Value::getContext(), llvm::Instruction::getFunction(), llvm::MemProfReportHintedSizes, and llvm::memprof::removeAnyExistingAmbiguousAttribute().
Referenced by buildAndAttachMIBMetadata(), and handleAllocSite().
◆ buildAndAttachMIBMetadata()
| bool CallStackTrie::buildAndAttachMIBMetadata | ( | CallBase * | CI | ) |
|---|
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 525 of file MemoryProfileInfo.cpp.
References llvm::memprof::addAmbiguousAttribute(), addSingleAllocTypeAttribute(), assert(), llvm::MDNode::get(), llvm::Value::getContext(), llvm::memprof::hasSingleAllocType(), llvm::Hot, llvm::NotCold, and llvm::Instruction::setMetadata().
Referenced by handleAllocSite().
◆ empty()
| bool llvm::memprof::CallStackTrie::empty ( ) const | inline |
|---|
The documentation for this class was generated from the following files:
- include/llvm/Analysis/MemoryProfileInfo.h
- lib/Analysis/MemoryProfileInfo.cpp