This completes the FileUnit refactoring. A module consists of multiple
FileUnits, which provide decls from various file-like sources. I say
"file-like" because the Builtin module is implemented with a single
BuiltinUnit, and imported Clang modules are just a single FileUnit source
within a module.
Most modules, therefore, contain a single file unit; only the main module
will contain multiple source files (and eventually partial AST files).
The term "translation unit" has been scrubbed from the project. To refer
to the context of declarations outside of any other declarations, use
"top-level" or "module scope". To refer to a .swift file or its DeclContext,
use "source file". To refer to a single unit of compilation, use "module",
since the model is that an entire module will be compiled with a single
driver call. (It will still be possible to compile a single source file
through the direct-to-frontend interface, but only in the context of the
whole module.)
Swift SVN r10837
Existing uses use a "globalvar" kind. Add a new "rootinit" kind which
will be used for root initializers (i.e. init methods of structs, enums,
and root classes).
Swift SVN r10772
The code here is a simple checklist. It performs the following checks in order:
1. Quick check to see if the kind/number of operands/number of types match up.
2. Comparison all of the types/operands.
3. Finally use a switch to perform specialized per instruction comparisons on
state not represented in the instructions types/operands (i.e. vardecls,
structdecls, etc.).
Additionally the switch is setup so that instructions which have not been fully
implemented in the switch will cause an unreachable to be hit. Once all
instructions have isIdenticalTo implementations (implying the switch is
covered), I will remove the unreachable.
*NOTE* The primary use case for this now is CSE. In CSE we can control which
instructions we process so during the review process I am only going to process
literals for the sake of simplicity (and thus this patch contains only code for
checking literals).
Swift SVN r10743
a FuncDecl. This makes it much more straight-forward for SIL passes to
introduce a new one - without doing name lookup in the builtin module!
Swift SVN r10694
Like GlobalAddrInst, but for SILGlobalVariables. These would become the same instruction when SILGlobalVariable can replace AST-level global references.
Swift SVN r10510
This will let us control linkage and emit new variables independent of the AST in SILGen. In particular, for lazy global initialization, we need to emit a unique internal once predicate for every top-level pattern binding. Switching everything over is a bit much to reengineer all at once, so for now, it can coexist with the globals map that is already there.
Swift SVN r10509
- Enhance SILBuilder::emitStrongRelease to be smarter.
- Start using emitStrongRelease in type lowering, SILGen,
CapturePromotion (replacing its implementation of the
same logic), and MandatoryInlining (one more place)
- Rename the primitive createStrongRetain/ReleaseInst
instructions to lose their suffix.
- Now that createStrongRetain/ReleaseInst are not special
cases from the naming perspective, remove some special cases
from DeserializeSIL and ParseSIL.
Swift SVN r10449
They are the same as createStrongRetainInst and createStrongReleaseInst, but
peephole away FunctionRefInst. It turns out that there is only a couple
places in SILGen where this behavior is necessary, and this tramples on the
general pattern used in SILBuilder.
Swift SVN r10448
scanning up the local block to see if it immediately cancels a retain
operation.
Use this in mandatory inlining to zap more retains and release. Before
this patch, the result LogicValue allocation blocked this optimization,
preventing the partial_apply from being deleted from the case in
rdar://15328833.
Swift SVN r10447
(the same way alloc_box returns two) instead of returning a tuple.
This eliminates a ton of tuple_extract instructions, which just
bloat the generated SIL. This resolves rdar://15378135.
Swift SVN r10416
We were failing to capture generic parameters from closure contexts that themselves capture generic parameters from context. This fixes <rdar://problem/15417783>. While we're here, eliminate some unnecessary splitting of 'ClosureExpr' and 'AutoClosureExpr' in the SILDeclRef::Loc PointerUnion; we can just use their base class AbstractClosureExpr in the PointerUnion.
Swift SVN r10031
In cases like the one below, replace the integer_literal instructions
with the condition branching to the block that the instruction is in.
cond_br %10, bb1, bb3
bb1:
%13 = integer_literal $Builtin.Int1, -1
br bb2(%13 : $Builtin.Int1)
bb3:
%18 = integer_literal $Builtin.Int1, 0
br bb2(%18 : $Builtin.Int1)
Similarly, for
switch_enum %0 : $Bool, case #Bool.true!enumelt: bb1
bb1:
%1 = enum $Bool, #Bool.true!enumelt
we'll replace the enum with %0.
Use this functionality from within the CFG simplification pass to
simplify basic block args in an attempt to expose opportunities for
further CFG simplification.
Swift SVN r9968