aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2024-01-11 18:29:01 +0000
committerDimitry Andric <dim@FreeBSD.org>2024-04-19 21:24:43 +0000
commit52e4ee64c25fe0837e9cf783a63e8c214b3180cf (patch)
treeef0a98fe51363441060377330e2e714855102bf6 /contrib/llvm-project/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
parented89c59104c13195cbbad881f64c6a71f687c1e4 (diff)
Diffstat (limited to 'contrib/llvm-project/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp b/contrib/llvm-project/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
index ad3ad9928987..eb372655e5f1 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
@@ -1,3 +1,11 @@
+//===-- AssignmentTrackingAnalysis.cpp ------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
#include "llvm/CodeGen/AssignmentTrackingAnalysis.h"
#include "LiveDebugValues/LiveDebugValues.h"
#include "llvm/ADT/BitVector.h"
@@ -2553,6 +2561,32 @@ static void analyzeFunction(Function &Fn, const DataLayout &Layout,
}
}
+FunctionVarLocs
+DebugAssignmentTrackingAnalysis::run(Function &F,
+ FunctionAnalysisManager &FAM) {
+ if (!isAssignmentTrackingEnabled(*F.getParent()))
+ return FunctionVarLocs();
+
+ auto &DL = F.getParent()->getDataLayout();
+
+ FunctionVarLocsBuilder Builder;
+ analyzeFunction(F, DL, &Builder);
+
+ // Save these results.
+ FunctionVarLocs Results;
+ Results.init(Builder);
+ return Results;
+}
+
+AnalysisKey DebugAssignmentTrackingAnalysis::Key;
+
+PreservedAnalyses
+DebugAssignmentTrackingPrinterPass::run(Function &F,
+ FunctionAnalysisManager &FAM) {
+ FAM.getResult<DebugAssignmentTrackingAnalysis>(F).print(OS, F);
+ return PreservedAnalyses::all();
+}
+
bool AssignmentTrackingAnalysis::runOnFunction(Function &F) {
if (!isAssignmentTrackingEnabled(*F.getParent()))
return false;