LLVM API Documentation

LiveDebugVariables.h
Go to the documentation of this file.
00001 //===- LiveDebugVariables.h - Tracking debug info variables ----*- c++ -*--===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file provides the interface to the LiveDebugVariables analysis.
00011 //
00012 // The analysis removes DBG_VALUE instructions for virtual registers and tracks
00013 // live user variables in a data structure that can be updated during register
00014 // allocation.
00015 //
00016 // After register allocation new DBG_VALUE instructions are emitted to reflect
00017 // the new locations of user variables.
00018 //
00019 //===----------------------------------------------------------------------===//
00020 
00021 #ifndef LLVM_LIB_CODEGEN_LIVEDEBUGVARIABLES_H
00022 #define LLVM_LIB_CODEGEN_LIVEDEBUGVARIABLES_H
00023 
00024 #include "llvm/ADT/ArrayRef.h"
00025 #include "llvm/IR/DebugInfo.h"
00026 #include "llvm/CodeGen/MachineFunctionPass.h"
00027 
00028 namespace llvm {
00029 
00030 class LiveInterval;
00031 class LiveIntervals;
00032 class VirtRegMap;
00033 
00034 class LiveDebugVariables : public MachineFunctionPass {
00035   void *pImpl;
00036   DenseMap<const Function*, DISubprogram> FunctionDIs;
00037 public:
00038   static char ID; // Pass identification, replacement for typeid
00039 
00040   LiveDebugVariables();
00041   ~LiveDebugVariables();
00042 
00043   /// renameRegister - Move any user variables in OldReg to NewReg:SubIdx.
00044   /// @param OldReg Old virtual register that is going away.
00045   /// @param NewReg New register holding the user variables.
00046   /// @param SubIdx If NewReg is a virtual register, SubIdx may indicate a sub-
00047   ///               register.
00048   void renameRegister(unsigned OldReg, unsigned NewReg, unsigned SubIdx);
00049 
00050   /// splitRegister - Move any user variables in OldReg to the live ranges in
00051   /// NewRegs where they are live. Mark the values as unavailable where no new
00052   /// register is live.
00053   void splitRegister(unsigned OldReg, ArrayRef<unsigned> NewRegs,
00054                      LiveIntervals &LIS);
00055 
00056   /// emitDebugValues - Emit new DBG_VALUE instructions reflecting the changes
00057   /// that happened during register allocation.
00058   /// @param VRM Rename virtual registers according to map.
00059   void emitDebugValues(VirtRegMap *VRM);
00060 
00061   /// dump - Print data structures to dbgs().
00062   void dump();
00063 
00064 private:
00065 
00066   bool runOnMachineFunction(MachineFunction &) override;
00067   void releaseMemory() override;
00068   void getAnalysisUsage(AnalysisUsage &) const override;
00069   bool doInitialization(Module &) override;
00070 
00071 };
00072 
00073 } // namespace llvm
00074 
00075 #endif