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:14:12 +0000
commit6c20abcd5625af907434441af2abcf626ab4c18b (patch)
tree80fbbbf84bb7b395c908cb983c56c8a4b48b3210 /contrib/llvm-project/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
parentcdc20ff6a7f12464aed70d9b6e67ea07da9f0399 (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;