diff options
author | Haohai Wen <haohai.wen@intel.com> | 2025-07-15 17:48:04 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-15 17:48:04 +0800 |
commit | 148708493a80f9d75513f2e3721d043dd5b969a7 (patch) | |
tree | 017025032aca12c29d4d0195a6f674df6a7d7c58 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
parent | 0c3a2faa8505bb4a6d56682b7e63368a246e7ba1 (diff) | |
download | llvm-148708493a80f9d75513f2e3721d043dd5b969a7.zip llvm-148708493a80f9d75513f2e3721d043dd5b969a7.tar.gz llvm-148708493a80f9d75513f2e3721d043dd5b969a7.tar.bz2 |
[NFC] Hoist pseudo probe desc emission code for reuse (#148756)
This PR is part of #123870.
The pseudo probe desc emission code can be reused by other target.
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 5454cd4..7e501a9 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -322,28 +322,7 @@ void TargetLoweringObjectFileELF::emitModuleMetadata(MCStreamer &Streamer, } } - if (NamedMDNode *FuncInfo = M.getNamedMetadata(PseudoProbeDescMetadataName)) { - // Emit a descriptor for every function including functions that have an - // available external linkage. We may not want this for imported functions - // that has code in another thinLTO module but we don't have a good way to - // tell them apart from inline functions defined in header files. Therefore - // we put each descriptor in a separate comdat section and rely on the - // linker to deduplicate. - for (const auto *Operand : FuncInfo->operands()) { - const auto *MD = cast<MDNode>(Operand); - auto *GUID = mdconst::dyn_extract<ConstantInt>(MD->getOperand(0)); - auto *Hash = mdconst::dyn_extract<ConstantInt>(MD->getOperand(1)); - auto *Name = cast<MDString>(MD->getOperand(2)); - auto *S = C.getObjectFileInfo()->getPseudoProbeDescSection( - TM->getFunctionSections() ? Name->getString() : StringRef()); - - Streamer.switchSection(S); - Streamer.emitInt64(GUID->getZExtValue()); - Streamer.emitInt64(Hash->getZExtValue()); - Streamer.emitULEB128IntValue(Name->getString().size()); - Streamer.emitBytes(Name->getString()); - } - } + emitPseudoProbeDescMetadata(Streamer, M); if (NamedMDNode *LLVMStats = M.getNamedMetadata("llvm.stats")) { // Emit the metadata for llvm statistics into .llvm_stats section, which is |