1 //===- LiveDebugVariables.cpp - Tracking debug info variables -------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements the LiveDebugVariables analysis.
12 // Remove all DBG_VALUE instructions referencing virtual registers and replace
13 // them with a data structure tracking where live user variables are kept - in a
14 // virtual register or in a stack slot.
16 // Allow the data structure to be updated during register allocation when values
17 // are moved between registers and stack slots. Finally emit new DBG_VALUE
18 // instructions after register allocation is complete.
20 //===----------------------------------------------------------------------===//
22 #include "LiveDebugVariables.h"
23 #include "llvm/CodeGen/LiveIntervalAnalysis.h"
24 #include "llvm/CodeGen/MachineFunction.h"
25 #include "llvm/CodeGen/Passes.h"
26 #include "llvm/Target/TargetMachine.h"
30 char LiveDebugVariables::ID = 0;
32 INITIALIZE_PASS_BEGIN(LiveDebugVariables, "livedebugvars",
33 "Debug Variable Analysis", false, false)
34 INITIALIZE_PASS_DEPENDENCY(LiveIntervals)
35 INITIALIZE_PASS_END(LiveDebugVariables, "livedebugvars",
36 "Debug Variable Analysis", false, false)
38 void LiveDebugVariables::getAnalysisUsage(AnalysisUsage &AU) const {
39 AU.addRequiredTransitive<LiveIntervals>();
41 MachineFunctionPass::getAnalysisUsage(AU);
44 LiveDebugVariables::LiveDebugVariables() : MachineFunctionPass(ID) {
45 initializeLiveDebugVariablesPass(*PassRegistry::getPassRegistry());
48 bool LiveDebugVariables::runOnMachineFunction(MachineFunction &mf) {