PseudoProbePrinter.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_PSEUDOPROBEPRINTER_H
  13. #define LLVM_LIB_CODEGEN_ASMPRINTER_PSEUDOPROBEPRINTER_H
  14. #include "llvm/ADT/DenseMap.h"
  15. #include "llvm/CodeGen/AsmPrinterHandler.h"
  16. namespace llvm {
  17. class AsmPrinter;
  18. class DILocation;
  19. class PseudoProbeHandler : public AsmPrinterHandler {
  20. // Target of pseudo probe emission.
  21. AsmPrinter *Asm;
  22. // Name to GUID map, used as caching/memoization for speed.
  23. DenseMap<StringRef, uint64_t> NameGuidMap;
  24. public:
  25. PseudoProbeHandler(AsmPrinter *A) : Asm(A){};
  26. ~PseudoProbeHandler() override;
  27. void emitPseudoProbe(uint64_t Guid, uint64_t Index, uint64_t Type,
  28. uint64_t Attr, const DILocation *DebugLoc);
  29. // Unused.
  30. void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override {}
  31. void endModule() override {}
  32. void beginFunction(const MachineFunction *MF) override {}
  33. void endFunction(const MachineFunction *MF) override {}
  34. void beginInstruction(const MachineInstr *MI) override {}
  35. void endInstruction() override {}
  36. };
  37. } // namespace llvm
  38. #endif // LLVM_LIB_CODEGEN_ASMPRINTER_PSEUDOPROBEPRINTER_H