27 #define DEBUG_TYPE "dwarfdebug" 45 switch (
Op->getOp()) {
46 case dwarf::DW_OP_constu: {
50 switch (
Op->getOp()) {
51 case dwarf::DW_OP_minus:
54 case dwarf::DW_OP_plus:
62 case dwarf::DW_OP_plus_uconst:
63 Offset +=
Op->getArg(0);
68 case dwarf::DW_OP_deref:
96 while (!WorkList.
empty()) {
100 if (!Children.
empty())
107 assert(R.first &&
"InsnRange does not have first instruction!");
108 assert(R.second &&
"InsnRange does not have second instruction!");
118 assert(Label &&
"Didn't insert label before instruction");
136 assert(AfterInsn &&
"Expected label after instruction");
151 if (Tag != dwarf::DW_TAG_member && Tag != dwarf::DW_TAG_typedef &&
152 Tag != dwarf::DW_TAG_const_type && Tag != dwarf::DW_TAG_volatile_type &&
153 Tag != dwarf::DW_TAG_restrict_type && Tag != dwarf::DW_TAG_atomic_type)
164 if (BaseType->
getTag() == dwarf::DW_TAG_reference_type ||
165 BaseType->
getTag() == dwarf::DW_TAG_rvalue_reference_type)
179 auto EK =
SP->getUnit()->getEmissionKind();
213 const auto &Entries =
I.second;
218 return MI->getOperand(0).isReg() &&
MI->getOperand(0).getReg();
231 Entries.front().getInstr()->getDebugVariable();
234 if (!IsDescribedByReg(Entries.front().getInstr()))
236 if (Entries.front().getInstr()->getDebugExpression()->isFragment()) {
238 for (
auto I = Entries.begin();
I != Entries.end(); ++
I) {
239 if (!
I->isDbgValue())
241 const DIExpression *Fragment =
I->getInstr()->getDebugExpression();
244 return Pred.isDbgValue() &&
246 Pred.getInstr()->getDebugExpression());
253 if (IsDescribedByReg(
I->getInstr()))
260 for (
const auto &
Entry : Entries) {
261 if (
Entry.isDbgValue())
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)
static bool fragmentsOverlap(const FragmentInfo &A, const FragmentInfo &B)
Check if fragments overlap between a pair of FragmentInfos.
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)
SmallVectorImpl< InsnRange > & getRanges()
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
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.
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.
AsmPrinter * Asm
Target of debug info emission.
Specifies a change in a variable's debug value history.
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.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly...
static uint64_t getBaseTypeSize(const DIType *Ty)
If this type is derived from a base type then return base type size.
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.
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_NODISCARD bool empty() const
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.
unsigned Register
Base register.
Register getReg() const
getReg - Returns the register number.
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.