LLVM
8.0.1
|
A globally hashed type represents a hash value that is sufficient to uniquely identify a record across multiple type streams or type sequences. More...
#include "llvm/DebugInfo/CodeView/TypeHashing.h"
Public Member Functions | |
GloballyHashedType ()=default | |
GloballyHashedType (StringRef H) | |
GloballyHashedType (ArrayRef< uint8_t > H) | |
Static Public Member Functions | |
static GloballyHashedType | hashType (ArrayRef< uint8_t > RecordData, ArrayRef< GloballyHashedType > PreviousTypes, ArrayRef< GloballyHashedType > PreviousIds) |
Given a sequence of bytes representing a record, compute a global hash for this record. More... | |
static GloballyHashedType | hashType (CVType Type, ArrayRef< GloballyHashedType > PreviousTypes, ArrayRef< GloballyHashedType > PreviousIds) |
Given a sequence of bytes representing a record, compute a global hash for this record. More... | |
template<typename Range > | |
static std::vector< GloballyHashedType > | hashTypes (Range &&Records) |
Given a sequence of combined type and ID records, compute global hashes for each of them, returning the results in a vector of hashed types. More... | |
template<typename Range > | |
static std::vector< GloballyHashedType > | hashIds (Range &&Records, ArrayRef< GloballyHashedType > TypeHashes) |
Given a sequence of combined type and ID records, compute global hashes for each of them, returning the results in a vector of hashed types. More... | |
static std::vector< GloballyHashedType > | hashTypeCollection (TypeCollection &Types) |
Public Attributes | |
std::array< uint8_t, 8 > | Hash |
A globally hashed type represents a hash value that is sufficient to uniquely identify a record across multiple type streams or type sequences.
This works by, for any given record A which references B, replacing the TypeIndex that refers to B with a previously-computed global hash for B. As this is a recursive algorithm (e.g. the global hash of B also depends on the global hashes of the types that B refers to), a global hash can uniquely identify identify that A occurs in another stream that has a completely different graph structure. Although the hash itself is slower to compute, probing is much faster with a globally hashed type, because the hash itself is considered "as good as" the original type. Since type records can be quite large, this makes the equality comparison of the hash much faster than equality comparison of a full record.
Definition at line 78 of file TypeHashing.h.
|
default |
|
inline |
Definition at line 80 of file TypeHashing.h.
|
inline |
Definition at line 82 of file TypeHashing.h.
References assert(), llvm::ArrayRef< T >::data(), llvm::codeview::LocallyHashedType::Hash, llvm::Intrinsic::memcpy, and llvm::ArrayRef< T >::size().
|
inlinestatic |
Given a sequence of combined type and ID records, compute global hashes for each of them, returning the results in a vector of hashed types.
Definition at line 121 of file TypeHashing.h.
References llvm::codeview::LocallyHashedType::hashType().
|
static |
Given a sequence of bytes representing a record, compute a global hash for this record.
Due to the nature of global hashes incorporating the hashes of referenced records, this function requires a list of types and ids that RecordData might reference, indexable by TypeIndex.
Definition at line 34 of file TypeHashing.cpp.
References llvm::codeview::discoverTypeIndices(), llvm::ArrayRef< T >::drop_front(), llvm::SHA1::final(), llvm::codeview::IndexRef, llvm::SHA1::init(), llvm::makeArrayRef(), llvm::Ref, llvm::ArrayRef< T >::slice(), llvm::StringRef::take_back(), llvm::ArrayRef< T >::take_front(), and llvm::SHA1::update().
Referenced by llvm::codeview::GlobalTypeTableBuilder::insertRecordBytes().
|
inlinestatic |
Given a sequence of bytes representing a record, compute a global hash for this record.
Due to the nature of global hashes incorporating the hashes of referenced records, this function requires a list of types and ids that RecordData might reference, indexable by TypeIndex.
Definition at line 100 of file TypeHashing.h.
References llvm::codeview::LocallyHashedType::hashType(), and llvm::codeview::CVRecord< Kind >::RecordData.
|
inlinestatic |
Definition at line 130 of file TypeHashing.h.
References llvm::codeview::TypeCollection::ForEachRecord(), llvm::codeview::LocallyHashedType::hashType(), and llvm::codeview::CVRecord< Kind >::RecordData.
|
inlinestatic |
Given a sequence of combined type and ID records, compute global hashes for each of them, returning the results in a vector of hashed types.
Definition at line 109 of file TypeHashing.h.
References llvm::codeview::LocallyHashedType::hashType().
std::array<uint8_t, 8> llvm::codeview::GloballyHashedType::Hash |
Definition at line 86 of file TypeHashing.h.
Referenced by llvm::format_provider< codeview::GloballyHashedType >::format(), llvm::DenseMapInfo< codeview::GloballyHashedType >::getHashValue(), and llvm::DenseMapInfo< codeview::GloballyHashedType >::isEqual().