This is a very initial version mostly to get machinery in place before we start
considering more interesting things.
Specifically we do not:
1. Inline functions with any substitutions.
2. Inline functions that are not thin.
3. Inline functions in any recursive manner (i.e. we just follow the call tree
and inline until we run out of cost).
4. Remove functions that we have completely inlined as a good citizen should.
Additionally the cost model is purposely simplistic and assumes that every SIL
instruction is one to one with an LLVM instruction (when many do not become any
LLVM instruction and others become 2). The idea is simply to put a cost on the
total increase in code size we allow due to inlining in a specific function.
Thus we just continually inline until we run out our inlining budget.
Even with the current limitations we inline 1248 apply inst in the stdlib when
setting a cost threshold of 225.
Swift SVN r11596
'doIt' is semantically meaningless, and doesn't mention the fact that nothing
has actually been compiled yet (to SIL, to IR, or to machine code).
'performParse' matches the compiler flag -parse, which stops after
type-checking.
No functionality change.
Swift SVN r10951
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
This patch contains an initial implementation of CSE for SIL ported from LLVM's
earlycse pass. It follows the overall general structure using
ScopedHashTables/DominatorTrees to perform the computation.
Currently it only handles integer literals to ease with the initial review. Once
this gets in I will be spending some time extending the pass to handle other
instructions.
Even with just handling integers this reduces the size of the stdlib in SIL by
~300 lines.
Swift SVN r10794
Ideally this wouldn't be necessary, but the type substitution APIs required by generic specialization and SIL verification currently require a Module* pointer, and it's obnoxious to have to pass it down separately everywhere it's needed. Longer-term the reliance on Modules for type substitution might be able to go away.
Swift SVN r9866
dead blocks (which happens to be incorrect).
Unlike the LLVM SimplifyCFG pass, this one will be worklist-based instead of
iterative, avoiding needless iteration over the entire function when a small
local changes are being made.
Swift SVN r9756
This pass is a port of InstCombine from LLVM to SIL. Thus if you are familiar
with the code from InstCombine you will feel right at home.
Keep in mind that in order to help with review, this is just a skeleton with no
optimizations in it besides a simple DCE based off of isInstructionTriviallyDead
(which this patch exposes in Local.h like LLVM does) to ensure that trivial
testing of the pass can be accomplished since otherwise it would do nothing
implying that no tests could be written at all.
I additionally modified one test which no longer passed due to SILCombine
removing 1x unused metatype instruction from the standard library.
Swift SVN r9404
- Introduces the Builtin
- If the first parameter evaluates to '1', the dataflow diagnostics pass produces a diagnostic.
- The Builtin gets cleaned up before IRGen, but not before SIL serialization.
This patch also removes the current, overflow warning and XFAILs one of the tests. The other test is switched to use Builtin.staticReport.
TODO:
- Utilize the other parameters to the builtin - the Message and IsError flag.
- Use this Builtin within the stdlib.
Swift SVN r8939
pass to be -definite-init instead of -memory-promotion, rename the
entrypoint for the pass to match, and tidy various and sundry comments.
Swift SVN r8927
Make ApplyInst and PartialApplyInst directly take substitutions for generic functions instead of trying to stage out substitutions separately. The legacy reasons for doing this are gone.
Swift SVN r8747
definite initialization, promoting boxes to stack, building ssa, and doing definite
initialization.
I'll build this in place, then kill off the other two passes when this subsumes them.
Swift SVN r6903
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 mainly removes the extraneous DiagnosticEngine and SourceMgr from CompilerInvocation.
Instances of these can be found via the CompilerInstance object.
Swift SVN r6496