eba4fbede2777bd2965c61d8856ece56dff58615
[oota-llvm.git] / lib / CodeGen / LiveDebugVariables.h
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/CodeGen/MachineFunctionPass.h"
25
26 namespace llvm {
27
28 class LiveDebugVariables : public MachineFunctionPass {
29   void *pImpl;
30 public:
31   static char ID; // Pass identification, replacement for typeid
32
33   LiveDebugVariables();
34
35   /// renameRegister - Move any user variables in OldReg to NewReg:SubIdx.
36   /// @param OldReg Old virtual register that is going away.
37   /// @param NewReg New register holding the user variables.
38   /// @param SubIdx If NewReg is a virtual register, SubIdx may indicate a sub-
39   ///               register.
40   void renameRegister(unsigned OldReg, unsigned NewReg, unsigned SubIdx);
41
42   /// emitDebugValues - Emit new DBG_VALUE instructions reflecting the changes
43   /// that happened during register allocation.
44   void emitDebugValues();
45
46 private:
47
48   /// runOnMachineFunction - Analyze and remove DBG_VALUE instructions.
49   virtual bool runOnMachineFunction(MachineFunction &);
50
51   virtual void getAnalysisUsage(AnalysisUsage &) const;
52
53 };
54
55 } // namespace llvm
56
57 #endif // LLVM_CODEGEN_LIVEDEBUGVARIABLES_H