LLVM 20.0.0git
LiveDebugVariables.h
Go to the documentation of this file.
1//===- LiveDebugVariables.h - Tracking debug info variables -----*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file provides the interface to the LiveDebugVariables analysis.
10//
11// The analysis removes DBG_VALUE instructions for virtual registers and tracks
12// live user variables in a data structure that can be updated during register
13// allocation.
14//
15// After register allocation new DBG_VALUE instructions are emitted to reflect
16// the new locations of user variables.
17//
18//===----------------------------------------------------------------------===//
19
20#ifndef LLVM_CODEGEN_LIVEDEBUGVARIABLES_H
21#define LLVM_CODEGEN_LIVEDEBUGVARIABLES_H
22
24#include "llvm/IR/PassManager.h"
27#include <memory>
28
29namespace llvm {
30
31template <typename T> class ArrayRef;
32class LiveIntervals;
33class VirtRegMap;
34
36
37public:
38 class LDVImpl;
42
44 /// splitRegister - Move any user variables in OldReg to the live ranges in
45 /// NewRegs where they are live. Mark the values as unavailable where no new
46 /// register is live.
47 void splitRegister(Register OldReg, ArrayRef<Register> NewRegs,
48 LiveIntervals &LIS);
49
50 /// emitDebugValues - Emit new DBG_VALUE instructions reflecting the changes
51 /// that happened during register allocation.
52 /// @param VRM Rename virtual registers according to map.
53 void emitDebugValues(VirtRegMap *VRM);
54
55#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
56 /// dump - Print data structures to dbgs().
57 void dump() const;
58#endif
59
60 void print(raw_ostream &OS) const;
61
62 void releaseMemory();
63
66
67private:
68 std::unique_ptr<LDVImpl> PImpl;
69};
70
72 std::unique_ptr<LiveDebugVariables> Impl;
73
74public:
75 static char ID; // Pass identification, replacement for typeid
76
78
80
81 LiveDebugVariables &getLDV() { return *Impl; }
82 const LiveDebugVariables &getLDV() const { return *Impl; }
83
84 void releaseMemory() override {
85 if (Impl)
86 Impl->releaseMemory();
87 }
88 void getAnalysisUsage(AnalysisUsage &) const override;
89
93 }
94};
95
97 : public AnalysisInfoMixin<LiveDebugVariablesAnalysis> {
99 static AnalysisKey Key;
100
101public:
103
107 }
108
110};
111
113 : public PassInfoMixin<LiveDebugVariablesPrinterPass> {
114 raw_ostream &OS;
115
116public:
118
121};
122} // end namespace llvm
123
124#endif // LLVM_CODEGEN_LIVEDEBUGVARIABLES_H
This header defines various interfaces for pass management in LLVM.
raw_pwrite_stream & OS
API to communicate dependencies between analyses during invalidation.
Definition: PassManager.h:292
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:253
Represent the analysis usage information of a pass.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
MachineFunctionProperties getSetProperties() const
Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
const LiveDebugVariables & getLDV() const
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
MachineFunctionProperties getSetProperties() const override
bool runOnMachineFunction(MachineFunction &) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
void getAnalysisUsage(AnalysisUsage &) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
void dump() const
dump - Print data structures to dbgs().
void splitRegister(Register OldReg, ArrayRef< Register > NewRegs, LiveIntervals &LIS)
splitRegister - Move any user variables in OldReg to the live ranges in NewRegs where they are live.
LiveDebugVariables()
Implementation of the LiveDebugVariables pass.
void print(raw_ostream &OS) const
void analyze(MachineFunction &MF, LiveIntervals *LIS)
LiveDebugVariables(LiveDebugVariables &&)
void emitDebugValues(VirtRegMap *VRM)
emitDebugValues - Emit new DBG_VALUE instructions reflecting the changes that happened during registe...
bool invalidate(MachineFunction &MF, const PreservedAnalyses &PA, MachineFunctionAnalysisManager::Invalidator &Inv)
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
Properties which a MachineFunction may have at a given point in time.
MachineFunctionProperties & set(Property P)
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:111
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
ArrayRef(const T &OneElt) -> ArrayRef< T >
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:92
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: Analysis.h:28
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:69