Commit Graph

16 Commits

Author SHA1 Message Date
Michael Gottesman
3ad6f33202 Teach the generic specializer how to create SILWitnessTable declarations if a specialized conformance does not have a witness table.
This also teaches IRGen not to emit WitnessTable declarations. This
causes them to be left as unknown symbols in the resulting executable.

Swift SVN r15361
2014-03-22 05:05:47 +00:00
Michael Gottesman
fbfd9778d4 [deserialization] Teach generic specializer how to link functions.
Swift SVN r15095
2014-03-14 23:46:20 +00:00
Michael Gottesman
13b74af686 [specializer] Do not use the old instructions location when cloning. Instead use getOpLocation.
Swift SVN r15025
2014-03-14 04:35:30 +00:00
Joe Groff
a404b0cd49 Rework Substitution::subst not to depend on the meaningless 'Archetype' field of Substitutions.
Pass in the context generic parameters that correspond to the substitution vector in Substitution::subst. When we build the type substitution map, also collect the conformances from the substitutions into a map we can use to fill in those conformances in substituted substitutions where necessary, without relying on the '.Archetype' field.

Swift SVN r14964
2014-03-12 20:29:46 +00:00
Michael Gottesman
f1c9127a89 [serializer] Add some debug messages to the deserializer.
Swift SVN r14859
2014-03-10 01:17:18 +00:00
Michael Gottesman
3cc621b188 Remove trailing whitespace. NFC.
Swift SVN r14858
2014-03-10 01:17:17 +00:00
Chris Lattner
001c1890e5 put all the SIL*Transform classes in anonymous namespaces, there is
no need for their symbols to be exported out of their implementation
file.


Swift SVN r14714
2014-03-06 01:49:53 +00:00
Joe Groff
88b6efcc43 Rename ArchetypeMethodInst -> WitnessMethodInst more thoroughly.
Swift SVN r14501
2014-02-28 06:41:18 +00:00
Joe Groff
59d2a169f6 SIL: Rename 'archetype_method' to 'witness_method'.
It has been generalized to get a witness out of an arbitrary protocol conformance, not just for archetypes.

Swift SVN r14497
2014-02-28 05:09:11 +00:00
Joe Groff
7b28da3488 SIL: Always substitute SILFunctionTypes using their interface types.
Have SILType::subst and SILFunctionType::subst always visit the interface types of a SILFunctionType. Fix up some problems in the specializer this exposed by having it correctly apply interface type substitutions to the function type of a specialized function and contextualized substitutions to the body.

Swift SVN r13714
2014-02-09 20:23:07 +00:00
Andrew Trick
731000b4cd Added -sil-print-all and -sil-verify-all options.
Swift SVN r13662
2014-02-07 23:07:11 +00:00
Nadav Rotem
3227f250cc Reindent the block.
Swift SVN r13648
2014-02-07 19:37:37 +00:00
Nadav Rotem
32d31122ff Generic specialize recursive calls.
With this change we are able to specialize generic recursive functions.
There are a few recursive generic functions in our String representation
and in qsort.

This patch accelerates all of the String benchmarks.



Swift SVN r13643
2014-02-07 19:17:30 +00:00
Andrew Trick
04b2b5256b First implementation of <rdar://15922760> Deep devirtualization -
specialize on polymorphic arguments.

This can be enabled with: -sil-devirt-threshold 500.

It currently improves RC4 (when enabled) by 20%, but will be much more
important after Michael's load elimination with alias analysis lands.

This implementation is suitable for experimentation. Superficial code
reviews are also welcome. Although be warned that the design is overly
complex and I plan to rewrite it. I initially abandoned the idea of
incrementally specializing one function at a time, thinking that we
need to analyze full chains. However, I since realized after talking
to Nadav that the incremental approach can be made to work. A lot of
book-keeping will go away with that change.

TODO:

- Resolve protocol argument types. Currently we assume they can be
  reinitialized at applies, but I don't think they can unless they are
  @inouts.  This is an issue with the existing local devirtualizer
  that prevents it working across calls.

- Properly mangle the specialized methods. Find existing
  specializations by demangling rather than maintaining a map.

- Rewrite the logic for specializing chains for simplicity.

- Enable by default.

Swift SVN r13642
2014-02-07 19:10:27 +00:00
Nadav Rotem
1ef0d157ca PassManager: Inject the function/module into the Transformation.
Now the pass does not need to know about the pass manager. We also don't have
runOnFunction or runOnModule anymore because the trnasformation knows
which module it is processing. The Pass itself knows how to invalidate the
analysis, based on the injected pass manager that is internal to the
transformation.

Now our DCE transformation looks like this:

class DCE : public SILModuleTransform {
  void run() {
    performSILDeadCodeElimination(getModule());
    invalidateAnalysis(SILAnalysis::InvalidationKind::All);
  }
};





Swift SVN r13598
2014-02-06 22:11:21 +00:00
Nadav Rotem
e4cc6fc139 Rename Specializer.cpp to GenericSpecializer.cpp ;
We are about to start specializing calls in the devirtualizer so GenericSpecialzier is a more accurate name.


Swift SVN r13585
2014-02-06 17:41:05 +00:00