Commit Graph

60 Commits

Author SHA1 Message Date
Jordan Rose
f74bc7122c Split getAccessibility() into getFormalAccess() and getEffectiveAccess().
Currently a no-op, but effective access for entities within the current
module will soon need to take testability into account. This declaration:

  internal func foo() {}

has a formal access of 'internal', but an effective access of 'public' if
we're in a testable mode.

Part of rdar://problem/17732115 (testability)

Swift SVN r26472
2015-03-24 02:16:58 +00:00
Arnold Schwaighofer
faeaea890e Add a convenience hasSemantics api to ApplyInst.
Swift SVN r26239
2015-03-17 23:27:18 +00:00
Joe Groff
fdde2a8e99 SIL: Add instructions for boxed existential operations.
Parsing and serialization for {Alloc,Open,Dealloc}ExistentialBox instructions to represent operations on ErrorType boxes.

Swift SVN r26145
2015-03-15 03:32:37 +00:00
Joe Groff
962a87f444 SIL: Rename address-only existential instructions to '{init,deinit,open}_existential_addr'.
For better consistency with other address-only instruction variants, and to open the door to new exciting existential representations (such as a refcounted boxed representation for ErrorType).

Swift SVN r25902
2015-03-09 23:55:31 +00:00
Joe Groff
041d7f57a1 PredictableMemOpt: Don't touch structs with unreferenceable storage.
We can't safely decompose them into elements because we don't have access to them all. Fixes rdar://problem/19870485.

Swift SVN r25368
2015-02-18 03:29:51 +00:00
Michael Gottesman
6f8b468cb6 Change switches and selects to use NullablePtr<EnumElementDecl> instead of EnumElementDecl * when their API explicitly requires the user to check for nullptr. NFC.
This is just good to do and hopefully will help prevent people from forgetting
to check in the future by annotating the API explicitly as returning a
potentially nullptr.

Swift SVN r25364
2015-02-18 02:11:57 +00:00
Mark Lacey
6170bbb0ed Minor code clean-up.
Primarily replacing getParent()->getParent() with getFunction().

Swift SVN r24596
2015-01-21 06:35:13 +00:00
Dmitri Hrybenko
94541a5ced Revert "Change select* instructions so that all of them have the same tail allocated"
This reverts commit r24159 because it breaks building the stdandard
library.

Swift SVN r24161
2014-12-28 08:04:45 +00:00
Michael Gottesman
a6bd0cce0f Change select* instructions so that all of them have the same tail allocated
memory layout and add a SelectInst API that allows for one to access select inst
operands when one does not care about what the cases actually are.

Previously select_enum, select_enum_addr had the following memory layout:

  [operands], [cases]

In constrast, select_value had the following layout:

  [operand1, case1, operand2, case 2, ...]

The layout for select_value makes it impossible to just visit operands in a
generic way via a higher level API. This is an important operation for many
analyses such as AA on select insts.

This commit does the following:

1. Adds a new abstract parent class for all select instructions called
SelectInst.
2. Adds a new templated implementation parent class that inherits from
SelectInst called SelectInstBase. This handles the complete implementation of
select for all types by templating on CaseTy.
3. Changes SelectEnumAddrInst, SelectEnumInst, SelectValueInst to be thin
classes that inherit from the appropriately specialized SelectInstBase.

I left in SelectEnumInstBase for now as a subclass of SelectInstBase and parent
class of SelectEnum{,Addr}Inst since it provides specific enum APIs that are
used all over the compiler. All of these methods have equivalent methods on
SelectInstBase. I just want to leave them for a later commit so that this commit
stays small.

Swift SVN r24159
2014-12-27 05:33:18 +00:00
Michael Gottesman
6d52d178c1 Move the subclasses of SILInstruction into a new file SILInstructions.cpp.
SILInstruction was getting large (~1700 loc). Now we have two files, one that is
~1000 loc and the other with ~700 loc.

Swift SVN r23937
2014-12-15 14:09:54 +00:00