xref: /netbsd-src/external/apache2/llvm/dist/llvm/lib/CodeGen/AsmPrinter/PseudoProbePrinter.h (revision 82d56013d7b633d116a93943de88e08335357a7c)
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 #include "llvm/CodeGen/AsmPrinterHandler.h"
18 
19 namespace llvm {
20 
21 class AsmPrinter;
22 class MCStreamer;
23 class Module;
24 class DILocation;
25 
26 class PseudoProbeHandler : public AsmPrinterHandler {
27   // Target of pseudo probe emission.
28   AsmPrinter *Asm;
29   // Name to GUID map
30   DenseMap<StringRef, uint64_t> Names;
31 
32 public:
33   PseudoProbeHandler(AsmPrinter *A, Module *M);
34   ~PseudoProbeHandler() override;
35 
36   void emitPseudoProbe(uint64_t Guid, uint64_t Index, uint64_t Type,
37                        uint64_t Attr, const DILocation *DebugLoc);
38 
39   // Unused.
setSymbolSize(const MCSymbol * Sym,uint64_t Size)40   void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override {}
endModule()41   void endModule() override {}
beginFunction(const MachineFunction * MF)42   void beginFunction(const MachineFunction *MF) override {}
endFunction(const MachineFunction * MF)43   void endFunction(const MachineFunction *MF) override {}
beginInstruction(const MachineInstr * MI)44   void beginInstruction(const MachineInstr *MI) override {}
endInstruction()45   void endInstruction() override {}
46 
47 #ifndef NDEBUG
48   void dump() const;
49 #endif
50 };
51 
52 } // namespace llvm
53 #endif // LLVM_LIB_CODEGEN_ASMPRINTER_PSEUDOPROBEPRINTER_H
54