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