LLVM  8.0.1
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/LiveIntervals.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/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetOpcodes.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/CodeGen/VirtRegMap.h"
#include "llvm/Config/llvm-config.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 <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 >
 Map of where a user value is live, and its location. More...
 
using SpillOffsetMap = DenseMap< unsigned, unsigned >
 Map of stack slot offsets for spilled locations. 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 67 of file LiveDebugVariables.cpp.

Typedef Documentation

◆ LocMap

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

Definition at line 136 of file LiveDebugVariables.cpp.

◆ SpillOffsetMap

Map of stack slot offsets for spilled locations.

Non-spilled locations are not added to the map.

Definition at line 140 of file LiveDebugVariables.cpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum : unsigned
Enumerator
UndefLocNo 

Definition at line 95 of file LiveDebugVariables.cpp.

Function Documentation

◆ findInsertLocation()

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

Find an iterator for inserting a DBG_VALUE instruction.

Definition at line 1155 of file LiveDebugVariables.cpp.

Referenced by findNextInsertLocation().

◆ 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

◆ removeDebugValues()

static void removeDebugValues ( MachineFunction mf)
static

◆ STATISTIC()

STATISTIC ( NumInsertedDebugValues  ,
"Number of DBG_VALUEs inserted"   
)

Variable Documentation

◆ Analysis

Debug Variable Analysis

Definition at line 81 of file LiveDebugVariables.cpp.

◆ DEBUG_TYPE

DEBUG_TYPE

Definition at line 81 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 81 of file LiveDebugVariables.cpp.