//===- PseudoProbeInserter.cpp - Insert annotation for callsite profiling -===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements PseudoProbeInserter pass, which inserts pseudo probe // annotations for call instructions with a pseudo-probe-specific dwarf // discriminator. such discriminator indicates that the call instruction comes // with a pseudo probe, and the discriminator value holds information to // identify the corresponding counter. //===----------------------------------------------------------------------===// #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/TargetInstrInfo.h" #include "llvm/IR/DebugInfoMetadata.h" #include "llvm/IR/Module.h" #include "llvm/IR/PseudoProbe.h" #include "llvm/InitializePasses.h" #define DEBUG_TYPE … usingnamespacellvm; namespace { class PseudoProbeInserter : public MachineFunctionPass { … }; } // namespace char PseudoProbeInserter::ID = …; INITIALIZE_PASS_BEGIN(PseudoProbeInserter, DEBUG_TYPE, "Insert pseudo probe annotations for value profiling", false, false) INITIALIZE_PASS_DEPENDENCY(TargetPassConfig) INITIALIZE_PASS_END(PseudoProbeInserter, DEBUG_TYPE, "Insert pseudo probe annotations for value profiling", false, false) FunctionPass *llvm::createPseudoProbeInserter() { … }