Commit Graph

116 Commits

Author SHA1 Message Date
Joe Groff
2ce2d33a64 SIL: Add instructions for class-bound archetype/existential operations.
Add class-bound versions of archetype conversion and existential creation/projection/conversion instructions. Since class-bound generics aren't address-only these instruction variants don't need to indirect through addresses.

Swift SVN r5554
2013-06-09 18:12:43 +00:00
Chris Lattner
63e2a60585 rename Module:: and Function::getContext to ::getASTContext()
This matches SILType and is more explicit about which context
we're talking about.


Swift SVN r5185
2013-05-16 20:14:13 +00:00
Chris Lattner
21a3b9d246 remove two helper forwarding methods from SILFunction
one is dead, the other isn't helpful enough to persist.


Swift SVN r5184
2013-05-16 20:07:53 +00:00
Joe Groff
bcf510e30b SIL: Remove 'getPreLoweredType' from SILType.
We don't need this hole to bypass SIL TypeLowering anymore.

Swift SVN r5094
2013-05-08 18:26:38 +00:00
Joe Groff
f79e939460 SIL: Sever load-bearing links to the AST.
Make IntegerLiteral, FloatLiteral, and StringLiteral own their own copies of their values so they don't depend on the AST. Remove the now-redundant IntegerValueInst, which only existed to be a non-AST-dependent variant of IntegerLiteral.

Swift SVN r5045
2013-05-06 03:08:58 +00:00
Joe Groff
bcb49ce450 SIL: Key functions directly without SILConstant.
Replace 'constant_ref' with 'function_ref', which references a SILFunction directly, and 'global_addr', which references a global variable VarDecl. Get rid of the SILConstant-to-SILFunction mapping in SILModule and replace it with an ilist of SILFunctions. Allow SILFunctions to be 'external' by not having any blocks in their body. 

For now, SILFunctions still carry around their SILConstant "name", because name mangling and IRGen still rely on access to the original decl in order to recover IRGen information, which unfortunately leaves IRGen's CodeRefs in a gross, awkward intermediate state. Lifting mangling, AbstractCC, and other linkage attributes to SIL should clear up this up.

Swift SVN r4865
2013-04-23 23:29:04 +00:00
Joe Groff
f211c1d3d2 SIL: Factor out boilerplate from unary insns.
Create a UnaryInstructionBase that factors all the boilerplate out of all the unary instructions. It'll be easy to generalize to all fixed-arity instructions, but let's start simple. No functionality change.

Swift SVN r4854
2013-04-21 18:58:35 +00:00
Joe Groff
ce75e47139 SIL: Add instructions for RetainAutoreleased and AutoreleaseReturn.
Swift SVN r4821
2013-04-19 02:03:31 +00:00
Joe Groff
b9bb84c58e SILGen: Emit implicit constructors.
Teach SILGen how to emit the implicit elementwise constructor for structs and the implicit default constructor for classes, and eliminate the now dead IRGen code for them. Add a StructInst SIL instruction to represent constructing a loadable struct value from elements, analogous to TupleInst for tuples.

Swift SVN r4778
2013-04-17 20:51:26 +00:00
Joe Groff
8ee0fb4e96 SILGen: Zero-initialize structs in constructors.
Otherwise we try to release junk pointers when we reassign class fields in the struct. Add an attribute to InitializeVarInst so that when dataflow analysis comes online, it knows that these InitializeVars need to be eliminated and can't be lowered to default constructor calls (since we're already in a constructor).

Swift SVN r4730
2013-04-13 20:45:18 +00:00
Joe Groff
4cdcdba22e SIL: Add BridgeToBlockInst.
And in SILGen, lower BridgeToBlockExprs to BridgeToBlockInsts.

Swift SVN r4723
2013-04-13 17:05:38 +00:00
John McCall
7e15f0a557 Make SIL-visiting not have a default implementation, make classof
take a const ValueBase* instead of a SILValue, implement SILArgument
cases for a few visitors and opt others out explicitly, and assert
that classes in the SIL value hierarchy override their superclass's
classof.

Swift SVN r4705
2013-04-12 01:39:52 +00:00
John McCall
f9226a8178 Add a getAllOperands() method to SILInstructions.
Required some renaming of the internal field-selector constants
to avoid inadvertent shadowing.

Swift SVN r4703
2013-04-12 00:54:53 +00:00
Joe Groff
442a51ef36 SIL: Fix Verifier.
The Verifier wasn't actually verifying function bodies, because I neglected to visit the actual basic blocks after checking the entry point arguments in verifySILFunction. This revealed a SILType identity issue where TypeConverter::getLoweredType and SILType::getEmptyTupleType returned non-identical SILTypes for the empty tuple type; fix that by removing SILType::getEmptyTupleType, moving TypeConverter into SILModule, and forcing all SILType creation through TypeConverter.

Swift SVN r4616
2013-04-05 22:19:14 +00:00
Chris Lattner
a71bc3a78e rename Value -> SILValue, BasicBlock -> SILBasicBlock, BBArgument -> SILArgument.
Swift SVN r4594
2013-04-03 21:05:42 +00:00
Chris Lattner
1beebda868 move Instruction/BasicBlock/BBArgument files to have SIL prefixes.
Swift SVN r4591
2013-04-03 18:43:54 +00:00