Audit all SILPasses to ensure that new instructions are never created

without a valid SILDebugScope. An assertion in IRGenSIL prevents future
optimizations from regressing in this regard.
Introducing SILBuilderWithScope and SILBuilderwithPostprocess to ease the
transition.

This patch is large, but mostly mechanical.
<rdar://problem/18494573> Swift: Debugger is not stopping at the set breakpoint

Swift SVN r22978
This commit is contained in:
Adrian Prantl
2014-10-28 01:49:11 +00:00
parent 35488903d3
commit c41b30299f
36 changed files with 383 additions and 211 deletions

View File

@@ -285,4 +285,39 @@ SILValue SILBuilder::emitObjCToThickMetatype(SILLocation Loc, SILValue Op,
return createObjCToThickMetatype(Loc, Op, Ty);
}
#ifndef NDEBUG
/// Determine whether an instruction may not have a SILDebugScope.
bool swift::maybeScopeless(SILInstruction &I) {
// This list is supposed to get ever shorter as we are tightening
// the requirements for the optimizer.
switch (I.getLoc().getKind()) {
case SILLocation::CleanupKind:
case SILLocation::ImplicitReturnKind:
case SILLocation::ArtificialUnreachableKind:
case SILLocation::SILFileKind:
return true;
default: break;
}
if (!I.getLoc().isNull() || I.getLoc().isAutoGenerated())
return true;
switch (I.getKind()) {
case ValueKind::BranchInst:
case ValueKind::CondBranchInst:
case ValueKind::DebugValueAddrInst:
case ValueKind::DebugValueInst:
case ValueKind::GlobalAddrInst:
case ValueKind::ReleaseValueInst:
case ValueKind::RetainValueInst:
case ValueKind::StrongReleaseInst:
case ValueKind::StrongRetainInst:
case ValueKind::TupleInst:
case ValueKind::UnreachableInst:
return true;
default: break;
}
auto *Fn = I.getParent()->getParent();
return Fn->isTransparent() || Fn->isBare();
}
#endif