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