LLVM: lib/DebugInfo/CodeView/TypeHashing.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

10

13

14using namespace llvm;

16

19

20static std::array<uint8_t, 8> EmptyHash = {

21 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};

23 {0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};

24

27

31

43 for (const auto &Ref : Refs) {

44

49

51

52

54 reinterpret_cast<const TypeIndex *>(RefData.data()), Ref.Count);

57 if (TI.isSimple() || TI.isNoneType()) {

58 const uint8_t *IndexBytes = reinterpret_cast<const uint8_t *>(&TI);

60 } else {

61 if (TI.toArrayIndex() >= Prev.size() ||

62 Prev[TI.toArrayIndex()].empty()) {

63

64

65 return {};

66 }

67 BytesToHash = Prev[TI.toArrayIndex()].Hash;

68 }

69 S.update(BytesToHash);

70 }

71

73 }

74

75

76 auto TrailingBytes = RecordData.drop_front(Off);

77 S.update(TrailingBytes);

78

79 return {S.final()};

80}

static std::array< uint8_t, 8 > TombstoneHash

Definition TypeHashing.cpp:22

static std::array< uint8_t, 8 > EmptyHash

Definition TypeHashing.cpp:20

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

ArrayRef< T > take_front(size_t N=1) const

Return a copy of *this with only the first N elements.

ArrayRef< T > drop_front(size_t N=1) const

Drop the first N elements of the array.

ArrayRef< T > slice(size_t N, size_t M) const

slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array.

void init()

Reinitialize the internal state.

void update(ArrayRef< uint8_t > Data)

Digest more data.

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

Like BLAKE3 but using a class-level template parameter for specifying the hash size of the final() an...

void final(BLAKE3Result< NumBytes > &Result)

Finalize the hasher and put the result in Result.

An opaque object representing a hash code.

LLVM_ABI void discoverTypeIndices(ArrayRef< uint8_t > RecordData, SmallVectorImpl< TiReference > &Refs)

This is an optimization pass for GlobalISel generic memory operations.

hash_code hash_value(const FixedPointSemantics &Val)

@ Ref

The access may reference the value stored in memory.

ArrayRef(const T &OneElt) -> ArrayRef< T >

An information struct used to provide DenseMap with the various necessary components for a given valu...

A globally hashed type represents a hash value that is sufficient to uniquely identify a record acros...

static LLVM_ABI 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.

Definition TypeHashing.cpp:33

A locally hashed type represents a straightforward hash code of a serialized record.

static LLVM_ABI LocallyHashedType hashType(ArrayRef< uint8_t > RecordData)

Given a type, compute its local hash.

Definition TypeHashing.cpp:28

ArrayRef< uint8_t > RecordData