xref: /openbsd-src/gnu/llvm/llvm/lib/CodeGen/AsmPrinter/PseudoProbePrinter.h (revision d415bd752c734aee168c4ee86ff32e8cc249eb16)
173471bf0Spatrick //===- PseudoProbePrinter.h - Pseudo probe encoding support -----*- C++ -*-===//
273471bf0Spatrick //
373471bf0Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
473471bf0Spatrick // See https://llvm.org/LICENSE.txt for license information.
573471bf0Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
673471bf0Spatrick //
773471bf0Spatrick //===----------------------------------------------------------------------===//
873471bf0Spatrick //
973471bf0Spatrick // This file contains support for writing pseudo probe info into asm files.
1073471bf0Spatrick //
1173471bf0Spatrick //===----------------------------------------------------------------------===//
1273471bf0Spatrick 
1373471bf0Spatrick #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_PSEUDOPROBEPRINTER_H
1473471bf0Spatrick #define LLVM_LIB_CODEGEN_ASMPRINTER_PSEUDOPROBEPRINTER_H
1573471bf0Spatrick 
1673471bf0Spatrick #include "llvm/ADT/DenseMap.h"
1773471bf0Spatrick #include "llvm/CodeGen/AsmPrinterHandler.h"
1873471bf0Spatrick 
1973471bf0Spatrick namespace llvm {
2073471bf0Spatrick 
2173471bf0Spatrick class AsmPrinter;
2273471bf0Spatrick class DILocation;
2373471bf0Spatrick 
2473471bf0Spatrick class PseudoProbeHandler : public AsmPrinterHandler {
2573471bf0Spatrick   // Target of pseudo probe emission.
2673471bf0Spatrick   AsmPrinter *Asm;
27*d415bd75Srobert   // Name to GUID map, used as caching/memoization for speed.
28*d415bd75Srobert   DenseMap<StringRef, uint64_t> NameGuidMap;
2973471bf0Spatrick 
3073471bf0Spatrick public:
PseudoProbeHandler(AsmPrinter * A)3173471bf0Spatrick   PseudoProbeHandler(AsmPrinter *A) : Asm(A){};
32*d415bd75Srobert   ~PseudoProbeHandler() override;
3373471bf0Spatrick 
3473471bf0Spatrick   void emitPseudoProbe(uint64_t Guid, uint64_t Index, uint64_t Type,
3573471bf0Spatrick                        uint64_t Attr, const DILocation *DebugLoc);
3673471bf0Spatrick 
3773471bf0Spatrick   // Unused.
setSymbolSize(const MCSymbol * Sym,uint64_t Size)3873471bf0Spatrick   void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override {}
endModule()3973471bf0Spatrick   void endModule() override {}
beginFunction(const MachineFunction * MF)4073471bf0Spatrick   void beginFunction(const MachineFunction *MF) override {}
endFunction(const MachineFunction * MF)4173471bf0Spatrick   void endFunction(const MachineFunction *MF) override {}
beginInstruction(const MachineInstr * MI)4273471bf0Spatrick   void beginInstruction(const MachineInstr *MI) override {}
endInstruction()4373471bf0Spatrick   void endInstruction() override {}
4473471bf0Spatrick };
4573471bf0Spatrick 
4673471bf0Spatrick } // namespace llvm
4773471bf0Spatrick #endif // LLVM_LIB_CODEGEN_ASMPRINTER_PSEUDOPROBEPRINTER_H
48