mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-01 15:33:33 +00:00
Distinguish between two copies of one inlined variable. Take 2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137253 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c722c3d5ff
commit
b549bcfe6c
@ -729,6 +729,9 @@ namespace llvm {
|
|||||||
DIVariable createInlinedVariable(MDNode *DV, MDNode *InlinedScope,
|
DIVariable createInlinedVariable(MDNode *DV, MDNode *InlinedScope,
|
||||||
LLVMContext &VMContext);
|
LLVMContext &VMContext);
|
||||||
|
|
||||||
|
/// cleanseInlinedVariable - Remove inlined scope from the variable.
|
||||||
|
DIVariable cleanseInlinedVariable(MDNode *DV, LLVMContext &VMContext);
|
||||||
|
|
||||||
class DebugInfoFinder {
|
class DebugInfoFinder {
|
||||||
public:
|
public:
|
||||||
/// processModule - Process entire module and collect debug info
|
/// processModule - Process entire module and collect debug info
|
||||||
|
@ -818,6 +818,17 @@ DIVariable llvm::createInlinedVariable(MDNode *DV, MDNode *InlinedScope,
|
|||||||
return DIVariable(MDNode::get(VMContext, Elts));
|
return DIVariable(MDNode::get(VMContext, Elts));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// cleanseInlinedVariable - Remove inlined scope from the variable.
|
||||||
|
DIVariable llvm::cleanseInlinedVariable(MDNode *DV, LLVMContext &VMContext) {
|
||||||
|
SmallVector<Value *, 16> Elts;
|
||||||
|
// Insert inlined scope as 7th element.
|
||||||
|
for (unsigned i = 0, e = DV->getNumOperands(); i != e; ++i)
|
||||||
|
i == 7 ?
|
||||||
|
Elts.push_back(llvm::Constant::getNullValue(Type::getInt32Ty(VMContext))):
|
||||||
|
Elts.push_back(DV->getOperand(i));
|
||||||
|
return DIVariable(MDNode::get(VMContext, Elts));
|
||||||
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// DebugInfoFinder implementations.
|
// DebugInfoFinder implementations.
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
@ -1126,14 +1126,15 @@ void DwarfDebug::endModule() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// findAbstractVariable - Find abstract variable, if any, associated with Var.
|
/// findAbstractVariable - Find abstract variable, if any, associated with Var.
|
||||||
DbgVariable *DwarfDebug::findAbstractVariable(DIVariable &Var,
|
DbgVariable *DwarfDebug::findAbstractVariable(DIVariable &DV,
|
||||||
DebugLoc ScopeLoc) {
|
DebugLoc ScopeLoc) {
|
||||||
|
LLVMContext &Ctx = DV->getContext();
|
||||||
|
// More then one inlined variable corresponds to one abstract variable.
|
||||||
|
DIVariable Var = cleanseInlinedVariable(DV, Ctx);
|
||||||
DbgVariable *AbsDbgVariable = AbstractVariables.lookup(Var);
|
DbgVariable *AbsDbgVariable = AbstractVariables.lookup(Var);
|
||||||
if (AbsDbgVariable)
|
if (AbsDbgVariable)
|
||||||
return AbsDbgVariable;
|
return AbsDbgVariable;
|
||||||
|
|
||||||
LLVMContext &Ctx = Var->getContext();
|
|
||||||
LexicalScope *Scope = LScopes.findAbstractScope(ScopeLoc.getScope(Ctx));
|
LexicalScope *Scope = LScopes.findAbstractScope(ScopeLoc.getScope(Ctx));
|
||||||
if (!Scope)
|
if (!Scope)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -770,8 +770,15 @@ static void fixupLineNumbers(Function *Fn, Function::iterator FI,
|
|||||||
for (BasicBlock::iterator BI = FI->begin(), BE = FI->end();
|
for (BasicBlock::iterator BI = FI->begin(), BE = FI->end();
|
||||||
BI != BE; ++BI) {
|
BI != BE; ++BI) {
|
||||||
DebugLoc DL = BI->getDebugLoc();
|
DebugLoc DL = BI->getDebugLoc();
|
||||||
if (!DL.isUnknown())
|
if (!DL.isUnknown()) {
|
||||||
BI->setDebugLoc(updateInlinedAtInfo(DL, TheCallDL, BI->getContext()));
|
BI->setDebugLoc(updateInlinedAtInfo(DL, TheCallDL, BI->getContext()));
|
||||||
|
if (DbgValueInst *DVI = dyn_cast<DbgValueInst>(BI)) {
|
||||||
|
LLVMContext &Ctx = BI->getContext();
|
||||||
|
MDNode *InlinedAt = BI->getDebugLoc().getInlinedAt(Ctx);
|
||||||
|
DVI->setOperand(2, createInlinedVariable(DVI->getVariable(),
|
||||||
|
InlinedAt, Ctx));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user