forked from OSchip/llvm-project
DebugInfo: Gut DIVariable and DIGlobalVariable
Gut all the non-pointer API from the variable wrappers, except an implicit conversion from `DIGlobalVariable` to `DIDescriptor`. Note that if you're updating out-of-tree code, `DIVariable` wraps `MDLocalVariable` (`MDVariable` is a common base class shared with `MDGlobalVariable`). llvm-svn: 234840
This commit is contained in:
parent
02628def32
commit
7348ddaa74
|
@ -581,69 +581,32 @@ public:
|
||||||
Metadata *getValue() const { return get()->getValue(); }
|
Metadata *getValue() const { return get()->getValue(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief This is a wrapper for a global variable.
|
class DIGlobalVariable {
|
||||||
class DIGlobalVariable : public DIDescriptor {
|
MDGlobalVariable *N;
|
||||||
DIFile getFile() const { return DIFile(get()->getFile()); }
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DIGlobalVariable() = default;
|
DIGlobalVariable(const MDGlobalVariable *N = nullptr)
|
||||||
DIGlobalVariable(const MDGlobalVariable *N) : DIDescriptor(N) {}
|
: N(const_cast<MDGlobalVariable *>(N)) {}
|
||||||
|
|
||||||
MDGlobalVariable *get() const {
|
operator DIDescriptor() const { return N; }
|
||||||
return cast_or_null<MDGlobalVariable>(DIDescriptor::get());
|
operator MDGlobalVariable *() const { return N; }
|
||||||
}
|
MDGlobalVariable *operator->() const { return N; }
|
||||||
operator MDGlobalVariable *() const { return get(); }
|
MDGlobalVariable &operator*() const { return *N; }
|
||||||
MDGlobalVariable *operator->() const { return get(); }
|
|
||||||
MDGlobalVariable &operator*() const { return *get(); }
|
|
||||||
|
|
||||||
StringRef getName() const { return get()->getName(); }
|
|
||||||
StringRef getDisplayName() const { return get()->getDisplayName(); }
|
|
||||||
StringRef getLinkageName() const { return get()->getLinkageName(); }
|
|
||||||
unsigned getLineNumber() const { return get()->getLine(); }
|
|
||||||
unsigned isLocalToUnit() const { return get()->isLocalToUnit(); }
|
|
||||||
unsigned isDefinition() const { return get()->isDefinition(); }
|
|
||||||
|
|
||||||
DIScope getContext() const { return get()->getScope(); }
|
|
||||||
StringRef getFilename() const { return get()->getFilename(); }
|
|
||||||
StringRef getDirectory() const { return get()->getDirectory(); }
|
|
||||||
DITypeRef getType() const { return get()->getType(); }
|
|
||||||
|
|
||||||
Constant *getConstant() const { return get()->getVariable(); }
|
|
||||||
DIDerivedType getStaticDataMemberDeclaration() const {
|
|
||||||
return get()->getStaticDataMemberDeclaration();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief This is a wrapper for a variable (e.g. parameter, local, global etc).
|
class DIVariable {
|
||||||
class DIVariable : public DIDescriptor {
|
MDLocalVariable *N;
|
||||||
unsigned getFlags() const { return get()->getFlags(); }
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DIVariable() = default;
|
DIVariable(const MDLocalVariable *N = nullptr)
|
||||||
DIVariable(const MDLocalVariable *N) : DIDescriptor(N) {}
|
: N(const_cast<MDLocalVariable *>(N)) {}
|
||||||
|
|
||||||
MDLocalVariable *get() const {
|
operator MDLocalVariable *() const { return N; }
|
||||||
return cast_or_null<MDLocalVariable>(DIDescriptor::get());
|
MDLocalVariable *operator->() const { return N; }
|
||||||
}
|
MDLocalVariable &operator*() const { return *N; }
|
||||||
operator MDLocalVariable *() const { return get(); }
|
|
||||||
MDLocalVariable *operator->() const { return get(); }
|
|
||||||
MDLocalVariable &operator*() const { return *get(); }
|
|
||||||
|
|
||||||
StringRef getName() const { return get()->getName(); }
|
|
||||||
unsigned getLineNumber() const { return get()->getLine(); }
|
|
||||||
unsigned getArgNumber() const { return get()->getArg(); }
|
|
||||||
|
|
||||||
DIScope getContext() const { return get()->getScope(); }
|
|
||||||
DIFile getFile() const { return get()->getFile(); }
|
|
||||||
DITypeRef getType() const { return get()->getType(); }
|
|
||||||
|
|
||||||
bool isArtificial() const { return get()->isArtificial(); }
|
|
||||||
bool isObjectPointer() const { return get()->isObjectPointer(); }
|
|
||||||
|
|
||||||
/// \brief If this variable is inlined then return inline location.
|
|
||||||
MDNode *getInlinedAt() const { return get()->getInlinedAt(); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class DIExpression {
|
class DIExpression {
|
||||||
MDExpression *N;
|
MDExpression *N;
|
||||||
|
|
||||||
|
|
|
@ -91,10 +91,10 @@ void ModuleDebugInfoPrinter::print(raw_ostream &O, const Module *M) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (DIGlobalVariable GV : Finder.global_variables()) {
|
for (DIGlobalVariable GV : Finder.global_variables()) {
|
||||||
O << "Global variable: " << GV.getName();
|
O << "Global variable: " << GV->getName();
|
||||||
printFile(O, GV.getFilename(), GV.getDirectory(), GV.getLineNumber());
|
printFile(O, GV->getFilename(), GV->getDirectory(), GV->getLine());
|
||||||
if (!GV.getLinkageName().empty())
|
if (!GV->getLinkageName().empty())
|
||||||
O << " ('" << GV.getLinkageName() << "')";
|
O << " ('" << GV->getLinkageName() << "')";
|
||||||
O << '\n';
|
O << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -671,12 +671,12 @@ static bool emitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP) {
|
||||||
OS << "DEBUG_VALUE: ";
|
OS << "DEBUG_VALUE: ";
|
||||||
|
|
||||||
DIVariable V = MI->getDebugVariable();
|
DIVariable V = MI->getDebugVariable();
|
||||||
if (DISubprogram SP = dyn_cast<MDSubprogram>(V.getContext())) {
|
if (DISubprogram SP = dyn_cast<MDSubprogram>(V->getScope())) {
|
||||||
StringRef Name = SP.getDisplayName();
|
StringRef Name = SP.getDisplayName();
|
||||||
if (!Name.empty())
|
if (!Name.empty())
|
||||||
OS << Name << ":";
|
OS << Name << ":";
|
||||||
}
|
}
|
||||||
OS << V.getName();
|
OS << V->getName();
|
||||||
|
|
||||||
DIExpression Expr = MI->getDebugExpression();
|
DIExpression Expr = MI->getDebugExpression();
|
||||||
if (Expr->isBitPiece())
|
if (Expr->isBitPiece())
|
||||||
|
|
|
@ -103,44 +103,44 @@ DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(DIGlobalVariable GV) {
|
||||||
|
|
||||||
assert(GV);
|
assert(GV);
|
||||||
|
|
||||||
DIScope GVContext = GV.getContext();
|
DIScope GVContext = GV->getScope();
|
||||||
DIType GTy = DD->resolve(GV.getType());
|
DIType GTy = DD->resolve(GV->getType());
|
||||||
|
|
||||||
// Construct the context before querying for the existence of the DIE in
|
// Construct the context before querying for the existence of the DIE in
|
||||||
// case such construction creates the DIE.
|
// case such construction creates the DIE.
|
||||||
DIE *ContextDIE = getOrCreateContextDIE(GVContext);
|
DIE *ContextDIE = getOrCreateContextDIE(GVContext);
|
||||||
|
|
||||||
// Add to map.
|
// Add to map.
|
||||||
DIE *VariableDIE = &createAndAddDIE(GV.getTag(), *ContextDIE, GV);
|
DIE *VariableDIE = &createAndAddDIE(GV->getTag(), *ContextDIE, GV);
|
||||||
DIScope DeclContext;
|
DIScope DeclContext;
|
||||||
|
|
||||||
if (DIDerivedType SDMDecl = GV.getStaticDataMemberDeclaration()) {
|
if (DIDerivedType SDMDecl = GV->getStaticDataMemberDeclaration()) {
|
||||||
DeclContext = resolve(SDMDecl.getContext());
|
DeclContext = resolve(SDMDecl.getContext());
|
||||||
assert(SDMDecl.isStaticMember() && "Expected static member decl");
|
assert(SDMDecl.isStaticMember() && "Expected static member decl");
|
||||||
assert(GV.isDefinition());
|
assert(GV->isDefinition());
|
||||||
// We need the declaration DIE that is in the static member's class.
|
// We need the declaration DIE that is in the static member's class.
|
||||||
DIE *VariableSpecDIE = getOrCreateStaticMemberDIE(SDMDecl);
|
DIE *VariableSpecDIE = getOrCreateStaticMemberDIE(SDMDecl);
|
||||||
addDIEEntry(*VariableDIE, dwarf::DW_AT_specification, *VariableSpecDIE);
|
addDIEEntry(*VariableDIE, dwarf::DW_AT_specification, *VariableSpecDIE);
|
||||||
} else {
|
} else {
|
||||||
DeclContext = GV.getContext();
|
DeclContext = GV->getScope();
|
||||||
// Add name and type.
|
// Add name and type.
|
||||||
addString(*VariableDIE, dwarf::DW_AT_name, GV.getDisplayName());
|
addString(*VariableDIE, dwarf::DW_AT_name, GV->getDisplayName());
|
||||||
addType(*VariableDIE, GTy);
|
addType(*VariableDIE, GTy);
|
||||||
|
|
||||||
// Add scoping info.
|
// Add scoping info.
|
||||||
if (!GV.isLocalToUnit())
|
if (!GV->isLocalToUnit())
|
||||||
addFlag(*VariableDIE, dwarf::DW_AT_external);
|
addFlag(*VariableDIE, dwarf::DW_AT_external);
|
||||||
|
|
||||||
// Add line number info.
|
// Add line number info.
|
||||||
addSourceLine(*VariableDIE, GV);
|
addSourceLine(*VariableDIE, GV);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GV.isDefinition())
|
if (!GV->isDefinition())
|
||||||
addFlag(*VariableDIE, dwarf::DW_AT_declaration);
|
addFlag(*VariableDIE, dwarf::DW_AT_declaration);
|
||||||
|
|
||||||
// Add location.
|
// Add location.
|
||||||
bool addToAccelTable = false;
|
bool addToAccelTable = false;
|
||||||
if (auto *Global = dyn_cast_or_null<GlobalVariable>(GV.getConstant())) {
|
if (auto *Global = dyn_cast_or_null<GlobalVariable>(GV->getVariable())) {
|
||||||
addToAccelTable = true;
|
addToAccelTable = true;
|
||||||
DIELoc *Loc = new (DIEValueAllocator) DIELoc();
|
DIELoc *Loc = new (DIEValueAllocator) DIELoc();
|
||||||
const MCSymbol *Sym = Asm->getSymbol(Global);
|
const MCSymbol *Sym = Asm->getSymbol(Global);
|
||||||
|
@ -173,11 +173,11 @@ DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(DIGlobalVariable GV) {
|
||||||
}
|
}
|
||||||
|
|
||||||
addBlock(*VariableDIE, dwarf::DW_AT_location, Loc);
|
addBlock(*VariableDIE, dwarf::DW_AT_location, Loc);
|
||||||
addLinkageName(*VariableDIE, GV.getLinkageName());
|
addLinkageName(*VariableDIE, GV->getLinkageName());
|
||||||
} else if (const ConstantInt *CI =
|
} else if (const ConstantInt *CI =
|
||||||
dyn_cast_or_null<ConstantInt>(GV.getConstant())) {
|
dyn_cast_or_null<ConstantInt>(GV->getVariable())) {
|
||||||
addConstantValue(*VariableDIE, CI, GTy);
|
addConstantValue(*VariableDIE, CI, GTy);
|
||||||
} else if (const ConstantExpr *CE = getMergedGlobalExpr(GV.getConstant())) {
|
} else if (const ConstantExpr *CE = getMergedGlobalExpr(GV->getVariable())) {
|
||||||
addToAccelTable = true;
|
addToAccelTable = true;
|
||||||
// GV is a merged global.
|
// GV is a merged global.
|
||||||
DIELoc *Loc = new (DIEValueAllocator) DIELoc();
|
DIELoc *Loc = new (DIEValueAllocator) DIELoc();
|
||||||
|
@ -194,15 +194,15 @@ DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(DIGlobalVariable GV) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addToAccelTable) {
|
if (addToAccelTable) {
|
||||||
DD->addAccelName(GV.getName(), *VariableDIE);
|
DD->addAccelName(GV->getName(), *VariableDIE);
|
||||||
|
|
||||||
// If the linkage name is different than the name, go ahead and output
|
// If the linkage name is different than the name, go ahead and output
|
||||||
// that as well into the name table.
|
// that as well into the name table.
|
||||||
if (GV.getLinkageName() != "" && GV.getName() != GV.getLinkageName())
|
if (GV->getLinkageName() != "" && GV->getName() != GV->getLinkageName())
|
||||||
DD->addAccelName(GV.getLinkageName(), *VariableDIE);
|
DD->addAccelName(GV->getLinkageName(), *VariableDIE);
|
||||||
}
|
}
|
||||||
|
|
||||||
addGlobalName(GV.getName(), *VariableDIE, DeclContext);
|
addGlobalName(GV->getName(), *VariableDIE, DeclContext);
|
||||||
return VariableDIE;
|
return VariableDIE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ bool DbgVariable::isBlockByrefVariable() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
DIType DbgVariable::getType() const {
|
DIType DbgVariable::getType() const {
|
||||||
DIType Ty = Var.getType().resolve(DD->getTypeIdentifierMap());
|
DIType Ty = Var->getType().resolve(DD->getTypeIdentifierMap());
|
||||||
// FIXME: isBlockByrefVariable should be reformulated in terms of complex
|
// FIXME: isBlockByrefVariable should be reformulated in terms of complex
|
||||||
// addresses instead.
|
// addresses instead.
|
||||||
if (Ty->isBlockByrefStruct()) {
|
if (Ty->isBlockByrefStruct()) {
|
||||||
|
@ -894,10 +894,10 @@ DwarfDebug::collectVariableInfo(DwarfCompileUnit &TheCU, DISubprogram SP,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
LexicalScope *Scope = nullptr;
|
LexicalScope *Scope = nullptr;
|
||||||
if (MDLocation *IA = DV.get()->getInlinedAt())
|
if (MDLocation *IA = DV->getInlinedAt())
|
||||||
Scope = LScopes.findInlinedScope(DV.get()->getScope(), IA);
|
Scope = LScopes.findInlinedScope(DV->getScope(), IA);
|
||||||
else
|
else
|
||||||
Scope = LScopes.findLexicalScope(DV.get()->getScope());
|
Scope = LScopes.findLexicalScope(DV->getScope());
|
||||||
// If variable scope is not found then skip this variable.
|
// If variable scope is not found then skip this variable.
|
||||||
if (!Scope)
|
if (!Scope)
|
||||||
continue;
|
continue;
|
||||||
|
@ -933,7 +933,7 @@ DwarfDebug::collectVariableInfo(DwarfCompileUnit &TheCU, DISubprogram SP,
|
||||||
for (DIVariable DV : SP->getVariables()) {
|
for (DIVariable DV : SP->getVariables()) {
|
||||||
if (!Processed.insert(DV).second)
|
if (!Processed.insert(DV).second)
|
||||||
continue;
|
continue;
|
||||||
if (LexicalScope *Scope = LScopes.findLexicalScope(DV.get()->getScope())) {
|
if (LexicalScope *Scope = LScopes.findLexicalScope(DV->getScope())) {
|
||||||
ensureAbstractVariableIsCreatedIfScoped(DV, Scope->getScopeNode());
|
ensureAbstractVariableIsCreatedIfScoped(DV, Scope->getScopeNode());
|
||||||
DIExpression NoExpr;
|
DIExpression NoExpr;
|
||||||
ConcreteVariables.push_back(make_unique<DbgVariable>(DV, NoExpr, this));
|
ConcreteVariables.push_back(make_unique<DbgVariable>(DV, NoExpr, this));
|
||||||
|
@ -1128,8 +1128,8 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
|
||||||
// The first mention of a function argument gets the CurrentFnBegin
|
// The first mention of a function argument gets the CurrentFnBegin
|
||||||
// label, so arguments are visible when breaking at function entry.
|
// label, so arguments are visible when breaking at function entry.
|
||||||
DIVariable DIVar = Ranges.front().first->getDebugVariable();
|
DIVariable DIVar = Ranges.front().first->getDebugVariable();
|
||||||
if (DIVar.getTag() == dwarf::DW_TAG_arg_variable &&
|
if (DIVar->getTag() == dwarf::DW_TAG_arg_variable &&
|
||||||
getDISubprogram(DIVar.getContext()).describes(MF->getFunction())) {
|
getDISubprogram(DIVar->getScope()).describes(MF->getFunction())) {
|
||||||
LabelsBeforeInsn[Ranges.front().first] = Asm->getFunctionBegin();
|
LabelsBeforeInsn[Ranges.front().first] = Asm->getFunctionBegin();
|
||||||
if (Ranges.front().first->getDebugExpression()->isBitPiece()) {
|
if (Ranges.front().first->getDebugExpression()->isBitPiece()) {
|
||||||
// Mark all non-overlapping initial pieces.
|
// Mark all non-overlapping initial pieces.
|
||||||
|
@ -1220,7 +1220,7 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
|
||||||
for (DIVariable DV : SP->getVariables()) {
|
for (DIVariable DV : SP->getVariables()) {
|
||||||
if (!ProcessedVars.insert(DV).second)
|
if (!ProcessedVars.insert(DV).second)
|
||||||
continue;
|
continue;
|
||||||
ensureAbstractVariableIsCreated(DV, DV.getContext());
|
ensureAbstractVariableIsCreated(DV, DV->getScope());
|
||||||
assert(LScopes.getAbstractScopesList().size() == NumAbstractScopes
|
assert(LScopes.getAbstractScopesList().size() == NumAbstractScopes
|
||||||
&& "ensureAbstractVariableIsCreated inserted abstract scopes");
|
&& "ensureAbstractVariableIsCreated inserted abstract scopes");
|
||||||
}
|
}
|
||||||
|
@ -1480,7 +1480,7 @@ static void emitDebugLocValue(const AsmPrinter &AP,
|
||||||
Streamer);
|
Streamer);
|
||||||
// Regular entry.
|
// Regular entry.
|
||||||
if (Value.isInt()) {
|
if (Value.isInt()) {
|
||||||
MDType *T = DV.getType().resolve(TypeIdentifierMap);
|
MDType *T = DV->getType().resolve(TypeIdentifierMap);
|
||||||
auto *B = dyn_cast<MDBasicType>(T);
|
auto *B = dyn_cast<MDBasicType>(T);
|
||||||
if (B && (B->getEncoding() == dwarf::DW_ATE_signed ||
|
if (B && (B->getEncoding() == dwarf::DW_ATE_signed ||
|
||||||
B->getEncoding() == dwarf::DW_ATE_signed_char))
|
B->getEncoding() == dwarf::DW_ATE_signed_char))
|
||||||
|
|
|
@ -107,7 +107,7 @@ public:
|
||||||
DIE *getDIE() const { return TheDIE; }
|
DIE *getDIE() const { return TheDIE; }
|
||||||
void setDotDebugLocOffset(unsigned O) { DotDebugLocOffset = O; }
|
void setDotDebugLocOffset(unsigned O) { DotDebugLocOffset = O; }
|
||||||
unsigned getDotDebugLocOffset() const { return DotDebugLocOffset; }
|
unsigned getDotDebugLocOffset() const { return DotDebugLocOffset; }
|
||||||
StringRef getName() const { return Var.getName(); }
|
StringRef getName() const { return Var->getName(); }
|
||||||
const MachineInstr *getMInsn() const { return MInsn; }
|
const MachineInstr *getMInsn() const { return MInsn; }
|
||||||
const ArrayRef<int> getFrameIndex() const { return FrameIndex; }
|
const ArrayRef<int> getFrameIndex() const { return FrameIndex; }
|
||||||
|
|
||||||
|
@ -130,14 +130,14 @@ public:
|
||||||
|
|
||||||
// Translate tag to proper Dwarf tag.
|
// Translate tag to proper Dwarf tag.
|
||||||
dwarf::Tag getTag() const {
|
dwarf::Tag getTag() const {
|
||||||
if (Var.getTag() == dwarf::DW_TAG_arg_variable)
|
if (Var->getTag() == dwarf::DW_TAG_arg_variable)
|
||||||
return dwarf::DW_TAG_formal_parameter;
|
return dwarf::DW_TAG_formal_parameter;
|
||||||
|
|
||||||
return dwarf::DW_TAG_variable;
|
return dwarf::DW_TAG_variable;
|
||||||
}
|
}
|
||||||
/// \brief Return true if DbgVariable is artificial.
|
/// \brief Return true if DbgVariable is artificial.
|
||||||
bool isArtificial() const {
|
bool isArtificial() const {
|
||||||
if (Var.isArtificial())
|
if (Var->isArtificial())
|
||||||
return true;
|
return true;
|
||||||
if (getType().isArtificial())
|
if (getType().isArtificial())
|
||||||
return true;
|
return true;
|
||||||
|
@ -145,7 +145,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isObjectPointer() const {
|
bool isObjectPointer() const {
|
||||||
if (Var.isObjectPointer())
|
if (Var->isObjectPointer())
|
||||||
return true;
|
return true;
|
||||||
if (getType().isObjectPointer())
|
if (getType().isObjectPointer())
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -139,7 +139,7 @@ bool DwarfFile::addScopeVariable(LexicalScope *LS, DbgVariable *Var) {
|
||||||
SmallVectorImpl<DbgVariable *> &Vars = ScopeVariables[LS];
|
SmallVectorImpl<DbgVariable *> &Vars = ScopeVariables[LS];
|
||||||
DIVariable DV = Var->getVariable();
|
DIVariable DV = Var->getVariable();
|
||||||
// Variables with positive arg numbers are parameters.
|
// Variables with positive arg numbers are parameters.
|
||||||
if (unsigned ArgNum = DV.getArgNumber()) {
|
if (unsigned ArgNum = DV->getArg()) {
|
||||||
// Keep all parameters in order at the start of the variable list to ensure
|
// Keep all parameters in order at the start of the variable list to ensure
|
||||||
// function types are correct (no out-of-order parameters)
|
// function types are correct (no out-of-order parameters)
|
||||||
//
|
//
|
||||||
|
@ -149,7 +149,7 @@ bool DwarfFile::addScopeVariable(LexicalScope *LS, DbgVariable *Var) {
|
||||||
// rather than linear search.
|
// rather than linear search.
|
||||||
auto I = Vars.begin();
|
auto I = Vars.begin();
|
||||||
while (I != Vars.end()) {
|
while (I != Vars.end()) {
|
||||||
unsigned CurNum = (*I)->getVariable().getArgNumber();
|
unsigned CurNum = (*I)->getVariable()->getArg();
|
||||||
// A local (non-parameter) variable has been found, insert immediately
|
// A local (non-parameter) variable has been found, insert immediately
|
||||||
// before it.
|
// before it.
|
||||||
if (CurNum == 0)
|
if (CurNum == 0)
|
||||||
|
|
|
@ -399,8 +399,8 @@ void DwarfUnit::addSourceLine(DIE &Die, unsigned Line, StringRef File,
|
||||||
void DwarfUnit::addSourceLine(DIE &Die, DIVariable V) {
|
void DwarfUnit::addSourceLine(DIE &Die, DIVariable V) {
|
||||||
assert(V);
|
assert(V);
|
||||||
|
|
||||||
addSourceLine(Die, V.getLineNumber(), V.getContext().getFilename(),
|
addSourceLine(Die, V->getLine(), V->getScope()->getFilename(),
|
||||||
V.getContext().getDirectory());
|
V->getScope()->getDirectory());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// addSourceLine - Add location information to specified debug information
|
/// addSourceLine - Add location information to specified debug information
|
||||||
|
@ -408,7 +408,7 @@ void DwarfUnit::addSourceLine(DIE &Die, DIVariable V) {
|
||||||
void DwarfUnit::addSourceLine(DIE &Die, DIGlobalVariable G) {
|
void DwarfUnit::addSourceLine(DIE &Die, DIGlobalVariable G) {
|
||||||
assert(G);
|
assert(G);
|
||||||
|
|
||||||
addSourceLine(Die, G.getLineNumber(), G.getFilename(), G.getDirectory());
|
addSourceLine(Die, G->getLine(), G->getFilename(), G->getDirectory());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// addSourceLine - Add location information to specified debug information
|
/// addSourceLine - Add location information to specified debug information
|
||||||
|
|
|
@ -1620,8 +1620,8 @@ void MachineInstr::print(raw_ostream &OS, bool SkipOpers) const {
|
||||||
if (isDebugValue() && MO.isMetadata()) {
|
if (isDebugValue() && MO.isMetadata()) {
|
||||||
// Pretty print DBG_VALUE instructions.
|
// Pretty print DBG_VALUE instructions.
|
||||||
DIVariable DIV = dyn_cast<MDLocalVariable>(MO.getMetadata());
|
DIVariable DIV = dyn_cast<MDLocalVariable>(MO.getMetadata());
|
||||||
if (DIV && !DIV.getName().empty())
|
if (DIV && !DIV->getName().empty())
|
||||||
OS << "!\"" << DIV.getName() << '\"';
|
OS << "!\"" << DIV->getName() << '\"';
|
||||||
else
|
else
|
||||||
MO.print(OS, TRI);
|
MO.print(OS, TRI);
|
||||||
} else if (TRI && (isInsertSubreg() || isRegSequence()) && MO.isImm()) {
|
} else if (TRI && (isInsertSubreg() || isRegSequence()) && MO.isImm()) {
|
||||||
|
@ -1711,8 +1711,8 @@ void MachineInstr::print(raw_ostream &OS, bool SkipOpers) const {
|
||||||
if (isDebugValue() && getOperand(e - 2).isMetadata()) {
|
if (isDebugValue() && getOperand(e - 2).isMetadata()) {
|
||||||
if (!HaveSemi) OS << ";";
|
if (!HaveSemi) OS << ";";
|
||||||
DIVariable DV = cast<MDLocalVariable>(getOperand(e - 2).getMetadata());
|
DIVariable DV = cast<MDLocalVariable>(getOperand(e - 2).getMetadata());
|
||||||
OS << " line no:" << DV.getLineNumber();
|
OS << " line no:" << DV->getLine();
|
||||||
if (auto *InlinedAt = DV.getInlinedAt()) {
|
if (auto *InlinedAt = DV->getInlinedAt()) {
|
||||||
DebugLoc InlinedAtDL(InlinedAt);
|
DebugLoc InlinedAtDL(InlinedAt);
|
||||||
if (InlinedAtDL && MF) {
|
if (InlinedAtDL && MF) {
|
||||||
OS << " inlined @[ ";
|
OS << " inlined @[ ";
|
||||||
|
|
|
@ -4673,7 +4673,7 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
|
||||||
Address = BCI->getOperand(0);
|
Address = BCI->getOperand(0);
|
||||||
// Parameters are handled specially.
|
// Parameters are handled specially.
|
||||||
bool isParameter =
|
bool isParameter =
|
||||||
(DIVariable(Variable).getTag() == dwarf::DW_TAG_arg_variable ||
|
(DIVariable(Variable)->getTag() == dwarf::DW_TAG_arg_variable ||
|
||||||
isa<Argument>(Address));
|
isa<Argument>(Address));
|
||||||
|
|
||||||
const AllocaInst *AI = dyn_cast<AllocaInst>(Address);
|
const AllocaInst *AI = dyn_cast<AllocaInst>(Address);
|
||||||
|
|
|
@ -152,8 +152,8 @@ void DebugInfoFinder::processModule(const Module &M) {
|
||||||
addCompileUnit(CU);
|
addCompileUnit(CU);
|
||||||
for (DIGlobalVariable DIG : CU->getGlobalVariables()) {
|
for (DIGlobalVariable DIG : CU->getGlobalVariables()) {
|
||||||
if (addGlobalVariable(DIG)) {
|
if (addGlobalVariable(DIG)) {
|
||||||
processScope(DIG.getContext());
|
processScope(DIG->getScope());
|
||||||
processType(DIG.getType().resolve(TypeIdentifierMap));
|
processType(DIG->getType().resolve(TypeIdentifierMap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto *SP : CU->getSubprograms())
|
for (auto *SP : CU->getSubprograms())
|
||||||
|
@ -258,8 +258,8 @@ void DebugInfoFinder::processDeclare(const Module &M,
|
||||||
|
|
||||||
if (!NodesSeen.insert(DV).second)
|
if (!NodesSeen.insert(DV).second)
|
||||||
return;
|
return;
|
||||||
processScope(DV.getContext());
|
processScope(DV->getScope());
|
||||||
processType(DV.getType().resolve(TypeIdentifierMap));
|
processType(DV->getType().resolve(TypeIdentifierMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebugInfoFinder::processValue(const Module &M, const DbgValueInst *DVI) {
|
void DebugInfoFinder::processValue(const Module &M, const DbgValueInst *DVI) {
|
||||||
|
@ -274,8 +274,8 @@ void DebugInfoFinder::processValue(const Module &M, const DbgValueInst *DVI) {
|
||||||
|
|
||||||
if (!NodesSeen.insert(DV).second)
|
if (!NodesSeen.insert(DV).second)
|
||||||
return;
|
return;
|
||||||
processScope(DV.getContext());
|
processScope(DV->getScope());
|
||||||
processType(DV.getType().resolve(TypeIdentifierMap));
|
processType(DV->getType().resolve(TypeIdentifierMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DebugInfoFinder::addType(DIType DT) {
|
bool DebugInfoFinder::addType(DIType DT) {
|
||||||
|
|
|
@ -348,8 +348,8 @@ void AArch64AsmPrinter::PrintDebugValueComment(const MachineInstr *MI,
|
||||||
assert(NOps == 4);
|
assert(NOps == 4);
|
||||||
OS << '\t' << MAI->getCommentString() << "DEBUG_VALUE: ";
|
OS << '\t' << MAI->getCommentString() << "DEBUG_VALUE: ";
|
||||||
// cast away const; DIetc do not take const operands for some reason.
|
// cast away const; DIetc do not take const operands for some reason.
|
||||||
DIVariable V = cast<MDLocalVariable>(MI->getOperand(NOps - 2).getMetadata());
|
OS << cast<MDLocalVariable>(MI->getOperand(NOps - 2).getMetadata())
|
||||||
OS << V.getName();
|
->getName();
|
||||||
OS << " <- ";
|
OS << " <- ";
|
||||||
// Frame address. Currently handles register +- offset only.
|
// Frame address. Currently handles register +- offset only.
|
||||||
assert(MI->getOperand(0).isReg() && MI->getOperand(1).isImm());
|
assert(MI->getOperand(0).isReg() && MI->getOperand(1).isImm());
|
||||||
|
|
|
@ -335,7 +335,7 @@ bool StripDeadDebugInfo::runOnModule(Module &M) {
|
||||||
|
|
||||||
// If the global variable referenced by DIG is not null, the global
|
// If the global variable referenced by DIG is not null, the global
|
||||||
// variable is live.
|
// variable is live.
|
||||||
if (DIG.getConstant())
|
if (DIG->getVariable())
|
||||||
LiveGlobalVariables.push_back(DIG);
|
LiveGlobalVariables.push_back(DIG);
|
||||||
else
|
else
|
||||||
GlobalVariableChange = true;
|
GlobalVariableChange = true;
|
||||||
|
@ -350,7 +350,7 @@ bool StripDeadDebugInfo::runOnModule(Module &M) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GlobalVariableChange) {
|
if (GlobalVariableChange) {
|
||||||
DIC.replaceGlobalVariables(DIArray(MDNode::get(C, LiveGlobalVariables)));
|
DIC.replaceGlobalVariables(MDTuple::get(C, LiveGlobalVariables));
|
||||||
Changed = true;
|
Changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ public:
|
||||||
OS.PadToColumn(50);
|
OS.PadToColumn(50);
|
||||||
OS << ";";
|
OS << ";";
|
||||||
}
|
}
|
||||||
OS << " [debug variable = " << Var.getName() << "]";
|
OS << " [debug variable = " << Var->getName() << "]";
|
||||||
}
|
}
|
||||||
else if (const DbgValueInst *DVI = dyn_cast<DbgValueInst>(I)) {
|
else if (const DbgValueInst *DVI = dyn_cast<DbgValueInst>(I)) {
|
||||||
DIVariable Var(DVI->getVariable());
|
DIVariable Var(DVI->getVariable());
|
||||||
|
@ -102,7 +102,7 @@ public:
|
||||||
OS.PadToColumn(50);
|
OS.PadToColumn(50);
|
||||||
OS << ";";
|
OS << ";";
|
||||||
}
|
}
|
||||||
OS << " [debug variable = " << Var.getName() << "]";
|
OS << " [debug variable = " << Var->getName() << "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue