Commit Graph

388 Commits

Author SHA1 Message Date
Chris Lattner
69d0afb658 rename [force_inlining] to [transparent].
Swift SVN r7448
2013-08-22 16:05:41 +00:00
Manman Ren
c851c54ccd SIL Parser: parse switch_int.
Swift SVN r7301
2013-08-16 22:58:39 +00:00
Stephen Lin
5fc7966675 Add [force_inline] to SIL apply instruction; kill FunctionInst abstract value type
Swift SVN r7163
2013-08-12 17:33:37 +00:00
Chris Lattner
417f5673ba Use CHECK-LABEL more.
Swift SVN r7148
2013-08-12 14:42:05 +00:00
Chris Lattner
eae021c7ad add a trivial test for SIL parsing the assign instruction, and fix
the bug exposed by it.  :-/


Swift SVN r7147
2013-08-12 14:38:42 +00:00
Manman Ren
abe1fcbbcf SIL Parser: parse ModuleInst.
Swift SVN r7092
2013-08-09 19:57:09 +00:00
Manman Ren
591410ea23 SIL Parser: parse init_existential, init_existential_ref, deinit_existential.
TODO: Conformances are currently not included in SIL.rst for init_existential
or init_existential_ref, but they exist in InitExistentialInst and
InitExistentialRefInst.


Swift SVN r7076
2013-08-09 01:10:10 +00:00
Manman Ren
9628330509 SIL Parser: parse switch_union.
Swift SVN r7071
2013-08-09 00:09:11 +00:00
Anna Zaks
4799118038 [SIL Verifier] Check that there is a unique epilog block
If this is not an invariant on SIL, but only on the output of SILGen,
I'll add an option to the verifier to only check this after SILGen.

Swift SVN r7068
2013-08-08 23:59:09 +00:00
Stephen Lin
f1842552f8 Do not parse trailing double-quote as part of string literal.
Swift SVN r7049
2013-08-08 18:36:17 +00:00
John McCall
204980bdfd Add parsing for some missing SIL instructions.
Swift SVN r7040
2013-08-08 04:04:49 +00:00
Chris Lattner
44d8a942e1 Fix the sil parser to more correctly compute the result type of the partial_apply
instruction.


Swift SVN r7032
2013-08-08 00:58:56 +00:00
John McCall
e9b913fb5b Remove LocalStorageType, make it a kind of SILType.
Swift SVN r6968
2013-08-07 00:22:26 +00:00
John McCall
2ecb0deced Update test for [local_storage]. Sorry!
Swift SVN r6943
2013-08-06 16:19:07 +00:00
John McCall
592732c6b4 Split *one* unimplemented dealloc_ref instruction into
*two* unimplemented instructions!  This is progress.

Swift SVN r6931
2013-08-06 01:23:51 +00:00
Manman Ren
bfe0c39884 SIL Parser: parse builtin_function_ref.
In SILParser, factor out lookupTopDecl and lookupMember.
lookupTopDecl finds the top-level ValueDecl or Module given a name and
lookupMember finds the ValueDecl given a type and a member name.
Update comments for parseSILDeclRef to match SIL.rst.
We now handle the case where the first component of a dotted path is a
module.

In SILPrinter, print the full path for builtin_function_ref, also
"!" is optional when printing SILDeclRef.


Swift SVN r6926
2013-08-06 00:53:07 +00:00
Manman Ren
0d8f8b062c SIL Parser: parse alloc_array.
Swift SVN r6912
2013-08-05 18:41:03 +00:00
Joe Groff
5a2128bc77 SIL: Model project_existential using an address.
Have project_existential return $*This instead of $Builtin.OpaquePointer, and have protocol_method do the same for methods of opaque protocols. This makes it easier for passes to reason about the semantics of the projected address, since it's restricted by the semantics of SIL addresses.

Swift SVN r6872
2013-08-03 01:48:15 +00:00
Manman Ren
fb4ded9a72 SIL Parser: parse super_method and autorelease_return.
In parseSILDeclRef, when searching for the first component of the
fully-qualified name, we use UnqualifiedLookup to look through the imports.
Before this commit, only the current module is searched.
Testing cases are generated from a simple swift program using NSObject.


Swift SVN r6871
2013-08-03 01:20:25 +00:00
John McCall
d7a72b93e1 Add ref_to_unowned and unowned_to_ref bitcast instructions.
Swift SVN r6838
2013-08-02 08:31:01 +00:00
John McCall
00a940ac1b Rename weak_retain to unowned_retain and change it to
require the correct [unowned] type as an argument.

Swift SVN r6825
2013-08-02 00:02:09 +00:00
Anna Zaks
2c529eb21a [SILParser] Parse basic block arguments in branch instructions
Added types when printing these args in the SIL printer.

As a side effect, I've removed the assertions that check
that we have the correct number of arguments in the Branch instruction
creation routines. The reason is that we do not have a complete block when
parsing and creating the branch instruction and it is possible to add
arguments to a basic block after creation. The assertion will be checked
by the SIL verifier.

Swift SVN r6818
2013-08-01 21:32:05 +00:00
Anna Zaks
c12b826816 [SILParser] Run SILVerifier after parsing SIL.
Swift SVN r6817
2013-08-01 21:32:03 +00:00
Joe Groff
ba774364f1 SIL: Have SILModules track their SILStage.
Modules can be in either 'Raw' or 'Canonical' form, with different invariants on each. We don't actually distinguish those invariants yet, but this patch adds the field to SILModule and adds a "sil_stage" declaration to SIL printer/parser syntax.

Swift SVN r6793
2013-08-01 00:58:31 +00:00
Joe Groff
cc45633714 SIL: Don't print instruction labels for value-less instructions.
Swift SVN r6756
2013-07-30 22:33:34 +00:00
Joe Groff
1300efb8fb SIL: Represent float_literal values with bitwise representations.
This way we don't need to deal with the inaccuracy of decimal float literals. While we're here, modify the in-memory representation of IntegerLiteralInst and FloatLiteralInst to save the word array of the APInt instead of round-tripping through plain text.

Swift SVN r6676
2013-07-27 03:57:14 +00:00
Joe Groff
6b779cc642 SIL: Spell all non-SILFunction Swift decl references with '#'.
Reserve '@' as the SILFunction introducer, and use '#' when referencing Swift decls (like with SILConstants).

Swift SVN r6563
2013-07-24 22:10:52 +00:00
John McCall
e668ff914f Add parsing and IR-gen for weak_retain and weak_release.
Swift SVN r6492
2013-07-23 06:28:51 +00:00
Chris Lattner
a83cdb77ae teach silparser to parse the unreachable instruction
Swift SVN r6489
2013-07-23 02:50:37 +00:00
Chris Lattner
1c02badc38 change this test to -emit-silgen, as a basic parser test, it should not run cleanup passes.
Swift SVN r6406
2013-07-20 01:36:09 +00:00
Chris Lattner
40c4565692 rename [de]alloc_var -> [de]alloc_stack in the printed and parsed sil syntax.
Swift SVN r6388
2013-07-19 21:17:39 +00:00
Manman Ren
457f27ccac SIL Parser: parse archetype_metatype, associated_metatype, class_metatype and
protocol_metatype.

Print type to enable parsing.


Swift SVN r6350
2013-07-18 18:49:04 +00:00
Manman Ren
9023d15dcf SIL Parser: parse global_addr.
The testing case has a global variable defined in .sil: "var x: Int = 0".
When parsing the .sil file, there was an assertion failure where the type of
ValueDecl for x is null. To fix the problem, we set DelayCheckingPattern to
false for SIL in visitPatternBindingDecl.


Swift SVN r6348
2013-07-18 17:44:39 +00:00
Manman Ren
76c9a84586 SIL Parser: parse index_addr and index_raw_pointer.
Swift SVN r6339
2013-07-17 22:21:08 +00:00
Manman Ren
b8262ea1d3 SIL Parser: parse string_literal and float_literal.
Swift SVN r6338
2013-07-17 22:14:01 +00:00
Manman Ren
406ca18e16 SIL Parser: parse is_nonnull.
Add helper function lookupBoolType to find the return type for is_nonnull.


Swift SVN r6336
2013-07-17 21:21:29 +00:00
Manman Ren
ee8e504b79 SIL Parser: parse ref_element_addr.
Print type to enable parsing.


Swift SVN r6316
2013-07-17 01:06:28 +00:00
Manman Ren
04c146855f SIL Parser: parse tuple_element_addr and tuple_extract.
Print type to enable parsing.


Swift SVN r6312
2013-07-17 00:31:42 +00:00
Manman Ren
36dd7bfa84 SIL Parser: parse builtin_zero, struct, struct_element_addr, and struct_extract.
Print type for struct_extract and struct_element_addr to enable parsing.


Swift SVN r6308
2013-07-16 23:23:20 +00:00
Manman Ren
b9444e587c SIL Parser: parse initialize_var.
Swift SVN r6294
2013-07-16 20:30:10 +00:00
Manman Ren
0a19b8e4e3 SIL Parser: parse project_existential_ref.
Swift SVN r6293
2013-07-16 20:19:59 +00:00
Manman Ren
dd8069396f Cleanup testing case.
Swift SVN r6292
2013-07-16 20:02:36 +00:00
Manman Ren
1d507f2e42 SIL Parser: parse copy_addr and upcast_existential.
Modify SILPrinter to print necessary types for parsing.
Format of copy_addr is changed from
  copy_addr Src [take]? to Dst [initialization]?
  to
  copy_addr [take]? Src to [initialization]? Dst : DstType
to put the attribute in front of the actual value.
It also makes parsing easier since '[' can start an array type.


Swift SVN r6268
2013-07-15 19:06:32 +00:00
Chris Lattner
12872e5190 remove the allocation kind enum from alloc_var/dealloc_var/alloc_ref. There is
only one kind now: stack.  alloc_var is just for stack memory now.


Swift SVN r6256
2013-07-15 16:48:56 +00:00
Chris Lattner
5322275156 remove the 'heap' form of alloc_var. It is not used, and the imagined
possible use cases are far enough away that we shouldn't worry about them
now.


Swift SVN r6253
2013-07-15 16:33:09 +00:00
Manman Ren
e3ee2f79b2 SILParser: parse an optional volatile attribute for DynamicMethodInst.
Swift SVN r6232
2013-07-13 00:24:58 +00:00
Manman Ren
61d547a2a1 SIL Parser: handle SIL functions with generic params and parse archetype_method.
Construct ArchetypeType from generic params; Construct a Scope for the SIL
function body so TypeAliasDecl for the generic params can be added to ScopeInfo.
Remove an extra '$' in SILPrinter when printing the lookup type for an
archetype_method.


Swift SVN r6219
2013-07-12 22:21:14 +00:00
Manman Ren
20e85d48a3 SIL Parser: parse class_method.
Swift SVN r6058
2013-07-08 18:50:22 +00:00
Manman Ren
a63c78b81a SIL Parser: parse protocol_method.
New format for SILConstant:
  '#' sil-dotted-path sil-constant-kind-and-uncurry-level?
  sil-dotted-path:
    identifier ('.' identifier)*
  sil-constant-kind-and-uncurry-level:
    '!' sil-constant-kind ('.' sil-constant-uncurry-level)? ('.objc')?
    '!' sil-constant-uncurry-level ('.objc')?
    '!objc'
  sil-constant-kind:
    'func' | 'getter' | 'setter' | 'allocator' | 'initializer' | 'oneofelt' \
    | 'destroyer' | 'globalaccessor'

Add helper function printFullContext in SILPrinter to generate the fully
qualified dotted path for a given DeclContext; Add parseSILConstant to
SILParser; Testing cases are updated to reflect the new format.


Swift SVN r6055
2013-07-08 18:24:15 +00:00
Chris Lattner
39e93652fd Implement support for parsing operands that reference alloc_box
results (and other instructions that produce multiple results).

This includes support for forward references.


Swift SVN r6048
2013-07-08 16:15:15 +00:00