Commit Graph

269 Commits

Author SHA1 Message Date
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
Argyrios Kyrtzidis
015c1a892b Refactor Parser methods to return TypeReprs directly, instead of modifying TypeLocs.
Swift SVN r6328
2013-07-17 14:57:40 +00:00
Argyrios Kyrtzidis
f616eeee8b Utilize TypeReprs for type checking.
-Refactor Parser to stop creating types
-Refactor TypeChecker to create types by resolving TypeReprs.
-Remove "validation" bit from the type system.
  We don't need to "validate" every type that gets created but there's still a validation bit in TypeLoc,
  necessary because of generic substitutions.

Swift SVN r6326
2013-07-17 14:57:35 +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
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
Chris Lattner
5c1320042c remove the "pseudo" class of alloc_var. It is not used.
Swift SVN r6252
2013-07-15 16:25:19 +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
80ffd6e693 Parse generic parameters in SIL function definition.
sil_type: '$' '*'? attribute-list (generic-params)? type
Refactor parseTypeAnnotation to separate applyAttributeToType which can be
used from SILParser.


Swift SVN r6209
2013-07-12 19:44:04 +00:00
Doug Gregor
4de26b0a3f Fix newly-introduced NL_Default.
Swift SVN r6074
2013-07-08 22:41:53 +00:00
Dmitri Hrybenko
1c0233efb1 Move lib/Parse/{Parser.h, Scope.h} -> include/swift/Parse/
Swift SVN r6062
2013-07-08 20:36:40 +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
Chris Lattner
dd605118bb use parseValueName to simplify code.
Swift SVN r6047
2013-07-08 15:24:26 +00:00
Chris Lattner
df9ae62700 parse the alloc_box instruction.
Swift SVN r6045
2013-07-08 15:05:06 +00:00
Chris Lattner
dc702b2be5 implement sil parser support for the rest of the unchecked conversion instructions.
Swift SVN r5942
2013-07-01 18:50:37 +00:00
Chris Lattner
4a8a00c91d add parsing support for the rest of the checked conversions. No testcases, poo poo.
Swift SVN r5933
2013-07-01 17:36:06 +00:00
Chris Lattner
e51b88ce95 add silparser support for checked cast instructions, with downcast as an exemplar.
Swift SVN r5930
2013-07-01 17:24:32 +00:00
Chris Lattner
41591909d8 Change the syntax of SIL cast instructions to use the 'to' keyword.
This is better for uniformity with store and also is less of a punctuation
soup, making things easier to read.


Swift SVN r5928
2013-07-01 16:51:02 +00:00
Chris Lattner
cd5c533a40 add silparser support for upcast.
Swift SVN r5926
2013-07-01 16:40:47 +00:00
Chris Lattner
03aa55802b implement alloc_ref and ref_to_object_pointer
Swift SVN r5919
2013-07-01 00:38:47 +00:00
Chris Lattner
9f5145be4f silparser support for project_existential and destroy_addr.
Swift SVN r5917
2013-07-01 00:00:19 +00:00
Chris Lattner
76e15b8472 make the SIL parser put basic blocks in the order that they are defined, not
the order they are referenced.  Fix a testcase to use control flow instead
of producing invalid SSA to test forward refs of values, fixing a FIXME.


Swift SVN r5916
2013-06-30 23:40:59 +00:00
Chris Lattner
5ac61b6b90 add testcase for unconditional branch, which exposes a bug: the wrong mneumonic was used.
Swift SVN r5915
2013-06-30 23:37:12 +00:00
Chris Lattner
b13c50157e implement proper name binding and resolution of global sil function names, including
diagnosing redefinitions, use of undefined values, handling forward references, etc.



Swift SVN r5908
2013-06-30 19:31:19 +00:00
Chris Lattner
20229fbf85 Introduce infrastructure for maintaining per-translation unit SIL parser state across
invocations of the parser.



Swift SVN r5906
2013-06-30 18:44:59 +00:00
Manman Ren
8b2cf98fec SIL Parser: parse branch and condbranch.
Swift SVN r5872
2013-06-28 17:51:13 +00:00
Chris Lattner
5c661f3c38 push global reference parsing forward a bit, diagnosing a type error.
Swift SVN r5811
2013-06-26 05:33:49 +00:00
Chris Lattner
be0f7b4c48 Wire up initial support for function_ref, allowing us to SILParse the code for "return 4".
This is terrible in several ways: it doesn't handle forward references, we do a linear scan
of SILFunctions, and diagnostics don't exist.  Room for improvement some other time.


Swift SVN r5736
2013-06-21 05:27:15 +00:00
Chris Lattner
706ceffab0 generalize call parsing to also handle partial_apply
Swift SVN r5726
2013-06-20 20:52:11 +00:00
Chris Lattner
9cf535be31 after parsing an applyinst, actually create it! We can now silparse
the sil for this function:

func call(fnptr : () -> Int) -> Int {
  return fnptr()
}



Swift SVN r5724
2013-06-20 20:29:21 +00:00
Chris Lattner
88e8f0227a Start parsing SIL apply instructions. Right now, they are dropped on the floor because I have to run.
Swift SVN r5720
2013-06-20 17:57:04 +00:00
Chris Lattner
e4e1d635a2 fix couple fixme's by having the SILParser make SILTypes directly
instead of going through TypeConverter.


Swift SVN r5527
2013-06-07 23:19:18 +00:00
Chris Lattner
5350849cbe Parser support for retain/release/retain_autoreleased.
Swift SVN r5357
2013-05-26 23:22:40 +00:00
Chris Lattner
3b82c89106 implement parsing support for the metatype instruction.
Swift SVN r5356
2013-05-26 23:14:41 +00:00
Chris Lattner
e052f3ca41 change the sil printer to print the type of the destination
operand, producing something like:

	%2 = store %0 to %1 : $*Int64

Enhance the sil parser to be able to parse this.  We can now
round trip everything required to handle this function:

func foo(a : Int) -> Int {
  return a
}




Swift SVN r5354
2013-05-26 14:43:17 +00:00
Chris Lattner
63557b5ddd parse basic block argument lists.
Swift SVN r5353
2013-05-26 06:22:02 +00:00
Chris Lattner
91140d85c1 rename SILParserFunctionState to SILParser, no functionality change.
Swift SVN r5352
2013-05-26 06:12:58 +00:00
Chris Lattner
dfef589a4b implement generic support for parsing the [thin] attribute on function types.
Switch SILType parsing to parse type annotations.
This allows us to use thin functions in .sil files.


Swift SVN r5351
2013-05-26 06:11:13 +00:00
Chris Lattner
56ded647de - Implement parsing of load, alloc_var, and dealloc_var.
- Fix SIL Type parsing of address types.
- Remove dead siltype parsing logic for attributes like sil_sret
  and sil_uncurry.



Swift SVN r5350
2013-05-26 06:00:21 +00:00
Chris Lattner
a34f4efa13 parse integer_literal. Parse and print tuple instructions with named
elements in a way that we can not lose information.


Swift SVN r5348
2013-05-26 01:09:46 +00:00
Chris Lattner
479cbd2ac6 don't require the basic block name to be present. It is particularly
annoying when hand writing tests for the entry block.


Swift SVN r5347
2013-05-25 22:36:17 +00:00