xref: /freebsd/contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/PseudoProbePrinter.h (revision 349cc55c9796c4596a5b9904cd3281af295f878f)
1e8d8bef9SDimitry Andric //===- PseudoProbePrinter.h - Pseudo probe encoding support -----*- C++ -*-===//
2e8d8bef9SDimitry Andric //
3e8d8bef9SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4e8d8bef9SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5e8d8bef9SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6e8d8bef9SDimitry Andric //
7e8d8bef9SDimitry Andric //===----------------------------------------------------------------------===//
8e8d8bef9SDimitry Andric //
9e8d8bef9SDimitry Andric // This file contains support for writing pseudo probe info into asm files.
10e8d8bef9SDimitry Andric //
11e8d8bef9SDimitry Andric //===----------------------------------------------------------------------===//
12e8d8bef9SDimitry Andric 
13e8d8bef9SDimitry Andric #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_PSEUDOPROBEPRINTER_H
14e8d8bef9SDimitry Andric #define LLVM_LIB_CODEGEN_ASMPRINTER_PSEUDOPROBEPRINTER_H
15e8d8bef9SDimitry Andric 
16e8d8bef9SDimitry Andric #include "llvm/ADT/DenseMap.h"
17e8d8bef9SDimitry Andric #include "llvm/CodeGen/AsmPrinterHandler.h"
18e8d8bef9SDimitry Andric 
19e8d8bef9SDimitry Andric namespace llvm {
20e8d8bef9SDimitry Andric 
21e8d8bef9SDimitry Andric class AsmPrinter;
22e8d8bef9SDimitry Andric class MCStreamer;
23e8d8bef9SDimitry Andric class Module;
24e8d8bef9SDimitry Andric class DILocation;
25e8d8bef9SDimitry Andric 
26e8d8bef9SDimitry Andric class PseudoProbeHandler : public AsmPrinterHandler {
27e8d8bef9SDimitry Andric   // Target of pseudo probe emission.
28e8d8bef9SDimitry Andric   AsmPrinter *Asm;
29*349cc55cSDimitry Andric   // Name to GUID map, used as caching/memoization for speed.
30*349cc55cSDimitry Andric   DenseMap<StringRef, uint64_t> NameGuidMap;
31e8d8bef9SDimitry Andric 
32e8d8bef9SDimitry Andric public:
33fe6060f1SDimitry Andric   PseudoProbeHandler(AsmPrinter *A) : Asm(A){};
34*349cc55cSDimitry Andric   ~PseudoProbeHandler() override;
35e8d8bef9SDimitry Andric 
36e8d8bef9SDimitry Andric   void emitPseudoProbe(uint64_t Guid, uint64_t Index, uint64_t Type,
37e8d8bef9SDimitry Andric                        uint64_t Attr, const DILocation *DebugLoc);
38e8d8bef9SDimitry Andric 
39e8d8bef9SDimitry Andric   // Unused.
40e8d8bef9SDimitry Andric   void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override {}
41e8d8bef9SDimitry Andric   void endModule() override {}
42e8d8bef9SDimitry Andric   void beginFunction(const MachineFunction *MF) override {}
43e8d8bef9SDimitry Andric   void endFunction(const MachineFunction *MF) override {}
44e8d8bef9SDimitry Andric   void beginInstruction(const MachineInstr *MI) override {}
45e8d8bef9SDimitry Andric   void endInstruction() override {}
46e8d8bef9SDimitry Andric };
47e8d8bef9SDimitry Andric 
48e8d8bef9SDimitry Andric } // namespace llvm
49e8d8bef9SDimitry Andric #endif // LLVM_LIB_CODEGEN_ASMPRINTER_PSEUDOPROBEPRINTER_H
50