blob: a69b974fe373c61466c7d8fea5d29f818e06162a [file] [log] [blame]
Jakob Stoklund Olesenbb7b23f2010-11-30 02:17:10 +00001//===- 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
26namespace llvm {
27
28class LiveDebugVariables : public MachineFunctionPass {
29 void *pImpl;
30public:
31 static char ID; // Pass identification, replacement for typeid
32
33 LiveDebugVariables();
Jakob Stoklund Olesen06135162010-12-02 00:37:37 +000034 ~LiveDebugVariables();
Jakob Stoklund Olesenbb7b23f2010-11-30 02:17:10 +000035
36 /// renameRegister - Move any user variables in OldReg to NewReg:SubIdx.
37 /// @param OldReg Old virtual register that is going away.
38 /// @param NewReg New register holding the user variables.
39 /// @param SubIdx If NewReg is a virtual register, SubIdx may indicate a sub-
40 /// register.
41 void renameRegister(unsigned OldReg, unsigned NewReg, unsigned SubIdx);
42
43 /// emitDebugValues - Emit new DBG_VALUE instructions reflecting the changes
44 /// that happened during register allocation.
45 void emitDebugValues();
46
Jakob Stoklund Olesen30e21282010-12-02 18:15:44 +000047 /// dump - Print data structures to dbgs().
48 void dump();
49
Jakob Stoklund Olesenbb7b23f2010-11-30 02:17:10 +000050private:
51
Jakob Stoklund Olesenbb7b23f2010-11-30 02:17:10 +000052 virtual bool runOnMachineFunction(MachineFunction &);
Jakob Stoklund Olesen06135162010-12-02 00:37:37 +000053 virtual void releaseMemory();
Jakob Stoklund Olesenbb7b23f2010-11-30 02:17:10 +000054 virtual void getAnalysisUsage(AnalysisUsage &) const;
55
56};
57
58} // namespace llvm
59
60#endif // LLVM_CODEGEN_LIVEDEBUGVARIABLES_H