DCE is added as a separate SIL pass with it's own entry point.
For now, detect and simplify the branch instructions with constant
conditions and delete unreachable basic blocks (for now, we do not even
pay any regards to the basic block arguments).
Swift SVN r6713
This makes it very clear who is depending on special behavior at the
module level. Doing isa<ClangModule> now requires a header import; anything
more requires actually linking against the ClangImporter library.
If the current source file really can't import ClangModule.h, it can
still fall back to checking against the DeclContext's getContextKind()
(and indeed AST currently does in a few places).
Swift SVN r6695
Standardize on the more-common "superclass" and "subclass" terminology
throughout the compiler, rather than the odd mix of base/derived and
super/sub.
Also, have ClassDecl only store the Type of the superclass. Location
information will be part of the inheritance clause for parsed classes.
Swift SVN r6687
Add a getBits() method to FloatLiteralInst so we don't need to round trip APInt -> APFloat -> APInt to print the bits in the printer. Use allocateLiteralInstWithBitSize instead of -WithTextSize to avoid wasting space.
Swift SVN r6680
This way we don't need to deal with the inaccuracy of decimal float literals. While we're here, modify the in-memory representation of IntegerLiteralInst and FloatLiteralInst to save the word array of the APInt instead of round-tripping through plain text.
Swift SVN r6676
Now that we actually support generic protocol methods, we can end up specializing non-thin function values (because the protocol_method/archetype_method value carries the This metadata as payload), so the thin-ness of the specialized function type needs to be constrained by the input type's thinness. Relax the verifier to allow a specialize inst to produce a thick value if its input is thick.
Swift SVN r6598
The user-specified constructor() and destructor() were marked with an extra attribute (initializing and destroying) for classes, vs. the allocating and deallocating destructors which had no extra cruft
(but hardly anyone would care about them since they are system-provided)
This checkin (discussed with Joe Groff changes) the behavior of the demangler such that the user's constructors and destructors now demangle as one would expect:
; CHECK: _TC3foo3barcfMS0_FT_S0_ ---> foo.bar.constructor : (foo.bar.metatype)() -> foo.bar
; CHECK: _TC3foo3bard ---> foo.bar.destructor
and the system-provided allocator/deallocator demangles with a clearly distinguishable name:
; CHECK: _TC3foo3barCfMS0_FT_S0_ ---> foo.bar.__allocating_constructor : (foo.bar.metatype)() -> foo.bar
; CHECK: _TC3foo3barD ---> foo.bar.__deallocating_destructor
Swift SVN r6573
"SILConstant" doesn't really describe its role in SIL anymore, which is to provide a reference to a Swift declaration in a SIL instruction, such as a method or nominal type field.
Swift SVN r6559
The new demangler is in the "swift/SIL/Demangle.{h|cpp}" files, and in the swift::Demangle namespace, which has two public entry points:
std::string demangleSymbol(llvm::StringRef mangled);
std::string demangleType(llvm::StringRef mangled);
This was necessary to support the need for LLDB to demangle Swift symbol (and type) names
Test case is included
Swift SVN r6547
promotion. This pass is destined to be somewhat different than
LLVM's mem2reg pass:
- Because we can't break debug information, this won't remove
alloc_stack (and the stores to it) for allocations with location info.
- Because this gates other dataflow diagnostics, we don't want a value
being pinned to the stack to prevent promotion. Instead, we promote
all loads that we can, even if some end up being blocked by a [byref]
"may" store.
Lots of caveats herein:
- This doesn't do cross block promotion yet.
- This doesn't remove the allocation even when it is allowed to.
- This causes a few IRGen test failures, including an irgen crash.
- This should be split out to its own file, its own pass, and its own
testcase.
Because of these caveats, this is disabled by default right now. Pass -enable-stack-promotion to get it.
Swift SVN r6454
not insert destroy_addr instructions when a type is trivial. This also works
around its other limitation (not handling multiple final releases), allowing it
to promote 73 more boxes.
Swift SVN r6436
Add a convenience SILModule::getTypeLoweringInfo forwarder, and move the emitRetainRValue and emitReleaseRValue helpers from SILGenFunction to SILBuilder so they're more readily available to non-SILGen passes. Add an emitDestroyAddress helper that emits nothing, destroy_addr, or load + release based on the value semantics of the referenced type.
Swift SVN r6431
SIL passes need to have the value semantics information in TypeLoweringInfo available by SILType. Refactor getTypeLoweringInfo into separate "derive the SILType from a Swift type" and "determine the value semantics for a SILType" stages, and index the resulting TypeLoweringInfo by both (CanType, uncurryLevel) and SILType.
Swift SVN r6429