LiveDebugVariables.h revision 30e2128a731e5a0bcac45a6a79a03bdedce68a0a
1378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby//===- LiveDebugVariables.h - Tracking debug info variables ----*- c++ -*--===//
2378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby//
3378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby//                     The LLVM Compiler Infrastructure
4378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby//
5378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby// This file is distributed under the University of Illinois Open Source
6378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby// License. See LICENSE.TXT for details.
7378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby//
8378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby//===----------------------------------------------------------------------===//
9378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby//
10378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby// This file provides the interface to the LiveDebugVariables analysis.
11378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby//
12378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby// The analysis removes DBG_VALUE instructions for virtual registers and tracks
13378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby// live user variables in a data structure that can be updated during register
14378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby// allocation.
15378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby//
16378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby// After register allocation new DBG_VALUE instructions are emitted to reflect
17378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby// the new locations of user variables.
18378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby//
19378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby//===----------------------------------------------------------------------===//
20378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby
21378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby#ifndef LLVM_CODEGEN_LIVEDEBUGVARIABLES_H
22378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby#define LLVM_CODEGEN_LIVEDEBUGVARIABLES_H
23378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby
24378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby#include "llvm/CodeGen/MachineFunctionPass.h"
25378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby
26378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosbynamespace llvm {
27378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby
28378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosbyclass LiveDebugVariables : public MachineFunctionPass {
29378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby  void *pImpl;
30378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosbypublic:
31378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby  static char ID; // Pass identification, replacement for typeid
32378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby
33378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby  LiveDebugVariables();
34378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby  ~LiveDebugVariables();
35378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby
36378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby  /// renameRegister - Move any user variables in OldReg to NewReg:SubIdx.
37752c1df73949438ef6fa86a86363ee7091aa2532John Mosby  /// @param OldReg Old virtual register that is going away.
38378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby  /// @param NewReg New register holding the user variables.
39378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby  /// @param SubIdx If NewReg is a virtual register, SubIdx may indicate a sub-
40378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby  ///               register.
41378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby  void renameRegister(unsigned OldReg, unsigned NewReg, unsigned SubIdx);
42378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby
43378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby  /// emitDebugValues - Emit new DBG_VALUE instructions reflecting the changes
44378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby  /// that happened during register allocation.
45378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby  void emitDebugValues();
46378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby
47378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby  /// dump - Print data structures to dbgs().
48378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby  void dump();
49378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby
50378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosbyprivate:
51378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby
52378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby  virtual bool runOnMachineFunction(MachineFunction &);
53378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby  virtual void releaseMemory();
54378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby  virtual void getAnalysisUsage(AnalysisUsage &) const;
55378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby
56378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby};
57378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby
58378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby} // namespace llvm
59378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby
60378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby#endif // LLVM_CODEGEN_LIVEDEBUGVARIABLES_H
61378553cb079aba2b8dee5d52b5166316d4132d5aJohn Mosby