Commit Graph

93 Commits

Author SHA1 Message Date
Xin Tong
e2c0990851 Rename hasNoUsesExceptDebug to onlyHaveDebugUses. The double negation logic is
harder to understand. NFC.
2016-02-10 14:46:09 -08:00
Michael Gottesman
95b33233c3 SILTypeList was removed... Removing LLVM_DECLARE_TYPE_ALIGNMENT for it. 2016-02-06 11:22:28 -08:00
Jordan Rose
91b72d3802 Fold the rest of PointerLikeTypeTraitsFwdDecl.h into TypeAlignments.h.
TypeAlignments.h predates this whole mess; it was used for types with
stronger alignment in PointerLikeTypeTraits than the old default of
"2 by fiat and assumption". All remaining forward-declared types are
AST types, so fold them into TypeAlignments.h.

(The one exception is SILTypeList.h, but that's already gone on master.)

To avoid future ODR issues, explicitly include TypeAlignments.h into
every header that defines a type it forward-declares.

I wish we could use partial specialization to provide PointerLikeTypeTraits
for all derived classes of Decl, TypeBase, etc, but that's not something
you can do in C++ if you don't control the traits class.
2016-02-06 11:22:28 -08:00
Michael Gottesman
3556db7484 Add in explicit specializations for forward declared pointers that we use. All of the explicit specializations are in the new header "PointerLikeTypeTraitsFwdDecl.h" 2016-02-06 11:22:28 -08:00
Erik Eckstein
9f83c43a02 SIL: remove unused functions from SILValue 2016-01-26 09:37:08 -08:00
Erik Eckstein
74d44b74e7 SIL: remove SILValue::getDef and add a cast operator to ValueBase * as a repelacement. NFC. 2016-01-25 15:00:49 -08:00
Erik Eckstein
aef0a11a7c remove some unneeded forward declearations 2016-01-25 15:00:49 -08:00
Erik Eckstein
d3c975391f SIL: remove dump and print from SILValue
If you want to dump a SILValue from the debugger, use Value->dump()
2016-01-25 15:00:49 -08:00
Erik Eckstein
845b3fe08e SIL: remove isValid() from SILValue. NFC 2016-01-25 15:00:49 -08:00
Erik Eckstein
506ab9809f SIL: remove getTyp() from SILValue 2016-01-25 15:00:49 -08:00
Erik Eckstein
5a53b31f57 SIL: remove use-iteration functions from SILValue.
They are not needed anymore. NFC.
2016-01-25 15:00:49 -08:00
Erik Eckstein
b745691a38 SIL refactoring: Move some functions out of SILValue and Operand
SILValue.h/.cpp just defines the SIL base classes. Referring to specific instructions is a (small) kind of layering violation.
Also I want to keep SILValue small so that it is really just a type alias of ValueBase*.
NFC.
2016-01-25 10:37:03 -08:00
Erik Eckstein
ec172cde5b Remove SILValue::replaceAllUsesWith.
It's not needed anymore because we can use ValueBase::replaceAllUses
2016-01-21 16:04:30 -08:00
Erik Eckstein
2db6f3d213 SIL: remove multiple result values from SILValue
As there are no instructions left which produce multiple result values, this is a NFC regarding the generated SIL and generated code.
Although this commit is large, most changes are straightforward adoptions to the changes in the ValueBase and SILValue classes.
2016-01-21 10:30:31 -08:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
practicalswift
fa0b339a21 Fix typos. 2015-12-26 17:51:59 +01:00
practicalswift
8ab8847684 Fix typos. 2015-12-16 22:09:32 +01:00
Michael Gottesman
a9a5780a6f Standardize style and eliminate trailing whitespace. NFC.
Swift SVN r31419
2015-08-23 04:36:01 +00:00
Michael Gottesman
74a984de6b Rename SILValue::stripAggregateProjections => SILValue::stripValueProjections.
This matches the terminology used in Projection. NFC.

Swift SVN r31418
2015-08-23 04:27:24 +00:00
Dmitri Hrybenko
37a4335b88 Replace swift::Range with llvm::iterator_range
Due to inreased use of llvm::make_range in LLVM headers and ADL for
types defined in the swift namespace, some of the LLVM headers started
to trigger ambiguity errors between llvm::make_range and
swift::make_range.

Swift SVN r29700
2015-06-25 22:01:39 +00:00
Erik Eckstein
3092f3c15f Document the utility functions for handling debug_value instructions, introduced in r28872.
Swift SVN r29064
2015-05-27 10:49:55 +00:00
Erik Eckstein
f39291772c Remove const_use_iterator from SILValue and ValueBase.
It was defined as the const version of use_iterator, which was wrong (e.g. you can't increment it).
Actually we don't need it at all: use_begin/use_end can be const and return the non-const iterator,
because a value is not the container of its uses.



Swift SVN r28870
2015-05-21 13:12:12 +00:00
Arnold Schwaighofer
0c6363a399 SILValue: Add an api to strip expect intrinsics
Swift SVN r27838
2015-04-27 23:43:41 +00:00
John McCall
dc4b8ff2c2 Incorporate an optional Clang type into AbstractionPattern.
This is necessary for correctly dealing with non-standard
ownership conventions in secondary positions, and it should
also help with non-injective type imports (like BOOL/_Bool).
But right now we aren't doing much with it.

Swift SVN r26954
2015-04-03 21:39:31 +00:00
John McCall
dc5a03a7bc Add IRGen support for error results from functions.
As part of this, re-arrange the argument order so that
generic arguments come before the context, which comes
before the error result.  Be more consistent about always
adding a context parameter on thick functions, even
when it's unused.  Pull out the witness-method Self
argument so that it appears last after the error
argument.

Swift SVN r26667
2015-03-28 02:00:17 +00:00
Arnold Schwaighofer
a95eefb934 Add a utility function to Operand to hoist projections rooted in an operand to
an earlier point.

Swift SVN r25618
2015-02-27 22:07:38 +00:00
Michael Gottesman
359d67274e [closure-spec] Add support for propagating thin_to_thick_function closures.
<rdar://problem/18995320>

Swift SVN r24770
2015-01-28 01:36:38 +00:00
Erik Eckstein
88c674161c refactoring: Add operator for comparing OperandValueArrayRefs.
And use it in SimplifyCFG. NFC



Swift SVN r23581
2014-11-25 09:43:35 +00:00
Roman Levenstein
ab7b1c26ca Move stripClassCasts into SILValue. NFC.
Swift SVN r23539
2014-11-21 22:21:52 +00:00
Roman Levenstein
ed22906964 Add helper methods to strip upcasts. This is required for upcoming devirtualizer patches.
Swift SVN r22602
2014-10-08 13:09:05 +00:00
Arnold Schwaighofer
855657511a Document ValueBase::getParentBB
Swift SVN r21931
2014-09-12 21:12:11 +00:00
Arnold Schwaighofer
36ad6d2faa ValueBase: Add getParentBB api
Swift SVN r21925
2014-09-12 21:05:21 +00:00
Michael Gottesman
4609513593 Remove SILValue::stripRCIdentityPreservingArgs and teach all uses of that method to use the new RCIdentityAnalysis.
Currently, the pass just calls a local version of that function. After OzU, I
will enable the full pass (which is currently disabled behind a flag).

Swift SVN r21894
2014-09-11 22:29:31 +00:00
Michael Gottesman
875fa02f98 Hide SILValue::stripSinglePredecessor{Args,RCIdentityPreservingArgs}.
These really should never have been exposed since they are internals to
SILValue.

Swift SVN r21868
2014-09-11 05:44:58 +00:00
Michael Gottesman
b30b212d04 Remove the term non-PHI and instead use SinglePredecessor.
Swift SVN r21340
2014-08-21 04:13:27 +00:00
Michael Gottesman
f3145119b9 Add SILValue::stripNonPHIArgs and SILValue::stripNonPHIRCIdentityPreservingArgs
for looking through SILArguments that are not PHIs in a load-store and ARC
optimizer context respectively.

Swift SVN r21328
2014-08-20 23:40:49 +00:00
Michael Gottesman
56d51ca9f1 [g-arc-opts] Teach the ARC optimizer how to strip off ref count equivalent operations such as casts and ref count identity preserving typed geps.
Now that the ARC optimizer does not rely on stripCasts I also added
unchecked_trivial_bit_cast to stripCasts.

This and r21164 give the following speedups > 10%:

Ary      55.95%
MatMul   36.71%
Ary2     34.97%
Richard  32.08%
PrimeNum 15.87%

<rdar://problem/17456455>

Swift SVN r21240
2014-08-15 22:47:57 +00:00
Mark Lacey
19fd2ce0d2 Clean-up hashing in CSE by using the stored kind of the inst.
Swift SVN r18703
2014-06-04 18:21:59 +00:00
Joe Groff
d6957d0328 Make existential-to-concrete metatype casts work.
This mostly falls out from the metatype cast infrastructure, but we need to generalize some Sema and SILGen code to accept AnyMetatypeType. Concrete-to-existential metatypes will need more runtime checking that isn't implemented, so raise a 'not implemented' error on those for now.

Swift SVN r17798
2014-05-09 20:57:55 +00:00
Michael Gottesman
fd0a78b301 [sil-combine] Canonicalize index_raw_addr byte indexing operations => index_addr object size indexing operations.
This should eliminate pointless operations that get added to our inline
cost itinerary.

rdar://15567647
rdar://16762768
rdar://16832529

Swift SVN r17644
2014-05-07 22:01:30 +00:00
Mark Lacey
739eba9f2e Reformat assert so that the message isn't split.
Swift SVN r16507
2014-04-18 07:19:30 +00:00
Mark Lacey
6ac1e51370 Add an assert to detect an instruction being added as an operand of itself.
Swift SVN r16303
2014-04-14 05:40:31 +00:00
Joe Groff
d149851607 SILGen: Copy blocks received as function arguments.
We want to generally treat blocks as heap objects until proven stack-able by escape analysis, like we do generally with other heap entities. The only place we should be exposed to stack blocks is when they're passed as arguments, so handle this by copy_block'ing any block arguments we get in the function prolog. Optimization can eliminate them when analysis shows the block doesn't escape or is already on the heap.

Swift SVN r16096
2014-04-09 04:35:17 +00:00
Michael Gottesman
8740666034 Change SILCloner to be able to remap additional non-instruction based SILValues such as SILUndef.
Previously we only supported SILArguments. In the process of changing this I
noticed that our densemap implementation for SILValues only hashes the wrapped
ValueBase instead of hash combining that hash with a hash of the result number.

The main use case for this is to enable the insertion of a Builtin.trap + RAUW
SILUndef of uses of an unconditional_checked_cast that is invalid after
specialization.

rdar://16490450

Swift SVN r15747
2014-04-01 21:09:41 +00:00
Michael Gottesman
5327c3b089 Print out the result number of the SILValue when you print it out.
Swift SVN r13613
2014-02-07 00:50:19 +00:00
Michael Gottesman
9a297333f9 Enable printing of AliasAnalysis::AliasResult and SILValues.
Swift SVN r13577
2014-02-06 10:06:20 +00:00
Michael Gottesman
2afa5075fd Add SILValue::stripIndexingInsts() which strips of index_addr, index_raw_pointer from SILValues.
Swift SVN r13444
2014-02-04 20:25:48 +00:00
Michael Gottesman
35d1f4aa1c Rename SILValue::stripObjectProjections() => SILValue::stripAggregateProjections.
Swift SVN r12931
2014-01-24 19:48:02 +00:00
Michael Gottesman
bbc1093efd Add SILValue::stripObjectProjections().
This method looks recursively through the operand chain of the given SILValue
until it finds a non-object projection instruction. It then returns that value.

An object projection instruction is one of:

1. struct_extract.
2. tuple_extract.

Swift SVN r12918
2014-01-24 18:20:10 +00:00
Michael Gottesman
8db21be9e5 Fix typo from last night.
Swift SVN r12917
2014-01-24 18:12:13 +00:00