28 #define DEBUG_TYPE "dwarfdebug" 46 switch (
Op->getOp()) {
47 case dwarf::DW_OP_constu: {
51 switch (
Op->getOp()) {
52 case dwarf::DW_OP_minus:
55 case dwarf::DW_OP_plus:
63 case dwarf::DW_OP_plus_uconst:
64 Offset +=
Op->getArg(0);
69 case dwarf::DW_OP_deref:
97 while (!WorkList.
empty()) {
101 if (!Children.
empty())
108 assert(R.first &&
"InsnRange does not have first instruction!");
109 assert(R.second &&
"InsnRange does not have second instruction!");
119 assert(Label &&
"Didn't insert label before instruction");
137 assert(AfterInsn &&
"Expected label after instruction");
153 if (Tag != dwarf::DW_TAG_member && Tag != dwarf::DW_TAG_typedef &&
154 Tag != dwarf::DW_TAG_const_type && Tag != dwarf::DW_TAG_volatile_type &&
155 Tag != dwarf::DW_TAG_restrict_type && Tag != dwarf::DW_TAG_atomic_type)
166 if (BaseType->
getTag() == dwarf::DW_TAG_reference_type ||
167 BaseType->
getTag() == dwarf::DW_TAG_rvalue_reference_type)
181 auto EK =
SP->getUnit()->getEmissionKind();
215 const auto &Ranges =
I.second;
221 const DILocalVariable *DIVar = Ranges.front().first->getDebugVariable();
225 if (Ranges.front().first->getDebugExpression()->isFragment()) {
227 for (
auto I = Ranges.begin();
I != Ranges.end(); ++
I) {
228 const DIExpression *Fragment =
I->first->getDebugExpression();
232 Pred.first->getDebugExpression());
241 for (
const auto &Range : Ranges) {
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
bool hasDebugInfo() const
Returns true if valid debug info is present.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
This class represents lattice values for constants.
bool isAbstractScope() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
MCContext & OutContext
This is the context for the output file that we are streaming.
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
void push_back(const T &Elt)
unsigned getReg() const
getReg - Returns the register number.
SmallVectorImpl< InsnRange > & getRanges()
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
MachineFunction * MF
The current machine function.
bool isMetaInstruction() const
Return true if this instruction doesn't produce any output in the form of executable instructions...
LexicalScope - This class is used to track scope information.
const MachineInstr * CurMI
If nonnull, stores the current machine instruction we're processing.
void calculateDbgEntityHistory(const MachineFunction *MF, const TargetRegisterInfo *TRI, DbgValueHistoryMap &DbgValues, DbgLabelInstrMap &DbgLabels)
DebugLoc PrevInstLoc
Previous instruction's location information.
DbgLabelInstrMap DbgLabels
Mapping of inlined labels and DBG_LABEL machine instruction.
const MCExpr * getFunctionLocalOffsetAfterInsn(const MachineInstr *MI)
Return the function-local offset of an instruction.
SmallVectorImpl< LexicalScope * > & getChildren()
DbgValueHistoryMap DbgValues
History of DBG_VALUE and clobber instructions for each user variable.
expr_op_iterator expr_op_begin() const
Visit the elements via ExprOperand wrappers.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Base class for the full range of assembler expressions which are needed for parsing.
void beginFunction(const MachineFunction *MF) override
Gather pre-function debug information.
Only used in LLVM metadata.
uint64_t getSizeInBits() const
Holds a subclass of DINode.
DISubprogram * getDISubprogram(const MDNode *Scope)
Find subprogram that is enclosing this scope.
Context object for machine code objects.
DebugHandlerBase(AsmPrinter *A)
expr_op_iterator expr_op_end() const
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
MCSymbol * getFunctionBegin() const
void identifyScopeMarkers()
Indentify instructions that are marking the beginning of or ending of a scope.
void initialize(const MachineFunction &)
initialize - Scan machine function and constuct lexical scope nest, resets the instance if necessary...
const MCContext & getContext() const
virtual void endFunctionImpl(const MachineFunction *MF)=0
DenseMap< const MachineInstr *, MCSymbol * > LabelsAfterInsn
Maps instruction with label emitted after instruction.
void requestLabelBeforeInsn(const MachineInstr *MI)
Ensure that a label will be emitted before MI.
void resolve()
Resolve a unique, unresolved node.
MCSymbol * createTempSymbol(bool CanBeUnnamed=true)
Create and return a new assembler temporary symbol with a unique but unspecified name.
const MachineBasicBlock * PrevInstBB
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
DISubprogram * getSubprogram() const
Get the attached subprogram.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
AsmPrinter * Asm
Target of debug info emission.
llvm::Optional< llvm::DIExpression::FragmentInfo > FragmentInfo
Present if the location is part of a larger variable.
This class is intended to be used as a driving class for all asm writers.
DenseMap< const MachineInstr *, MCSymbol * > LabelsBeforeInsn
Maps instruction with label emitted before instruction.
void beginInstruction(const MachineInstr *MI) override
Process beginning of an instruction.
void endFunction(const MachineFunction *MF) override
Gather post-function debug information.
MCSymbol * getLabelAfterInsn(const MachineInstr *MI)
Return Label immediately following the instruction.
const DIExpression * getDebugExpression() const
Return the complex address expression referenced by this DBG_VALUE instruction.
BaseType
A given derived pointer can have multiple base pointers through phi/selects.
virtual void skippedNonDebugFunction()
Represents the location at which a variable is stored.
virtual void beginFunctionImpl(const MachineFunction *MF)=0
static Optional< DbgVariableLocation > extractFromMachineInstruction(const MachineInstr &Instruction)
Extract a VariableLocation from a MachineInstr.
static bool hasDebugInfo(const MachineModuleInfo *MMI, const MachineFunction *MF)
bool isDebugValue() const
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
LLVM_NODISCARD T pop_back_val()
const Function & getFunction() const
Return the LLVM function that this machine code represents.
bool fragmentsOverlap(const DIExpression *Other) const
Check if fragments overlap between this DIExpression and Other.
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
const MachineBasicBlock * getParent() const
void requestLabelAfterInsn(const MachineInstr *MI)
Ensure that a label will be emitted after MI.
Representation of each machine instruction.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
LLVM_NODISCARD bool empty() const
std::pair< const MachineInstr *, const MachineInstr * > InstrRange
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
void endInstruction() override
Process end of an instruction.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
MCSymbol * getLabelBeforeInsn(const MachineInstr *MI)
Return Label preceding the instruction.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
SmallVector< int64_t, 1 > LoadChain
Chain of offsetted loads necessary to load the value if it lives in memory.
LLVM Value Representation.
MachineModuleInfo * MMI
Collected machine module information.
static uint64_t getBaseTypeSize(const DITypeRef TyRef)
If this type is derived from a base type then return base type size.
unsigned Register
Base register.
DILocalScope * getScope() const
Get the local scope for this variable.
const MachineOperand & getOperand(unsigned i) const
LLVM_DUMP_METHOD void dump() const
bool isIndirectDebugValue() const
A DBG_VALUE is indirect iff the first operand is a register and the second operand is an immediate...
std::pair< const MachineInstr *, const MachineInstr * > InsnRange
InsnRange - This is used to track range of instructions with identical lexical scope.
bool empty()
empty - Return true if there is any lexical scope information available.
LexicalScope * getCurrentFunctionScope() const
getCurrentFunctionScope - Return lexical scope for the current function.
This class contains meta information specific to a module.