Reapply "Serialize debug scope and location info in the SIL assembler language.""

This ireapplies commit 255c52de9f.

Original commit message:

Serialize debug scope and location info in the SIL assembler language.
At the moment it is only possible to test the effects that SIL
optimization passes have on debug information by observing the
effects of a full .swift -> LLVM IR compilation. This change enable us
to write targeted testcases for single SIL optimization passes.

The new syntax is as follows:

 sil-scope-ref ::= 'scope' [0-9]+
 sil-scope ::= 'sil_scope' [0-9]+ '{'
                 sil-loc
                 'parent' scope-parent
                 ('inlined_at' sil-scope-ref )?
               '}'
 scope-parent ::= sil-function-name ':' sil-type
 scope-parent ::= sil-scope-ref
 sil-loc ::= 'loc' string-literal ':' [0-9]+ ':' [0-9]+

Each instruction may have a debug location and a SIL scope reference
at the end.  Debug locations consist of a filename, a line number, and
a column number.  If the debug location is omitted, it defaults to the
location in the SIL source file.  SIL scopes describe the position
inside the lexical scope structure that the Swift expression a SIL
instruction was generated from had originally. SIL scopes also hold
inlining information.

<rdar://problem/22706994>
This commit is contained in:
Adrian Prantl
2016-02-26 13:28:48 -08:00
parent a91cc97058
commit 310b0433a9
60 changed files with 883 additions and 456 deletions

View File

@@ -227,7 +227,7 @@ SILFunction *SILModule::getOrCreateFunction(SILLocation loc,
auto fn = SILFunction::create(*this, linkage, name, type, nullptr,
loc, isBareSILFunction, isTransparent,
isFragile, isThunk, CV);
fn->setDebugScope(new (*this) SILDebugScope(loc, *fn));
fn->setDebugScope(new (*this) SILDebugScope(loc, fn));
return fn;
}
@@ -343,7 +343,7 @@ SILFunction *SILModule::getOrCreateFunction(SILLocation loc,
inlineStrategy, EK);
if (forDefinition == ForDefinition_t::ForDefinition)
F->setDebugScope(new (*this) SILDebugScope(loc, *F));
F->setDebugScope(new (*this) SILDebugScope(loc, F));
F->setGlobalInit(constant.isGlobal());
if (constant.hasDecl()) {