class CallStackTrie

Declaration

class CallStackTrie { /* full declaration omitted */ };

Description

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.

Declared at: llvm/include/llvm/Analysis/MemoryProfileInfo.h:51

Member Variables

private llvm::memprof::CallStackTrie::CallStackTrieNode* Alloc
private uint64_t AllocStackId

Method Overview

  • public CallStackTrie()
  • public void addCallStack(llvm::memprof::AllocationType AllocType, ArrayRef<uint64_t> StackIds)
  • public void addCallStack(llvm::MDNode * MIB)
  • public bool buildAndAttachMIBMetadata(llvm::CallBase * CI)
  • private bool buildMIBNodes(llvm::memprof::CallStackTrie::CallStackTrieNode * Node, llvm::LLVMContext & Ctx, std::vector<uint64_t> & MIBCallStack, std::vector<Metadata *> & MIBNodes, bool CalleeHasAmbiguousCallerContext)
  • private void deleteTrieNode(llvm::memprof::CallStackTrie::CallStackTrieNode * Node)
  • public bool empty() const
  • public ~CallStackTrie()

Methods

CallStackTrie()

Declared at: llvm/include/llvm/Analysis/MemoryProfileInfo.h:83

void addCallStack(
    llvm::memprof::AllocationType AllocType,
    ArrayRef<uint64_t> StackIds)

Description

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).

Declared at: llvm/include/llvm/Analysis/MemoryProfileInfo.h:93

Parameters

llvm::memprof::AllocationType AllocType
ArrayRef<uint64_t> StackIds

void addCallStack(llvm::MDNode* MIB)

Description

Add the call stack context along with its allocation type from the MIB metadata to the Trie.

Declared at: llvm/include/llvm/Analysis/MemoryProfileInfo.h:97

Parameters

llvm::MDNode* MIB

bool buildAndAttachMIBMetadata(llvm::CallBase* CI)

Description

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).

Declared at: llvm/include/llvm/Analysis/MemoryProfileInfo.h:106

Parameters

llvm::CallBase* CI

bool buildMIBNodes(
    llvm::memprof::CallStackTrie::
        CallStackTrieNode* Node,
    llvm::LLVMContext& Ctx,
    std::vector<uint64_t>& MIBCallStack,
    std::vector<Metadata*>& MIBNodes,
    bool CalleeHasAmbiguousCallerContext)

Declared at: llvm/include/llvm/Analysis/MemoryProfileInfo.h:77

Parameters

llvm::memprof::CallStackTrie::CallStackTrieNode* Node
llvm::LLVMContext& Ctx
std::vector<uint64_t>& MIBCallStack
std::vector<Metadata*>& MIBNodes
bool CalleeHasAmbiguousCallerContext

void deleteTrieNode(llvm::memprof::CallStackTrie::
                        CallStackTrieNode* Node)

Declared at: llvm/include/llvm/Analysis/MemoryProfileInfo.h:68

Parameters

llvm::memprof::CallStackTrie::CallStackTrieNode* Node

bool empty() const

Declared at: llvm/include/llvm/Analysis/MemoryProfileInfo.h:86

~CallStackTrie()

Declared at: llvm/include/llvm/Analysis/MemoryProfileInfo.h:84