LLVM: lib/Support/AllocToken.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

17

18using namespace llvm;

19

20std::optional

30

32 switch (Mode) {

34 return "increment";

36 return "random";

38 return "typehash";

40 return "typehashpointersplit";

41 }

43}

44

49

53 assert(MaxTokens && "Must provide non-zero max tokens");

54

55 switch (Mode) {

58

59 return std::nullopt;

60

63

65 if (MaxTokens == 1)

66 return 0;

67 const uint64_t HalfTokens = MaxTokens / 2;

70 Hash += HalfTokens;

71 return Hash;

72 }

73 }

74

76}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...

static uint64_t getStableHash(const AllocTokenMetadata &Metadata, uint64_t MaxTokens)

Definition AllocToken.cpp:45

StringRef - Represent a constant reference to a string, i.e.

A switch()-like statement whose cases are string literals.

StringSwitch & Case(StringLiteral S, T Value)

#define llvm_unreachable(msg)

Marks that the current location is not supposed to be reachable.

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI std::optional< uint64_t > getAllocToken(AllocTokenMode Mode, const AllocTokenMetadata &Metadata, uint64_t MaxTokens)

Calculates stable allocation token ID.

Definition AllocToken.cpp:50

constexpr AllocTokenMode DefaultAllocTokenMode

The default allocation token mode.

LLVM_ABI uint64_t getStableSipHash(StringRef Str)

Compute a stable 64-bit hash of the given string.

AllocTokenMode

Modes for generating allocation token IDs.

@ TypeHash

Token ID based on allocated type hash.

@ Random

Simple mode that returns a statically-assigned random token ID.

@ Increment

Incrementally increasing token ID.

@ TypeHashPointerSplit

Token ID based on allocated type hash, where the top half ID-space is reserved for types that contain...

LLVM_ABI std::optional< AllocTokenMode > getAllocTokenModeFromString(StringRef Name)

Returns the AllocTokenMode from its canonical string name; if an invalid name was provided returns nu...

Definition AllocToken.cpp:21

LLVM_ABI StringRef getAllocTokenModeAsString(AllocTokenMode Mode)

Returns the canonical string name for the given AllocTokenMode.

Definition AllocToken.cpp:31