Commit Graph

2543 Commits

Author SHA1 Message Date
Chris Lattner
cd99f859e3 NFC code cleanup changes:
- Hoist a duplicated static function with a fixme out to SILValue::getLoc()
 - Fix a whitespace issue.
2017-10-15 15:31:41 -07:00
swift-ci
66e29f1725 Merge remote-tracking branch 'origin/master' into master-next 2017-10-15 00:09:30 -07:00
Roman Levenstein
8104a14219 Merge pull request #12427 from swiftix/sil-serialization-before-optimizations5
Add support for the early serialization of SIL modules using "high-level" SIL and make it the default
2017-10-15 00:03:27 -07:00
Roman Levenstein
882d72b0df Extend SILModule with an API to serialize its content
The `serialize` method can be called multiple times, but it will perform the actual serialization only the first time.
By means of this API we get the flexibility to serialize the SILModule not only after all the optimizations, but  e.g. at any time during optimizations.
2017-10-13 23:19:07 -07:00
swift-ci
2fd5f7ad4c Merge remote-tracking branch 'origin/master' into master-next 2017-10-13 19:09:33 -07:00
Slava Pestov
0acf3ac8d9 SIL: Remove is_nonnull instruction 2017-10-13 17:38:32 -07:00
swift-ci
441abe1c9d Merge remote-tracking branch 'origin/master' into master-next 2017-10-12 18:48:59 -07:00
Michael Gottesman
267d63e085 [sil] Instead of returning an ArrayRef<SILValue> for SILInstruction::getResults(), use SILInstructionResultArray.
The reason that I am doing this is in preparation for adding support for
MultipleValueInstruction. This enables us to avoid type issues and also ensures
that we do not increase the size of SingleValueInstruction while we are doing
it.

The MultipleValueInstruction commit will come soon.

rdar://31521023
2017-10-12 18:30:05 -07:00
swift-ci
8b2ed879a6 Merge remote-tracking branch 'origin/master' into master-next 2017-10-12 15:49:02 -07:00
Doug Gregor
cd3c63cbfd [AST] Stop including GenericSignature.h in other headers.
Except GenericEnvironment.h, because you can't meaningfully use a
GenericEnvironment without its signature. Lots less depends on
GenericSignature.h now. NFC
2017-10-12 14:23:46 -07:00
swift-ci
19aeeb2275 Merge remote-tracking branch 'origin/master' into master-next 2017-10-10 11:29:35 -07:00
Doug Gregor
1f1b75a56d [AST] Eliminate ModuleDecl parameters from GenericSignature. 2017-10-10 10:01:39 -07:00
swift-ci
bfc6390702 Merge remote-tracking branch 'origin/master' into master-next 2017-10-05 22:09:01 -07:00
Roman Levenstein
8e9ce01852 Remove even more dead code after -sil-serialize-all is gone 2017-10-04 14:20:53 -07:00
Roman Levenstein
5e67f755e0 Remove the -sil-serialize-all option 2017-10-04 14:20:53 -07:00
swift-ci
68cb01cc77 Merge remote-tracking branch 'origin/master' into master-next 2017-10-04 12:48:58 -07:00
swift-ci
7a2d0a8242 Merge remote-tracking branch 'origin/master' into master-next 2017-10-04 04:08:57 -07:00
Slava Pestov
e806b6248d SIL: Remove dynamic_method instruction 2017-10-04 03:53:16 -07:00
Slava Pestov
aea309d43c SIL: Move a comment 2017-10-04 03:53:15 -07:00
Slava Pestov
42a4f1d0a8 SIL: Allow objc_method instruction to have type-dependent operands
This will allow us to remove dynamic_method, emitting objc_method
in its place. It will also allow objc_method to be used for
Objective-C protocol method calls, with witness_method used
for Swift native protocol method calls only.
2017-10-04 03:53:15 -07:00
Slava Pestov
7bf3b90b62 SIL: Split off objc_method / objc_super_method from class_method / super_method
This replaces the '[volatile]' flag. Now, class_method and
super_method are only used for vtable dispatch.

The witness_method instruction is still overloaded for use
with both ObjC protocol requirements and Swift protocol
requirements; the next step is to make it only mean the
latter, also using objc_method for ObjC protocol calls.
2017-10-03 22:13:31 -07:00
Slava Pestov
a85f602636 SILGen: Clean up class_method instruction construction a bit 2017-10-03 18:48:19 -07:00
Michael Gottesman
bd7ec5c374 [upstream-update] PointerLikeTypeTraits upstream is a struct not a class.
This eliminates a warning.
2017-10-01 23:22:10 -07:00
swift-ci
f1be638fe9 Merge remote-tracking branch 'origin/master' into master-next 2017-09-29 13:49:15 -07:00
Roman Levenstein
fb0761d97a Add predicates to check if a SILModule is representing the (optimized) OnoneSupport
It is cleaner to use these predicates rather than checking for a complex condition in different places.
2017-09-29 12:36:35 -07:00
swift-ci
9a59d0e479 Merge remote-tracking branch 'origin/master' into master-next 2017-09-27 00:49:24 -07:00
Joe Shajrawi
75939510cd PGO: Use ProfileCounter instead of Optional<uint64_t> to hold profile counts 2017-09-26 13:34:46 -07:00
Joe Shajrawi
f9e58ce851 PGO fixups: rebase on latest master 2017-09-26 11:21:26 -07:00
Joe Shajrawi
f4e6bb3725 PGO: add support for checked_cast__br 2017-09-26 11:14:55 -07:00
Joe Shajrawi
64830c2d5e PGO: add support for checked_cast_addr_br 2017-09-26 11:14:31 -07:00
Joe Shajrawi
2c03144436 Add support for function_entry_count Profile counter 2017-09-26 11:10:52 -07:00
Joe Shajrawi
2cba745df8 PGO: Add support for switch-case statements + initial support for building switch and/or select SIL Instructions with profile count 2017-09-26 11:10:51 -07:00
Joe Shajrawi
7cb5b5a759 PGO: Move profile counts to SILSuccessor 2017-09-26 10:55:05 -07:00
Vedant Kumar
831d2eb44b [SwiftPGO] Store branch taken counts in CondBranchInst (NFC)
Update the SILBuilder and other relevant bits of SILGen s.t we pass
along branch taken counts whenever we create conditional branches.

There is a lot of unfinished work here: we need to teach ParseSIL,
DeserializeSIL, and the SILOptimizer about profile data. And add a
stable AST hasher. And add tests for it all.

Let's skip all of that for now. Next, we'll wire in some actual profile
data.
2017-09-26 10:54:01 -07:00
swift-ci
bb2cac253e Merge remote-tracking branch 'origin/master' into master-next 2017-09-25 15:31:19 -07:00
John McCall
9745ec8269 Build fix for LLDB: resolve ambiguity with operator delete so that
operator new will compile when you're building with exceptions enabled.
2017-09-25 14:41:27 -04:00
swift-ci
135a4286b5 Merge remote-tracking branch 'origin/master' into master-next 2017-09-25 10:29:30 -07:00
John McCall
ab3f77baf2 Make SILInstruction no longer a subclass of ValueBase and
introduce a common superclass, SILNode.

This is in preparation for allowing instructions to have multiple
results.  It is also a somewhat more elegant representation for
instructions that have zero results.  Instructions that are known
to have exactly one result inherit from a class, SingleValueInstruction,
that subclasses both ValueBase and SILInstruction.  Some care must be
taken when working with SILNode pointers and testing for equality;
please see the comment on SILNode for more information.

A number of SIL passes needed to be updated in order to handle this
new distinction between SIL values and SIL instructions.

Note that the SIL parser is now stricter about not trying to assign
a result value from an instruction (like 'return' or 'strong_retain')
that does not produce any.
2017-09-25 02:06:26 -04:00
Bob Wilson
d5fd775703 master-next: Update DomTreeBuilder template declarations.
The declarations that I moved into the header on master do not
match the versions for master-next. This just updates the header
to match the template instantiations in lib/SIL/Dominance.cpp.
2017-09-23 12:00:25 -07:00
Bob Wilson
0276b0f89d Merge remote-tracking branch 'origin/master' into master-next 2017-09-23 10:09:35 -07:00
Bob Wilson
611fb495ab Merge pull request #11811 from bob-wilson/dominator-declarations
Declare DomTreeBuilder template instantiations in Dominance.h
2017-09-22 22:12:02 -07:00
swift-ci
4135e9c841 Merge remote-tracking branch 'origin/master' into master-next 2017-09-21 16:09:54 -07:00
Mark Lacey
c0c848d2b3 Add Builtin.type_join* family of functions.
These will be used for unit-testing the Type::join functionality in the
type checker. The result of the join is replaced during constraint
generation with the actual type.

There is currently no checking for whether the arguments can be used to
statically compute the value, so bad things will likely happen if
e.g. they are type variables. Once more of the basic functionality of
Type::join is working I'll make this a bit more bullet-proof in that
regard.

They include:
  // Compute the join of T and U and return the metatype of that type.
  Builtin.type_join<T, U, V>(_: T.Type, _: U.Type) -> V.Type

  // Compute the join of &T and U and return the metatype of that type.
  Builtin.type_join_inout<T, U, V>(_: inout T, _: U.Type) -> V.Type

  // Compute the join of T.Type and U.Type and return that type.
  Builtin.type_join_meta<T, U, V>(_: T.Type, _: U.Type) -> V.Type

I've added a couple simple tests to start off, based on what currently
works (aka doesn't cause an assert, crash, etc.).
2017-09-21 14:43:26 -07:00
swift-ci
ca31438c0f Merge remote-tracking branch 'origin/master' into master-next 2017-09-19 09:29:03 -07:00
Andrew Trick
699996b917 [sil-opaque-values] Teach the SIL cloner to skip trivial copy/destroy.
This reduces the amount of SIL generated by 14x.
2017-09-19 09:09:48 -07:00
swift-ci
9a6ea33cc1 Merge remote-tracking branch 'origin/master' into master-next 2017-09-18 19:49:11 -07:00
Erik Eckstein
fb935a3d49 SIL: support statically initialized StaticString globals
The main part of the change is to support the ptr_to_int builtin in statically initialized globals. This builtin is used to build a StaticString from a string_literal.
On the other hand I removed the support of the FPTrunc builtin, which is not needed anyway (because it can be constant propagated).
2017-09-18 17:50:24 -07:00
swift-ci
0c10a9e201 Merge remote-tracking branch 'origin/master' into master-next 2017-09-15 18:29:43 -07:00
Andrew Trick
363b1385ae [sil-opaque-values] Don't set reference-counted flag during lowering.
With sil-combine test case.
2017-09-15 16:58:56 -07:00
swift-ci
b51e2e6837 Merge remote-tracking branch 'origin/master' into master-next 2017-09-15 13:29:49 -07:00