Go to the documentation of this file.
27 #define DEBUG_TYPE "dwarfdebug"
42 Location.Register =
Instruction.getDebugOperand(0).getReg();
43 Location.FragmentInfo.reset();
59 switch (
Op->getOp()) {
60 case dwarf::DW_OP_constu: {
64 switch (
Op->getOp()) {
65 case dwarf::DW_OP_minus:
68 case dwarf::DW_OP_plus:
76 case dwarf::DW_OP_plus_uconst:
77 Offset +=
Op->getArg(0);
80 Location.FragmentInfo = {
Op->getArg(1),
Op->getArg(0)};
82 case dwarf::DW_OP_deref:
83 Location.LoadChain.push_back(Offset);
96 Location.LoadChain.push_back(Offset);
104 if (
M->debug_compile_units().empty())
115 while (!WorkList.empty()) {
119 if (!Children.empty())
120 WorkList.
append(Children.begin(), Children.end());
122 if (
S->isAbstractScope())
126 assert(R.first &&
"InsnRange does not have first instruction!");
127 assert(R.second &&
"InsnRange does not have second instruction!");
137 assert(Label &&
"Didn't insert label before instruction");
155 if (
Tag != dwarf::DW_TAG_member &&
Tag != dwarf::DW_TAG_typedef &&
156 Tag != dwarf::DW_TAG_const_type &&
Tag != dwarf::DW_TAG_volatile_type &&
157 Tag != dwarf::DW_TAG_restrict_type &&
Tag != dwarf::DW_TAG_atomic_type &&
158 Tag != dwarf::DW_TAG_immutable_type)
169 if (
BaseType->getTag() == dwarf::DW_TAG_reference_type ||
170 BaseType->getTag() == dwarf::DW_TAG_rvalue_reference_type)
177 if (isa<DIStringType>(Ty)) {
187 if (
auto *CTy = dyn_cast<DICompositeType>(Ty)) {
188 if (CTy->getTag() == dwarf::DW_TAG_enumeration_type) {
189 if (!(Ty = CTy->getBaseType()))
199 if (
auto *DTy = dyn_cast<DIDerivedType>(Ty)) {
206 if (
T == dwarf::DW_TAG_pointer_type ||
207 T == dwarf::DW_TAG_ptr_to_member_type ||
208 T == dwarf::DW_TAG_reference_type ||
209 T == dwarf::DW_TAG_rvalue_reference_type)
211 assert(
T == dwarf::DW_TAG_typedef ||
T == dwarf::DW_TAG_const_type ||
212 T == dwarf::DW_TAG_volatile_type ||
213 T == dwarf::DW_TAG_restrict_type ||
T == dwarf::DW_TAG_atomic_type ||
214 T == dwarf::DW_TAG_immutable_type);
215 assert(DTy->getBaseType() &&
"Expected valid base type");
219 auto *BTy = cast<DIBasicType>(Ty);
220 unsigned Encoding = BTy->getEncoding();
221 assert((Encoding == dwarf::DW_ATE_unsigned ||
222 Encoding == dwarf::DW_ATE_unsigned_char ||
223 Encoding == dwarf::DW_ATE_signed ||
224 Encoding == dwarf::DW_ATE_signed_char ||
225 Encoding == dwarf::DW_ATE_float || Encoding == dwarf::DW_ATE_UTF ||
226 Encoding == dwarf::DW_ATE_boolean ||
227 (Ty->
getTag() == dwarf::DW_TAG_unspecified_type &&
228 Ty->
getName() ==
"decltype(nullptr)")) &&
229 "Unsupported encoding");
230 return Encoding == dwarf::DW_ATE_unsigned ||
231 Encoding == dwarf::DW_ATE_unsigned_char ||
232 Encoding == dwarf::DW_ATE_UTF || Encoding == dwarf::DW_ATE_boolean ||
233 Ty->
getTag() == dwarf::DW_TAG_unspecified_type;
244 auto EK = SP->getUnit()->getEmissionKind();
281 const auto &Entries =
I.second;
287 [](
auto &MO) { return MO.isReg() && MO.getReg(); });
300 Entries.front().getInstr()->getDebugVariable();
303 if (!IsDescribedByReg(Entries.front().getInstr()))
305 if (Entries.front().getInstr()->getDebugExpression()->isFragment()) {
307 for (
auto I = Entries.begin();
I != Entries.end(); ++
I) {
308 if (!
I->isDbgValue())
310 const DIExpression *Fragment =
I->getInstr()->getDebugExpression();
313 return Pred.isDbgValue() &&
314 Fragment->fragmentsOverlap(
315 Pred.getInstr()->getDebugExpression());
322 if (IsDescribedByReg(
I->getInstr()))
329 for (
const auto &Entry : Entries) {
330 if (Entry.isDbgValue())
416 InstOrdering.
clear();
void beginFunction(const MachineFunction *MF) override
Gather pre-function debug information.
void endInstruction() override
Process end of an instruction.
void initialize(const MachineFunction &MF)
void beginInstruction(const MachineInstr *MI) override
Process beginning of an instruction.
This is an optimization pass for GlobalISel generic memory operations.
MCSymbol * getLabelAfterInsn(const MachineInstr *MI)
Return Label immediately following the instruction.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
const MCContext & getContext() const
uint64_t getSizeInBits() const
static bool hasDebugInfo(const MachineModuleInfo *MMI, const MachineFunction *MF)
Specifies a change in a variable's debug value history.
NodeTy * getNextNode()
Get the next node, or nullptr for the list tail.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
LexicalScope - This class is used to track scope information.
DISubprogram * getSubprogram() const
Get the attached subprogram.
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
DebugLoc PrevInstLoc
Previous instruction's location information.
bool hasDebugInfo() const
Returns true if valid debug info is present.
void beginModule(Module *M) override
DISubprogram * getDISubprogram(const MDNode *Scope)
Find subprogram that is enclosing this scope.
static Optional< DbgVariableLocation > extractFromMachineInstruction(const MachineInstr &Instruction)
Extract a VariableLocation from a MachineInstr.
void requestLabelAfterInsn(const MachineInstr *MI)
Ensure that a label will be emitted after MI.
LLVM_NODISCARD T pop_back_val()
void initialize(const MachineFunction &)
initialize - Scan machine function and constuct lexical scope nest, resets the instance if necessary.
bool isBeginSection() const
Returns true if this block begins any section.
MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
AsmPrinter * Asm
Target of debug info emission.
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
dwarf::Tag getTag() const
StringRef getName() const
void calculateDbgEntityHistory(const MachineFunction *MF, const TargetRegisterInfo *TRI, DbgValueHistoryMap &DbgValues, DbgLabelInstrMap &DbgLabels)
void requestLabelBeforeInsn(const MachineInstr *MI)
Ensure that a label will be emitted before MI.
This class contains meta information specific to a module.
MCSymbol * getLabelBeforeInsn(const MachineInstr *MI)
Return Label preceding the instruction.
MCSymbol * getFunctionBegin() const
virtual void endFunctionImpl(const MachineFunction *MF)=0
static uint64_t getBaseTypeSize(const DIType *Ty)
If this type is derived from a base type then return base type size.
DILocalScope * getScope() const
Get the local scope for this variable.
Represents the location at which a variable is stored.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
LLVM_DUMP_METHOD void dump() const
const MachineBasicBlock * PrevInstBB
Representation of each machine instruction.
bool isMetaInstruction(QueryType Type=IgnoreBundle) const
Return true if this instruction doesn't produce any output in the form of executable instructions.
initializer< Ty > init(const Ty &Val)
virtual void beginFunctionImpl(const MachineFunction *MF)=0
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void endBasicBlock(const MachineBasicBlock &MBB) override
Process end of a basic block during basic block sections.
MachineFunction * MF
The current machine function.
A Module instance is used to store all the information related to an LLVM module.
DbgLabelInstrMap DbgLabels
Mapping of inlined labels and DBG_LABEL machine instruction.
void trimLocationRanges(const MachineFunction &MF, LexicalScopes &LScopes, const InstructionOrdering &Ordering)
Drop location ranges which exist entirely outside each variable's scope.
const MachineInstr * CurMI
If nonnull, stores the current machine instruction we're processing.
virtual void skippedNonDebugFunction()
@ DW_OP_LLVM_arg
Only used in LLVM metadata.
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.
@ DW_OP_LLVM_fragment
Only used in LLVM metadata.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
static cl::opt< bool > TrimVarLocs("trim-var-locs", cl::Hidden, cl::init(true))
If true, we drop variable location ranges which exist entirely outside the variable's lexical scope i...
const MachineBasicBlock * getParent() const
MCSymbol * createTempSymbol()
Create a temporary symbol with a unique name.
void beginBasicBlock(const MachineBasicBlock &MBB) override
Process beginning of a basic block during basic block sections.
MCSymbol * getEndSymbol() const
Returns the MCSymbol marking the end of this basic block.
Function & getFunction()
Return the LLVM function that this machine code represents.
bool isEndSection() const
Returns true if this block ends any section.
This class is intended to be used as a driving class for all asm writers.
void identifyScopeMarkers()
Indentify instructions that are marking the beginning of or ending of a scope.
DebugHandlerBase(AsmPrinter *A)
LexicalScope * getCurrentFunctionScope() const
getCurrentFunctionScope - Return lexical scope for the current function.
MachineModuleInfo * MMI
Collected machine module information.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
expr_op_iterator expr_op_end() const
DenseMap< const MachineInstr *, MCSymbol * > LabelsAfterInsn
Maps instruction with label emitted after instruction.
static bool isUnsignedDIType(const DIType *Ty)
Return true if type encoding is unsigned.
DbgValueHistoryMap DbgValues
History of DBG_VALUE and clobber instructions for each user variable.
LLVM Value Representation.
DenseMap< const MachineInstr *, MCSymbol * > LabelsBeforeInsn
Maps instruction with label emitted before instruction.
void endFunction(const MachineFunction *MF) override
Gather post-function debug information.
expr_op_iterator expr_op_begin() const
Visit the elements via ExprOperand wrappers.