LLVM: lib/CodeGen/AsmPrinter/PseudoProbePrinter.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

20

21#ifndef NDEBUG

24#endif

25

26using namespace llvm;

27

31

32

33

34

36 auto *InlinedAt = DebugLoc ? DebugLoc->getInlinedAt() : nullptr;

37 while (InlinedAt) {

38 auto Name = InlinedAt->getSubprogramLinkageName();

39

40 uint64_t &CallerGuid = NameGuidMap[Name];

41 if (!CallerGuid)

43#ifndef NDEBUG

44 verifyGuidExistenceInDesc(CallerGuid, Name);

45#endif

47 InlinedAt->getDiscriminator());

48 ReversedInlineStack.emplace_back(CallerGuid, CallerProbeId);

49 InlinedAt = InlinedAt->getInlinedAt();

50 }

52

53

56 Discriminator = DebugLoc->getDiscriminator();

58 "Discriminator should not be set in non-FSAFDO mode");

60 Asm->OutStreamer->emitPseudoProbe(Guid, Index, Type, Attr, Discriminator,

61 InlineStack, Asm->CurrentFnSym);

62#ifndef NDEBUG

63 verifyGuidExistenceInDesc(

65#endif

66}

67

68#ifndef NDEBUG

69void PseudoProbeHandler::verifyGuidExistenceInDesc(uint64_t Guid,

73 assert(Desc && "pseudo probe does not exist");

74

75

76 for (size_t I = DescGuidSet.size(), E = Desc->getNumOperands(); I != E; ++I) {

79 DescGuidSet.insert(ID->getZExtValue());

80 }

81

84 << " does not exist in pseudo probe desc\n";

85}

86#endif

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

Module.h This file contains the declarations for the Module class.

MachineFunction * MF

The current machine function.

static LLVM_ABI GUID getGUIDAssumingExternalLinkage(StringRef GlobalName)

Return a 64-bit global unique ID constructed from the name of a global symbol.

Module * getParent()

Get the module that this global value is contained inside of...

Function & getFunction()

Return the LLVM function that this machine code represents.

NamedMDNode * getNamedMetadata(StringRef Name) const

Return the first NamedMDNode in the module with the specified name.

void emitPseudoProbe(uint64_t Guid, uint64_t Index, uint64_t Type, uint64_t Attr, const DILocation *DebugLoc)

Definition PseudoProbePrinter.cpp:28

reference emplace_back(ArgTypes &&... Args)

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

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

The instances of the Type class are immutable: once they are created, they are never changed.

static LLVM_ABI raw_ostream & warning()

Convenience method for printing "warning: " to stderr.

std::pair< iterator, bool > insert(const ValueT &V)

bool contains(const_arg_type_t< ValueT > V) const

Check if the set contains the given element.

unsigned ID

LLVM IR allows to use arbitrary numbers as calling convention identifiers.

std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > extract(Y &&MD)

Extract a Value from Metadata.

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI cl::opt< bool > EnableFSDiscriminator

auto reverse(ContainerTy &&C)

decltype(auto) cast(const From &Val)

cast - Return the argument parameter cast to the specified type.

constexpr const char * PseudoProbeDescMetadataName

static uint32_t extractProbeIndex(uint32_t Value)