[llvm] [Analysis] Add DebugInfoCache analysis (PR #118629)
Felipe de Azevedo Piovezan via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 28 18:56:56 PST 2025
================
@@ -0,0 +1,50 @@
+//===- llvm/Analysis/DebugInfoCache.h - debug info cache --------*- C++ -*-===//
+//
+// 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 contains an analysis that builds a cache of debug info for each
+// DICompileUnit in a module.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_ANALYSIS_DEBUGINFOCACHE_H
+#define LLVM_ANALYSIS_DEBUGINFOCACHE_H
+
+#include "llvm/IR/DebugInfo.h"
+#include "llvm/IR/PassManager.h"
+
+namespace llvm {
+
+/// Processes and caches debug info for each DICompileUnit in a module.
+///
+/// The result of the analysis is a set of DebugInfoFinders primed on their
+/// respective DICompileUnit. Such DebugInfoFinders can be used to speed up
+/// function cloning which otherwise requires an expensive traversal of
+/// DICompileUnit-level debug info. See an example usage in CoroSplit.
+class DebugInfoCache {
+public:
+ using DIFinderCache = SmallDenseMap<const DICompileUnit *, DebugInfoFinder>;
----------------
felipepiovezan wrote:
I know we (llvm) don't have a policy for type aliases like this, but it's unclear why this particular one needs to exist. It obfuscates the type without telling us what this type does (i.e. it doesn't tell us this is a map of CU to DebugInfoFinder)
https://github.com/llvm/llvm-project/pull/118629
More information about the llvm-commits
mailing list