LLVM  6.0.0svn
Classes | Macros | Typedefs | Enumerations | Functions | Variables
LiveDebugVariables.cpp File Reference
#include "LiveDebugVariables.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/IntervalMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/CodeGen/LexicalScopes.h"
#include "llvm/CodeGen/LiveInterval.h"
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/SlotIndexes.h"
#include "llvm/CodeGen/VirtRegMap.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Metadata.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/Pass.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetOpcodes.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetSubtargetInfo.h"
#include <algorithm>
#include <cassert>
#include <iterator>
#include <memory>
#include <utility>
Include dependency graph for LiveDebugVariables.cpp:

Go to the source code of this file.

Classes

class  DbgValueLocation
 Describes a location by number along with some flags about the original usage of the location. More...
 

Macros

#define DEBUG_TYPE   "livedebugvars"
 

Typedefs

using LocMap = IntervalMap< SlotIndex, DbgValueLocation, 4 >
 LocMap - Map of where a user value is live, and its location. More...
 

Enumerations

enum  : unsigned { UndefLocNo = ~0U }
 

Functions

 STATISTIC (NumInsertedDebugValues, "Number of DBG_VALUEs inserted")
 
 INITIALIZE_PASS_BEGIN (LiveDebugVariables, DEBUG_TYPE, "Debug Variable Analysis", false, false) INITIALIZE_PASS_END(LiveDebugVariables
 
static void printDebugLoc (const DebugLoc &DL, raw_ostream &CommentOS, const LLVMContext &Ctx)
 
static void printExtendedName (raw_ostream &OS, const DILocalVariable *V, const DILocation *DL)
 
static void removeDebugValues (MachineFunction &mf)
 
static MachineBasicBlock::iterator findInsertLocation (MachineBasicBlock *MBB, SlotIndex Idx, LiveIntervals &LIS)
 Find an iterator for inserting a DBG_VALUE instruction. More...
 
static MachineBasicBlock::iterator findNextInsertLocation (MachineBasicBlock *MBB, MachineBasicBlock::iterator I, SlotIndex StopIdx, MachineOperand &LocMO, LiveIntervals &LIS, const TargetRegisterInfo &TRI)
 Find an iterator for inserting the next DBG_VALUE instruction (or end if no more insert locations found). More...
 

Variables

static cl::opt< boolEnableLDV ("live-debug-variables", cl::init(true), cl::desc("Enable the live debug variables pass"), cl::Hidden)
 
 DEBUG_TYPE
 
Debug Variable Analysis
 
Debug Variable false
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "livedebugvars"

Definition at line 66 of file LiveDebugVariables.cpp.

Typedef Documentation

◆ LocMap

LocMap - Map of where a user value is live, and its location.

Definition at line 135 of file LiveDebugVariables.cpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum : unsigned
Enumerator
UndefLocNo 

Definition at line 94 of file LiveDebugVariables.cpp.

Function Documentation

◆ findInsertLocation()

static MachineBasicBlock::iterator findInsertLocation ( MachineBasicBlock MBB,
SlotIndex  Idx,
LiveIntervals LIS 
)
static

◆ findNextInsertLocation()

static MachineBasicBlock::iterator findNextInsertLocation ( MachineBasicBlock MBB,
MachineBasicBlock::iterator  I,
SlotIndex  StopIdx,
MachineOperand LocMO,
LiveIntervals LIS,
const TargetRegisterInfo TRI 
)
static

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( LiveDebugVariables  ,
DEBUG_TYPE  ,
"Debug Variable Analysis ,
false  ,
false   
)

◆ printDebugLoc()

static void printDebugLoc ( const DebugLoc DL,
raw_ostream CommentOS,
const LLVMContext Ctx 
)
static

◆ printExtendedName()

static void printExtendedName ( raw_ostream OS,
const DILocalVariable V,
const DILocation DL 
)
static

Definition at line 423 of file LiveDebugVariables.cpp.

References llvm::IntervalMap< KeyT, ValT, N, Traits >::const_iterator::advanceTo(), assert(), llvm::MachineBasicBlock::begin(), llvm::MachineFunction::begin(), clear(), collectDebugValues(), llvm::dbgs(), DEBUG, llvm::VNInfo::def, llvm::SmallVectorBase::empty(), llvm::StringRef::empty(), llvm::MachineBasicBlock::end(), llvm::MachineFunction::end(), llvm::MachineBasicBlock::erase(), llvm::LexicalScopes::findLexicalScope(), llvm::MDNode::getContext(), llvm::MachineInstr::getDebugExpression(), llvm::MachineInstr::getDebugLoc(), llvm::MachineInstr::getDebugVariable(), llvm::MachineOperand::getImm(), llvm::LiveIntervals::getInstructionFromIndex(), llvm::LiveIntervals::getInstructionIndex(), llvm::LiveIntervals::getInterval(), llvm::DIVariable::getLine(), llvm::LiveIntervals::getMBBEndIdx(), llvm::LiveIntervals::getMBBFromIndex(), llvm::MachineFunction::getName(), llvm::DIVariable::getName(), llvm::SlotIndex::getNextIndex(), llvm::SlotIndex::getNextSlot(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineInstr::getParent(), llvm::LexicalScope::getRanges(), llvm::MachineOperand::getReg(), getReg(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::SlotIndex::getRegSlot(), llvm::LiveRange::getSegmentContaining(), llvm::MachineFunction::getSubtarget(), llvm::LiveRange::getVNInfoAt(), llvm::LiveIntervals::hasInterval(), I, llvm::VNInfo::id, llvm::LexicalScopes::initialize(), llvm::IntervalMap< KeyT, ValT, N, Traits >::iterator::insert(), llvm::MachineInstr::isCopy(), llvm::MachineOperand::isImm(), llvm::MachineOperand::isMetadata(), isReg(), llvm::MachineOperand::isReg(), llvm::TargetRegisterInfo::isVirtualRegister(), DbgValueLocation::locNo(), llvm::AArch64CC::LS, MI, MRI, pass, llvm::Pass::print(), printDebugLoc(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::LiveInterval::reg, llvm::IntervalMap< KeyT, ValT, N, Traits >::iterator::setStartUnchecked(), llvm::IntervalMap< KeyT, ValT, N, Traits >::iterator::setStopUnchecked(), llvm::SmallVectorTemplateCommon< T >::size(), llvm::IntervalMap< KeyT, ValT, N, Traits >::const_iterator::start(), llvm::IntervalMap< KeyT, ValT, N, Traits >::const_iterator::stop(), llvm::MachineRegisterInfo::use_nodbg_operands(), llvm::IntervalMap< KeyT, ValT, N, Traits >::const_iterator::valid(), llvm::IntervalMap< KeyT, ValT, N, Traits >::const_iterator::value(), and DbgValueLocation::wasIndirect().

◆ removeDebugValues()

static void removeDebugValues ( MachineFunction mf)
static

◆ STATISTIC()

STATISTIC ( NumInsertedDebugValues  ,
"Number of DBG_VALUEs inserted"   
)

Variable Documentation

◆ Analysis

Debug Variable Analysis

Definition at line 80 of file LiveDebugVariables.cpp.

◆ DEBUG_TYPE

DEBUG_TYPE

Definition at line 80 of file LiveDebugVariables.cpp.

◆ EnableLDV

cl::opt<bool> EnableLDV("live-debug-variables", cl::init(true), cl::desc("Enable the live debug variables pass"), cl::Hidden)
static

Referenced by removeDebugValues().

◆ false

Debug Variable false

Definition at line 80 of file LiveDebugVariables.cpp.