Commit Graph

453 Commits

Author SHA1 Message Date
Adrian Prantl
c5dd8bea82 Debug Info: Migrate from MDModule to DIModule.
MDModule was a bitcode-incompatible internal-only extension that has
since been replaced with a blessed IR node on trunk.

<rdar://problem/20965932> Upstream DIModule and support it in clang-700, swiftlang-700, and lldb-700

Swift SVN r29832
2015-07-01 02:25:22 +00:00
Dmitri Hrybenko
2fc1cbe8c1 Adjust to the new IRBuilder APIs
Swift SVN r29692
2015-06-25 22:01:24 +00:00
Adrian Prantl
462fb4b74d Remove an overly strict assertion.
<rdar://problem/21462005>

Swift SVN r29531
2015-06-20 00:03:20 +00:00
Adrian Prantl
cc74abe0f5 Remove a redundant assertion.
Swift SVN r29530
2015-06-20 00:03:18 +00:00
Joe Groff
e57c470019 Introduce a "@box T" type for SIL.
Represents a heap allocation containing a value of type T, which we'll be able to use to represent the payloads of indirect enum cases, and also improve codegen of current boxes, which generates non-uniqued box metadata on every allocation, which is dumb. No codegen changes or IRGen support yet; that will come later.

This time, fix a paste-o that caused SILBlockStorageTypes to get replaced with SILBoxTypes during type substitution. Oops.

Swift SVN r29489
2015-06-18 15:21:52 +00:00
Mark Lacey
39087cd36b Revert "Introduce a "@box T" type for SIL."
This reverts commit r29474 because it looks like it is breaking the
build of the SpriteKit overlay.

Swift SVN r29482
2015-06-18 06:28:04 +00:00
Joe Groff
7b0045c790 Introduce a "@box T" type for SIL.
Represents a heap allocation containing a value of type T, which we'll be able to use to represent the payloads of indirect enum cases, and also improve codegen of current boxes, which generates non-uniqued box metadata on every allocation, which is dumb. No codegen changes or IRGen support yet; that will come later.

Swift SVN r29474
2015-06-18 04:07:03 +00:00
Adrian Prantl
96cc406c7d Debug Info: Ensure classes report their storage size correctly
by wrapping them in a pointer-sized struct as we do for all things passed
by reference.

Fixes rdar://21409965

Swift SVN r29455
2015-06-17 18:19:00 +00:00
Adrian Prantl
e91b59ff79 Debug Info: Also treat tuple types like all other composite types and
create a replaceable forward declaration while building it.
This fixes a crash when building generic enums a tuple element recursively
referenceing the enum.

rdar://problem/21326786

Swift SVN r29416
2015-06-17 00:36:05 +00:00
Adrian Prantl
44f78857f3 Debug Info: Treat subroutine types like all other composite types
and create a replaceable forward declaration while building it.
This fixes a crash when building generic enums with a constructor
function.

<rdar://problem/21294835>

Swift SVN r29411
2015-06-16 23:29:26 +00:00
Adrian Prantl
ab4467dc03 Debug Info: Set the mangled name for temporary composite types
and use DIBuilder::replaceTemporary() to RAUW temporary debug nodes.
This enables more opportunities for IR debug type uniquing.

Swift SVN r29410
2015-06-16 23:29:22 +00:00
Adrian Prantl
767a57bef7 Debug Info: Ensure that an alloca is described by exactly one
dbg.declare.

Caught by an assertion in LLVM.

Swift SVN r29192
2015-05-31 17:38:33 +00:00
Adrian Prantl
1daaf310fb Revert "Reverting commits 29181-29187 to investigate buildbot breakage."
This reverts commit 29189.

Swift SVN r29191
2015-05-31 17:38:32 +00:00
Adrian Prantl
b994bde5b5 Reverting commits 29181-29187 to investigate buildbot breakage.
Swift SVN r29190
2015-05-31 06:13:03 +00:00
Adrian Prantl
a17e6390e7 Debug Info: Unique Archetypes.
With all the previous bugfixes it is no longer necessary to keep separate
copies because inlining and generic specialization is now handled
correctly so each specialized variable has its own specialized version
of the archetype.

rdar://problem/21109015

Swift SVN r29187
2015-05-31 05:39:32 +00:00
Adrian Prantl
c08207e811 Debug Info: Don't emit dbg.declares for SIL-optimized code.
A dbg.declare is only meaningful if there is a single alloca for
the variable that is live throughout the function. With SIL
optimizations this is not guranteed and a variable can end up in
two allocas (for example, one function inlined twice).

Caught by an assertion in LLVM.

rdar://problem/21109015

Swift SVN r29186
2015-05-31 05:39:31 +00:00
Adrian Prantl
7c4de1ff3c Debug Info: Do not keep abstract variables until we can actually unique
them.

Caught by an assertion in LLVM.
rdar://problem/21109015

Swift SVN r29185
2015-05-31 05:39:31 +00:00
Erik Eckstein
daaea3705f Fix a debug-info bug in multi-threaded compilation mode.
The compilation-unit's filename was not set correctly. This led to warnings printed by dsymutil.
There is no radar for this problem.



Swift SVN r28424
2015-05-11 18:12:10 +00:00
Adrian Prantl
acba19a494 Debug Info: Remove an early exit that prevented the swift frontend from
emitting indirect pieces — LLVM (ToT, 700) now supports this.

Since this only happens in optimized code it is currently not feasible
to write a non-flaky testcase for this. I'll revisit this once our
SIL serialization efforts progressed further.

<rdar://problem/19427586> Support indirect pieces

Swift SVN r28051
2015-05-01 22:13:01 +00:00
Adrian Prantl
fa402df22d Debug Info: Anonymous functions should only have a linkage name.
<rdar://problem/20008393> MDSubprogram has name

Swift SVN r27981
2015-04-30 16:30:15 +00:00
Duncan Exon Smith
c6d42db070 Adapt to MD* => DI* renaming of debug info types
Applied the upgrade script from r236120 (LLVM) and r236121 (CFE).  This is the
final step of rdar://problem/20434113.



Swift SVN r27925
2015-04-29 21:40:21 +00:00
Adrian Prantl
a1da38c3aa Adapt IRGenDebugInfo to upstream LLVM IR Metadata changes.
Swift SVN r27709
2015-04-24 20:59:09 +00:00
Erik Eckstein
f362570fb9 Change IRGenModuleDispatcher to a reference in IRGenModule.
According to Sean's feedback.



Swift SVN r27692
2015-04-24 09:17:29 +00:00
Erik Eckstein
58f43c077a Add comment and assert in IRGenDebugInfo.
According to Adrian's feedback.



Swift SVN r27691
2015-04-24 08:53:46 +00:00
Erik Eckstein
8bd9712ed3 Fix crash when compiling a module with a main-file with -g and -wmo -num-threads.
rdar://problem/20655307



Swift SVN r27631
2015-04-23 08:32:47 +00:00
Adrian Prantl
6aaab86390 Debug info: Account for enums with zero elements.
<rdar://problem/20645585> DebugInfo generation assertion failure on swiftz

Swift SVN r27562
2015-04-22 05:21:39 +00:00
John McCall
9f38d8da50 Require a GenericSignature for dependent AbstractionPatterns.
We still don't actually handle these correctly, but at least
we have sensible information for them now.

Also, remember that we're working with canonical generic
signatures in more places.

Swift SVN r27388
2015-04-16 23:27:00 +00:00
Nadav Rotem
f2169f8103 Silence a few more warnings in Release builds.
Swift SVN r27334
2015-04-15 21:38:23 +00:00
Joe Groff
ad0d20c07a Fold "AbstractCC" into SILFunctionType::Representation.
These aren't really orthogonal concerns--you'll never have a @thick @cc(objc_method), or an @objc_block @cc(witness_method)--and we have gross decision trees all over the codebase that try to hopscotch between the subset of combinations that make sense. Stop the madness by eliminating AbstractCC and folding its states into SILFunctionTypeRepresentation. This cleans up a ton of code across the compiler.

I couldn't quite eliminate AbstractCC's information from AST function types, since SIL type lowering transiently created AnyFunctionTypes with AbstractCCs set, even though these never occur at the source level. To accommodate type lowering, allow AnyFunctionType::ExtInfo to carry a SILFunctionTypeRepresentation, and arrange for the overlapping representations to share raw values.

In order to avoid disturbing test output, AST and SILFunctionTypes are still printed and parsed using the existing @thin/@thick/@objc_block and @cc() attributes, which is kind of gross, but lets me stage in the real source-breaking change separately.

Swift SVN r27095
2015-04-07 21:59:39 +00:00
Joe Groff
4821f594bb SIL: Separate SILFunctionType::Representation and ExtInfo from AST FunctionTypes.
The set of attributes that make sense at the AST level is increasingly divergent from those at the SIL level, so it doesn't really make sense for these to be the same. It'll also help prevent us from accidental unwanted propagation of attributes from the AST to SIL, which has caused bugs in the past. For staging purposes, start off with SILFunctionType's versions exactly the same as the FunctionType versions, which necessitates some ugly glue code but minimizes the potential disruption.

Swift SVN r27022
2015-04-05 17:04:55 +00:00
John McCall
dc4b8ff2c2 Incorporate an optional Clang type into AbstractionPattern.
This is necessary for correctly dealing with non-standard
ownership conventions in secondary positions, and it should
also help with non-injective type imports (like BOOL/_Bool).
But right now we aren't doing much with it.

Swift SVN r26954
2015-04-03 21:39:31 +00:00
Duncan Exon Smith
b519148eb9 IRGen: Fix inlined DebugLoc generation for upstream LLVM r233573
`DebugLoc`'s API changed in LLVM r233573.  Start using it now so the build
doesn't break when the old API gets removed.



Swift SVN r26724
2015-03-30 20:28:24 +00:00
Duncan Exon Smith
624776bf42 Revert "DebugInfo: Update for ToT LLVM change r233446"
Revert r26665, since it was insufficient to fix the builders [1].  Instead,
I've loosened the check upstream for now in r233468.




Swift SVN r26672
2015-03-28 02:49:43 +00:00
Duncan Exon Smith
c422680fce DebugInfo: Update for ToT LLVM change r233446
Upstream requires a valid type array for `MDSubroutineType`, so don't create
one unless we actually have parameters.  Should fix the bot [1].





Swift SVN r26665
2015-03-28 01:57:54 +00:00
Adrian Prantl
47aba92ba2 Add an explicit check for null here — LLVM just became stricter.
<rdar://problem/20245578> [BuildCzar][3/20/15] Debug Info Tests are Failing

Swift SVN r26379
2015-03-20 23:54:33 +00:00
Adrian Prantl
3c6af3610a Debug Info: type-unique enum types by virtue of their mangled name.
rdar://problem/20015686

Swift SVN r26104
2015-03-13 18:13:59 +00:00
Adrian Prantl
a100a3e6e9 Debug Info: Don't absolutize file paths.
Fixes <rdar://problem/19985842> REPL should set the default file to "repl.swift"

Swift SVN r26022
2015-03-12 02:56:49 +00:00
Adrian Prantl
d495d2110a Debug Info: Use the storage size for debug types where we previously
didn't and make the assertion about zero-sized types stricter.

<rdar://problem/19978910> Assertion failed: (Ty.getSizeInBits() && "type with size 0"), function getSizeInBits

Swift SVN r25599
2015-02-27 06:25:13 +00:00
Adrian Prantl
17c4a51f45 Debug info: Have a function's name default to its linkage name.
Swift SVN r25502
2015-02-24 17:27:35 +00:00
Adrian Prantl
45544727ac Mark reabstraction thunk helpers as auto-generated.
Fixes <rdar://problem/18670152> Stack trace is a lie.

Swift SVN r25362
2015-02-18 00:46:25 +00:00
Adrian Prantl
833a7f48a5 Adopt upstream LLVM API change.
Swift SVN r25183
2015-02-11 18:29:59 +00:00
Adrian Prantl
1d6d890e13 Adapt upstream LLVM API change.
Swift SVN r25109
2015-02-10 00:55:03 +00:00
David Farler
51f8070abe Serialize local types
Local type declarations are saved in the source file during parsing,
now serialized as decls. Some of these may be defined in DeclContexts
which aren't Decls and previously weren't serialized. Create four new
record kinds:

* PatternBindingInitializer
* DefaultArgumentInitializer
* AbstractClosureExpr
* TopLevelCodeDecl

These new records are used to only preserve enough information for
remangling in the debugger, and parental context relationships.

Finally, provide a lookup API in the module to search by mangled name.
With the new remangling API, the debugging lifecycle for local types
should be complete.

The extra LOCAL_CONTEXT record will compressed back down in a
subsequent patch.

Swift SVN r24739
2015-01-27 01:49:54 +00:00
Adrian Prantl
d1d4fd86f8 Don't emit debug info for global values with hidden visibility.
<rdar://problem/19313855> _TWVVSC26NSKeyValueObservingOptions shows up in global variables

Swift SVN r24695
2015-01-23 23:35:36 +00:00
Adrian Prantl
46edb2891d There are currently situations where two (types that
contains an) archetype(s) mangle to the same name but differ in
their storage size.
This is causing an assertion on some of the build bots.
This works around the problem by not caching them, until I can reproduce
the problem on a smaller scale and fix the mangler.

Swift SVN r24682
2015-01-23 05:39:03 +00:00
Adrian Prantl
15f18f79fa Use getFixedBufferSize() here to clarify the intention.
Swift SVN r24651
2015-01-22 19:56:54 +00:00
Adrian Prantl
5ee2fedc37 Debug info: Use 3xi8 as a fallback type size for %swift.opaque if we
can't determine the storage size.

Swift SVN r24649
2015-01-22 19:42:11 +00:00
Adrian Prantl
171035d974 Debug info: Don't emit a line number for tuple types. They are unnamed
and have no declaration, so the line number is nonsensical.

Swift SVN r24648
2015-01-22 19:42:11 +00:00
Adrian Prantl
723c9aa196 Debug Info: Fix the caching policy for types that cannot be cached,
either because they don't have a UID, or because their Swift type may
be more general than their specialized type.

Swift SVN r24647
2015-01-22 19:42:10 +00:00
Adrian Prantl
a2c9033ac2 Debug info: Don't emit a line number for inout types. They are unnamed
so the line number is nonsensical.

Swift SVN r24646
2015-01-22 19:42:09 +00:00