1//===- PseudoProbePrinter.h - Pseudo probe encoding support -----*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file contains support for writing pseudo probe info into asm files.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_PSEUDOPROBEPRINTER_H
14#define LLVM_LIB_CODEGEN_ASMPRINTER_PSEUDOPROBEPRINTER_H
15
16#include "llvm/ADT/DenseMap.h"
17
18#ifndef NDEBUG
19#include "llvm/ADT/DenseSet.h"
20#endif
21
22namespace llvm {
23
24class AsmPrinter;
25class DILocation;
26
27class PseudoProbeHandler {
28 // Target of pseudo probe emission.
29 AsmPrinter *Asm;
30 // Name to GUID map, used as caching/memoization for speed.
31 DenseMap<StringRef, uint64_t> NameGuidMap;
32
33#ifndef NDEBUG
34 // All GUID in llvm.pseudo_probe_desc.
35 DenseSet<uint64_t> DescGuidSet;
36
37 void verifyGuidExistenceInDesc(uint64_t Guid, StringRef FuncName);
38#endif
39
40public:
41 PseudoProbeHandler(AsmPrinter *A) : Asm(A) {};
42
43 void emitPseudoProbe(uint64_t Guid, uint64_t Index, uint64_t Type,
44 uint64_t Attr, const DILocation *DebugLoc);
45};
46
47} // namespace llvm
48#endif // LLVM_LIB_CODEGEN_ASMPRINTER_PSEUDOPROBEPRINTER_H
49