Add overloads of getFragileTypeInfo and getFunctionType that take a SILType instead of a Swift CanType, and use them where it's easy to do so. Right now they just forward to the CanType versions, but we'll want to do SILType-specific type conversion soon. Clean up some IRGenSILFunction interfaces now that SILFunction carries most of the information IRGen needs intrinsically. No functionality change.
Swift SVN r5141
by the LLVM IR optimizer. Tuple metadata refs are now largely
readnone, function metadata refs are already readnone. There may be some
left that are not, but they can be handled later.
Swift SVN r5071
John talked me out of this. We still want to cache metadata at the BB level, because even with SIL GVN, there are potentially redundant metadata bits at a level SIL doesn't know about.
Swift SVN r5030
Sever the last load-bearing link between SILFunction and SILConstant by naming SILFunctions with their mangled symbol names. Move the core of the mangler up to SIL, and teach SILGen how to use it to mangle a SILConstant.
Swift SVN r4964
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
dead methods, and moving emitInvoke to CallInvocation.
An interesting semantic change of this is that we're now calling getResultType
on the function type every time IGF is constructed, which exposed some latent
bugs. Specifically two places in GenObjC are trying to extra curry level two
from function types like "SomeObject -> (value : SomeObject) -> ()" which
doesn't make sense. I switched them to get curry level 1, but this definitely
needs some close review.
Swift SVN r4852
seems that this is not a good idea, because it seems statically live from the SIL
SuperToArchetypeInst. However, apparently nothing in the testsuite exercises
this code, so I'll need to discuss and a testcase to know how much logic needs
to be ressurrected from SVN. rdar://13681541
Swift SVN r4800
and supporting logic.
PathComponent and LValue are (apparently unnecessarily) kept alive by
projectPhysicalClassMemberAddress (rdar://13671033)
Swift SVN r4773
Create a new FallthroughStmt, which transfers control from a 'case' or 'default' block to the next 'case' or 'default' block within a switch. Implement parsing and sema for FallthroughStmt, which syntactically consists of a single 'fallthrough' keyword. Sema verifies that 'fallthrough' actually appears inside a switch statement and that there is a following case or default block to pass control to.
SILGen/IRGen support forthcoming.
Swift SVN r4653
Per John's comments, make a GenericBox struct to represent the layout of a generic box allocation, move all the layout calculations into methods on GenericBox, and alter swift_deallocBox to take the type as an argument so that it's future-proofed for when we start special-casing certain types in allocBox.
Swift SVN r4613
Add a runtime function that, given a generic type metadata pointer, allocates a heap object capable of containing a value of that type. This is a first-pass implementation that always does the worst case thing of stuffing the type metadata into the box with the value and using its value witness table to size, align, and destroy the box. Use swift_allocBox to implement ArchetypeTypeInfo::allocate correctly for heap object allocations. This means SIL's alloc_box $T now works for archetypes, and a simple generics test now (almost) compiles through SIL!
Swift SVN r4599
Implement type-checking and IRGen for 'x is T', and fix a bug in 'x as! T' typechecking when the operand is an lvalue. For IRGen I'm reusing the checked swift_dynamicCastClass runtime function and testing the result against null.
Swift SVN r4515
Implement switch statements with simple value comparison to get the drudge work of parsing and generating switches in place. Cases are checked using a '=~' operator to compare the subject of the switch to the value in the case. Unlike a C switch, cases each have their own scope and don't fall through. 'break' and 'continue' apply to an outer loop rather to the switch itself. Multiple case values can be specified in a comma-separated list, as in 'case 1, 2, 3, 4:'. Currently no effort is made to check for duplicate cases or to rank cases by match strength; cases are just checked in source order, and the first one wins (aside from 'default', which is branched to if all cases fail).
Swift SVN r4359
In the StmtChecker, consider a ConstructorDecl or DestructorDecl context to be a function context that returns (). In IRGen for constructors and destructors, set up proper return blocks so that 'return' does the right thing, and in constructors, pretend that the body has no return value even though the underlying constructor mechanism totally returns a value. Fixes <rdar://problem/12950817>.
Swift SVN r3915
Implement ElementAddrInst for lvalue tuples, and implement the AllocArray, IndexAddr, and IntegerValue insts used to lower variadic tuples. (Actually compiling code that uses variadic tuples still requires support for SpecializeInst and generic functions.)
Swift SVN r3781
Implement SIL-to-IR lowering for allocation, deallocation, load, store, and branching instructions so that local variables and branching control flow can be used. Add a Fibonacci loop test to exercise the new instructions.
Swift SVN r3767