[llvm-exegesis] Fix missing std::move.
[llvm-complete.git] / lib / CodeGen / LiveDebugVariables.h
blobaa35880b063a7e90c9c3e3ed2fa9711b07dfeb93
1 //===- LiveDebugVariables.h - Tracking debug info variables -----*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file provides the interface to the LiveDebugVariables analysis.
12 // The analysis removes DBG_VALUE instructions for virtual registers and tracks
13 // live user variables in a data structure that can be updated during register
14 // allocation.
16 // After register allocation new DBG_VALUE instructions are emitted to reflect
17 // the new locations of user variables.
19 //===----------------------------------------------------------------------===//
21 #ifndef LLVM_LIB_CODEGEN_LIVEDEBUGVARIABLES_H
22 #define LLVM_LIB_CODEGEN_LIVEDEBUGVARIABLES_H
24 #include "llvm/CodeGen/MachineFunctionPass.h"
25 #include "llvm/Support/Compiler.h"
27 namespace llvm {
29 template <typename T> class ArrayRef;
30 class LiveIntervals;
31 class VirtRegMap;
33 class LLVM_LIBRARY_VISIBILITY LiveDebugVariables : public MachineFunctionPass {
34 void *pImpl = nullptr;
36 public:
37 static char ID; // Pass identification, replacement for typeid
39 LiveDebugVariables();
40 ~LiveDebugVariables() override;
42 /// renameRegister - Move any user variables in OldReg to NewReg:SubIdx.
43 /// @param OldReg Old virtual register that is going away.
44 /// @param NewReg New register holding the user variables.
45 /// @param SubIdx If NewReg is a virtual register, SubIdx may indicate a sub-
46 /// register.
47 void renameRegister(unsigned OldReg, unsigned NewReg, unsigned SubIdx);
49 /// splitRegister - Move any user variables in OldReg to the live ranges in
50 /// NewRegs where they are live. Mark the values as unavailable where no new
51 /// register is live.
52 void splitRegister(unsigned OldReg, ArrayRef<unsigned> NewRegs,
53 LiveIntervals &LIS);
55 /// emitDebugValues - Emit new DBG_VALUE instructions reflecting the changes
56 /// that happened during register allocation.
57 /// @param VRM Rename virtual registers according to map.
58 void emitDebugValues(VirtRegMap *VRM);
60 /// dump - Print data structures to dbgs().
61 void dump() const;
63 private:
64 bool runOnMachineFunction(MachineFunction &) override;
65 void releaseMemory() override;
66 void getAnalysisUsage(AnalysisUsage &) const override;
67 bool doInitialization(Module &) override;
70 } // end namespace llvm
72 #endif // LLVM_LIB_CODEGEN_LIVEDEBUGVARIABLES_H