Jakob Stoklund Olesen | bb7b23f | 2010-11-30 02:17:10 +0000 | [diff] [blame] | 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. |
| 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 | |
| 21 | #ifndef LLVM_CODEGEN_LIVEDEBUGVARIABLES_H |
| 22 | #define LLVM_CODEGEN_LIVEDEBUGVARIABLES_H |
| 23 | |
Jakob Stoklund Olesen | f42b661 | 2011-05-06 18:00:02 +0000 | [diff] [blame] | 24 | #include "llvm/ADT/ArrayRef.h" |
Jakob Stoklund Olesen | bb7b23f | 2010-11-30 02:17:10 +0000 | [diff] [blame] | 25 | #include "llvm/CodeGen/MachineFunctionPass.h" |
| 26 | |
| 27 | namespace llvm { |
| 28 | |
Jakob Stoklund Olesen | f42b661 | 2011-05-06 18:00:02 +0000 | [diff] [blame] | 29 | class LiveInterval; |
Jakob Stoklund Olesen | 42acf06 | 2010-12-03 21:47:10 +0000 | [diff] [blame] | 30 | class VirtRegMap; |
| 31 | |
Jakob Stoklund Olesen | bb7b23f | 2010-11-30 02:17:10 +0000 | [diff] [blame] | 32 | class LiveDebugVariables : public MachineFunctionPass { |
| 33 | void *pImpl; |
| 34 | public: |
| 35 | static char ID; // Pass identification, replacement for typeid |
| 36 | |
| 37 | LiveDebugVariables(); |
Jakob Stoklund Olesen | 0613516 | 2010-12-02 00:37:37 +0000 | [diff] [blame] | 38 | ~LiveDebugVariables(); |
Jakob Stoklund Olesen | bb7b23f | 2010-11-30 02:17:10 +0000 | [diff] [blame] | 39 | |
| 40 | /// renameRegister - Move any user variables in OldReg to NewReg:SubIdx. |
| 41 | /// @param OldReg Old virtual register that is going away. |
| 42 | /// @param NewReg New register holding the user variables. |
| 43 | /// @param SubIdx If NewReg is a virtual register, SubIdx may indicate a sub- |
| 44 | /// register. |
| 45 | void renameRegister(unsigned OldReg, unsigned NewReg, unsigned SubIdx); |
| 46 | |
Jakob Stoklund Olesen | f42b661 | 2011-05-06 18:00:02 +0000 | [diff] [blame] | 47 | /// splitRegister - Move any user variables in OldReg to the live ranges in |
| 48 | /// NewRegs where they are live. Mark the values as unavailable where no new |
| 49 | /// register is live. |
| 50 | void splitRegister(unsigned OldReg, ArrayRef<LiveInterval*> NewRegs); |
| 51 | |
Jakob Stoklund Olesen | bb7b23f | 2010-11-30 02:17:10 +0000 | [diff] [blame] | 52 | /// emitDebugValues - Emit new DBG_VALUE instructions reflecting the changes |
| 53 | /// that happened during register allocation. |
Jakob Stoklund Olesen | 42acf06 | 2010-12-03 21:47:10 +0000 | [diff] [blame] | 54 | /// @param VRM Rename virtual registers according to map. |
| 55 | void emitDebugValues(VirtRegMap *VRM); |
Jakob Stoklund Olesen | bb7b23f | 2010-11-30 02:17:10 +0000 | [diff] [blame] | 56 | |
Jakob Stoklund Olesen | 30e2128 | 2010-12-02 18:15:44 +0000 | [diff] [blame] | 57 | /// dump - Print data structures to dbgs(). |
| 58 | void dump(); |
| 59 | |
Jakob Stoklund Olesen | bb7b23f | 2010-11-30 02:17:10 +0000 | [diff] [blame] | 60 | private: |
| 61 | |
Jakob Stoklund Olesen | bb7b23f | 2010-11-30 02:17:10 +0000 | [diff] [blame] | 62 | virtual bool runOnMachineFunction(MachineFunction &); |
Jakob Stoklund Olesen | 0613516 | 2010-12-02 00:37:37 +0000 | [diff] [blame] | 63 | virtual void releaseMemory(); |
Jakob Stoklund Olesen | bb7b23f | 2010-11-30 02:17:10 +0000 | [diff] [blame] | 64 | virtual void getAnalysisUsage(AnalysisUsage &) const; |
| 65 | |
| 66 | }; |
| 67 | |
| 68 | } // namespace llvm |
| 69 | |
| 70 | #endif // LLVM_CODEGEN_LIVEDEBUGVARIABLES_H |