#include "bolt/Core/BinaryFunction.h"
#include "bolt/Rewrite/MetadataRewriter.h"
#include "bolt/Rewrite/MetadataRewriters.h"
#include "bolt/Utils/CommandLineOpts.h"
#include "bolt/Utils/Utils.h"
#include "llvm/IR/Function.h"
#include "llvm/MC/MCPseudoProbe.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/LEB128.h"
#include <memory>
#undef DEBUG_TYPE
#define DEBUG_TYPE …
usingnamespacellvm;
usingnamespacebolt;
namespace opts {
enum PrintPseudoProbesOptions { … };
static cl::opt<PrintPseudoProbesOptions> PrintPseudoProbes(
"print-pseudo-probes", cl::desc("print pseudo probe info"),
cl::init(PPP_None),
cl::values(clEnumValN(PPP_Probes_Section_Decode, "decode",
"decode probes section from binary"),
clEnumValN(PPP_Probes_Address_Conversion, "address_conversion",
"update address2ProbesMap with output block address"),
clEnumValN(PPP_Encoded_Probes, "encoded_probes",
"display the encoded probes in binary section"),
clEnumValN(PPP_All, "all", "enable all debugging printout")),
cl::Hidden, cl::cat(BoltCategory));
extern cl::opt<bool> ProfileWritePseudoProbes;
}
namespace {
class PseudoProbeRewriter final : public MetadataRewriter { … };
Error PseudoProbeRewriter::preCFGInitializer() { … }
Error PseudoProbeRewriter::postEmitFinalizer() { … }
void PseudoProbeRewriter::parsePseudoProbe(bool ProfiledOnly) { … }
void PseudoProbeRewriter::updatePseudoProbes() { … }
void PseudoProbeRewriter::encodePseudoProbes() { … }
}
std::unique_ptr<MetadataRewriter>
llvm::bolt::createPseudoProbeRewriter(BinaryContext &BC) { … }