Eugene Zelenko | 2de563a | 2017-08-24 21:21:39 +0000 | [diff] [blame] | 1 | //===- LiveDebugVariables.h - Tracking debug info variables -----*- C++ -*-===// |
Jakob Stoklund Olesen | bb7b23f | 2010-11-30 02:17:10 +0000 | [diff] [blame] | 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. |
| 11 | // |
| 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. |
| 15 | // |
| 16 | // After register allocation new DBG_VALUE instructions are emitted to reflect |
| 17 | // the new locations of user variables. |
| 18 | // |
| 19 | //===----------------------------------------------------------------------===// |
| 20 | |
Benjamin Kramer | 00e08fc | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 21 | #ifndef LLVM_LIB_CODEGEN_LIVEDEBUGVARIABLES_H |
| 22 | #define LLVM_LIB_CODEGEN_LIVEDEBUGVARIABLES_H |
Jakob Stoklund Olesen | bb7b23f | 2010-11-30 02:17:10 +0000 | [diff] [blame] | 23 | |
| 24 | #include "llvm/CodeGen/MachineFunctionPass.h" |
Eugene Zelenko | 2de563a | 2017-08-24 21:21:39 +0000 | [diff] [blame] | 25 | #include "llvm/Support/Compiler.h" |
Jakob Stoklund Olesen | bb7b23f | 2010-11-30 02:17:10 +0000 | [diff] [blame] | 26 | |
| 27 | namespace llvm { |
| 28 | |
Mehdi Amini | f6071e1 | 2016-04-18 09:17:29 +0000 | [diff] [blame] | 29 | template <typename T> class ArrayRef; |
Mark Lacey | 1feb585 | 2013-08-14 23:50:04 +0000 | [diff] [blame] | 30 | class LiveIntervals; |
Jakob Stoklund Olesen | 42acf06 | 2010-12-03 21:47:10 +0000 | [diff] [blame] | 31 | class VirtRegMap; |
| 32 | |
Benjamin Kramer | b453775 | 2015-07-01 14:47:39 +0000 | [diff] [blame] | 33 | class LLVM_LIBRARY_VISIBILITY LiveDebugVariables : public MachineFunctionPass { |
Eugene Zelenko | 2de563a | 2017-08-24 21:21:39 +0000 | [diff] [blame] | 34 | void *pImpl = nullptr; |
Duncan P. N. Exon Smith | 5d801364 | 2015-04-17 23:20:10 +0000 | [diff] [blame] | 35 | |
Jakob Stoklund Olesen | bb7b23f | 2010-11-30 02:17:10 +0000 | [diff] [blame] | 36 | public: |
| 37 | static char ID; // Pass identification, replacement for typeid |
| 38 | |
| 39 | LiveDebugVariables(); |
Alexander Kornienko | c16fc54 | 2015-04-11 02:11:45 +0000 | [diff] [blame] | 40 | ~LiveDebugVariables() override; |
Jakob Stoklund Olesen | bb7b23f | 2010-11-30 02:17:10 +0000 | [diff] [blame] | 41 | |
Jakob Stoklund Olesen | f42b661 | 2011-05-06 18:00:02 +0000 | [diff] [blame] | 42 | /// splitRegister - Move any user variables in OldReg to the live ranges in |
| 43 | /// NewRegs where they are live. Mark the values as unavailable where no new |
| 44 | /// register is live. |
Mark Lacey | 1feb585 | 2013-08-14 23:50:04 +0000 | [diff] [blame] | 45 | void splitRegister(unsigned OldReg, ArrayRef<unsigned> NewRegs, |
| 46 | LiveIntervals &LIS); |
Jakob Stoklund Olesen | f42b661 | 2011-05-06 18:00:02 +0000 | [diff] [blame] | 47 | |
Jakob Stoklund Olesen | bb7b23f | 2010-11-30 02:17:10 +0000 | [diff] [blame] | 48 | /// emitDebugValues - Emit new DBG_VALUE instructions reflecting the changes |
| 49 | /// that happened during register allocation. |
Jakob Stoklund Olesen | 42acf06 | 2010-12-03 21:47:10 +0000 | [diff] [blame] | 50 | /// @param VRM Rename virtual registers according to map. |
| 51 | void emitDebugValues(VirtRegMap *VRM); |
Jakob Stoklund Olesen | bb7b23f | 2010-11-30 02:17:10 +0000 | [diff] [blame] | 52 | |
Jakob Stoklund Olesen | 30e2128 | 2010-12-02 18:15:44 +0000 | [diff] [blame] | 53 | /// dump - Print data structures to dbgs(). |
Sam Clegg | b209206 | 2017-06-21 22:19:17 +0000 | [diff] [blame] | 54 | void dump() const; |
Jakob Stoklund Olesen | 30e2128 | 2010-12-02 18:15:44 +0000 | [diff] [blame] | 55 | |
Jakob Stoklund Olesen | bb7b23f | 2010-11-30 02:17:10 +0000 | [diff] [blame] | 56 | private: |
Craig Topper | 9f998de | 2014-03-07 09:26:03 +0000 | [diff] [blame] | 57 | bool runOnMachineFunction(MachineFunction &) override; |
| 58 | void releaseMemory() override; |
| 59 | void getAnalysisUsage(AnalysisUsage &) const override; |
David Blaikie | e27d5a0 | 2014-07-25 16:10:16 +0000 | [diff] [blame] | 60 | bool doInitialization(Module &) override; |
Jakob Stoklund Olesen | bb7b23f | 2010-11-30 02:17:10 +0000 | [diff] [blame] | 61 | }; |
| 62 | |
Eugene Zelenko | 2de563a | 2017-08-24 21:21:39 +0000 | [diff] [blame] | 63 | } // end namespace llvm |
Jakob Stoklund Olesen | bb7b23f | 2010-11-30 02:17:10 +0000 | [diff] [blame] | 64 | |
Eugene Zelenko | 2de563a | 2017-08-24 21:21:39 +0000 | [diff] [blame] | 65 | #endif // LLVM_LIB_CODEGEN_LIVEDEBUGVARIABLES_H |