2
0

LiveDebugVariables.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. #ifndef LLVM_LIB_CODEGEN_LIVEDEBUGVARIABLES_H
  21. #define LLVM_LIB_CODEGEN_LIVEDEBUGVARIABLES_H
  22. #include "llvm/ADT/ArrayRef.h"
  23. #include "llvm/CodeGen/MachineFunctionPass.h"
  24. #include "llvm/IR/DebugInfo.h"
  25. namespace llvm {
  26. class LiveInterval;
  27. class LiveIntervals;
  28. class VirtRegMap;
  29. class LLVM_LIBRARY_VISIBILITY LiveDebugVariables : public MachineFunctionPass {
  30. void *pImpl;
  31. DenseMap<const Function *, DISubprogram *> FunctionDIs;
  32. public:
  33. static char ID; // Pass identification, replacement for typeid
  34. LiveDebugVariables();
  35. ~LiveDebugVariables() override;
  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. /// splitRegister - Move any user variables in OldReg to the live ranges in
  43. /// NewRegs where they are live. Mark the values as unavailable where no new
  44. /// register is live.
  45. void splitRegister(unsigned OldReg, ArrayRef<unsigned> NewRegs,
  46. LiveIntervals &LIS);
  47. /// emitDebugValues - Emit new DBG_VALUE instructions reflecting the changes
  48. /// that happened during register allocation.
  49. /// @param VRM Rename virtual registers according to map.
  50. void emitDebugValues(VirtRegMap *VRM);
  51. /// dump - Print data structures to dbgs().
  52. void dump();
  53. private:
  54. bool runOnMachineFunction(MachineFunction &) override;
  55. void releaseMemory() override;
  56. void getAnalysisUsage(AnalysisUsage &) const override;
  57. bool doInitialization(Module &) override;
  58. };
  59. } // namespace llvm
  60. #endif