Commit Graph

27 Commits

Author SHA1 Message Date
Joe Groff
02a0e996c4 SIL: Kill initialize_var instruction.
Remove the initialize_var instruction now that DI fully diagnoses initialization problems. Change String-to-NSString bridging to explicitly invoke String's default constructor; it was the last remaining user of initialize_var. Remove dead code to emit an implicit default constructor without a body.

Swift SVN r11066
2013-12-10 03:36:59 +00:00
Chris Lattner
aed29b4e92 When r10841 turned on DI for struct init methods, it started SILGen generating
new mark_unitialized instructions.  These defeated the alloc_box to stack promotion
pass, so everything ended up on the heap, leading to really terrible performance.
This updates things to understand mark_uninitialized, allowing us to promote them.

This fixes rdar://15607469.


Swift SVN r10985
2013-12-07 23:38:09 +00:00
Michael Gottesman
4379283013 Remove inclusion of SILPasses/Passes.h into Subsystems.h and update all relevant files.
Swift SVN r10880
2013-12-05 19:58:21 +00:00
John McCall
20e58dcf93 Change the type of function values in SIL to SILFunctionType.
Perform major abstraction remappings in SILGen.  Introduce
thunking functions as necessary to map between abstraction
patterns.

Swift SVN r10562
2013-11-19 22:55:09 +00:00
Anna Zaks
e5eb77ea6e [SIL] Mark these locations as cleanup.
The empty tuple used for return value when none is supplied does not really correspond to user code. (We don’t have epilog, so mark it as pert of cleanup.)
The destroy_addr instructions are doing the cleanup.

Swift SVN r9765
2013-10-29 22:27:25 +00:00
Chris Lattner
968e89a3be improve the DEBUG output of inout-deshadow and allocbox-to-stack.
clean up a couple random things in silcombiner:
  - it shouldn't return "made any changes" out of the pass.
  - statistics should be spelled out more and don't end with periods.



Swift SVN r9755
2013-10-29 04:02:32 +00:00
Chris Lattner
c31e5c755c teach allocbox-to-stack about assign instructions, enabling it to
promote a lot more boxes.  This is the last step to resolve
rdar://15228172 getting us back O(n) string performance.  There is
still more work to do, but this is progress.


Swift SVN r9751
2013-10-29 03:06:25 +00:00
Chris Lattner
1aac046e71 reimplement alloc_stack/box deletion in DI instead of being
part of allocbox_to_stack.  This is simpler and more efficent
given the info DI already has, and this enables future progress.


Swift SVN r9707
2013-10-28 16:26:04 +00:00
Chris Lattner
c118613de3 Fix SILValue use_iterators to type the user as a SILInstruction, not just a ValueBase.
There are no values other than instructions that can use other values.  BBArguments are
defs, not uses.  This eliminates a bunch of casts in clients that use getUser().


Swift SVN r9701
2013-10-27 23:32:14 +00:00
Chris Lattner
9ca612df59 change allocbox to stack to remove stack_allocs that are coming
from SIL files.  This makes testing easier and simplifies the code.


Swift SVN r9697
2013-10-27 20:04:23 +00:00
Chris Lattner
91c7cea310 Remove the SILModule& argument from a few methods in SILInstruction.h.
Instructions know which module they came from, so there is no need to
pass it in.



Swift SVN r9584
2013-10-22 11:06:50 +00:00
Joe Groff
77dbdb211e SIL: Allow AllocBoxToStack to promote any non-var allocation.
Most alloc_stacks emitted by SILGen are temporaries and don't need to be preserved for debug info. It's only the ones that relate to local variables that we need to preserve. Fixes <rdar://problem/15272642>.

Swift SVN r9543
2013-10-21 17:44:02 +00:00
Anna Zaks
4d50044dd8 Add MandatoryInlinedLocation SIL location type.
This will allow us to differentiate from regular inlined code (as in optimization inlining). Some passes(AllocBocToStack) and debug info would be allowed to be more aggressive/preserve less debug info with mandatory inlined code.

Swift SVN r9339
2013-10-15 00:17:51 +00:00
Chris Lattner
e145b5b946 teach allocbox_to_stack that init_existential and destroy_addr don't
inherently keep a stack object alive.  This allows it to remove 50
more stack allocations from the stdlib.


Swift SVN r9307
2013-10-14 04:57:56 +00:00
Chris Lattner
b6ce3ca092 Teach allocbox_to_stack to be a bit smarter when removing dead instructions:
have it remove trivially dead operands of the dead instructions.  On the
same testcase as last time, this eliminates a dead metatype, getting us to:

sil @_T1t1fFT_T_ : $@thin () -> () {
bb0:
  %0 = tuple ()
  %1 = alloc_stack $Int64  // var a               // users: %7, %6
  %2 = metatype $Int64.metatype
  %3 = module #Builtin
  %4 = integer_literal $Builtin.Int64, 1          // user: %5
  %5 = struct $Int64 (%4 : $Builtin.Int64)        // user: %6
  store %5 to %1#1 : $*Int64
  dealloc_stack %1#0 : $*@local_storage Int64
  %8 = tuple ()                                   // user: %9
  return %8 : $()
}



Swift SVN r9306
2013-10-14 04:33:51 +00:00
Chris Lattner
0d610cf952 teach AllocBoxToStack to remove alloc_stack's that are artificial (or inlined)
and only stored to.  With this change, we now -emit-sil this testcase:

func f() {
 var a = 1
}

as:

sil @_T1t1fFT_T_ : $@thin () -> () {
bb0:
  %0 = tuple ()
  %1 = alloc_stack $Int64  // var a               // users: %8, %7
  %2 = metatype $Int64.metatype
  %3 = metatype $Int64.metatype
  %4 = module #Builtin
  %5 = integer_literal $Builtin.Int64, 1          // user: %6
  %6 = struct $Int64 (%5 : $Builtin.Int64)        // user: %7
  store %6 to %1#1 : $*Int64
  dealloc_stack %1#0 : $*@local_storage Int64
  %9 = tuple ()                                   // user: %10
  return %9 : $()
}



Swift SVN r9305
2013-10-14 04:24:08 +00:00
Joe Groff
e57ab17c25 AllocBoxToStack: Don't promote if there's no "last release".
An unbalanced alloc_stack without a matching dealloc_stack doesn't pass muster with the verifier anymore.

Swift SVN r9132
2013-10-10 04:36:05 +00:00
John McCall
b880e60100 Remove SILFunctionTypeInfo in favor of SILFunctionType.
We still don't actually use this as a type, however.

Swift SVN r9091
2013-10-09 20:55:55 +00:00
Joe Groff
ad0ee9b5ca AllocBoxToStack: Promote the last release of a box to destroy_addr.
Swift SVN r9046
2013-10-09 01:09:36 +00:00
Adrian Prantl
627fec7f41 Debug info: fix scoping for boxed values that get promoted to stack
allocated values. Fixes rdar://problem/15035350

Swift SVN r9044
2013-10-09 01:01:32 +00:00
Stephen Lin
3f5c0dbf0e Update SILArgument::getModule(), SILBasicBlock::getModule() and SILInstruction::getModule() signatures to match SILFunction::getModule(), for consistency; standardize usage of SILFunction::getParent() to SILFunction::getModule().
Swift SVN r8932
2013-10-04 21:12:20 +00:00
Joe Groff
82a18333ed SIL: Purge SpecializeInst.
Make ApplyInst and PartialApplyInst directly take substitutions for generic functions instead of trying to stage out substitutions separately. The legacy reasons for doing this are gone.

Swift SVN r8747
2013-09-28 00:15:45 +00:00
Joe Groff
3d4c1251f1 Rename 'byref' attribute to 'inout'.
Swift SVN r8661
2013-09-25 20:56:52 +00:00
Stephen Lin
176b89daaa AllocBoxToStack: correctly identify last release of an alloc box when there are multiple releases in the post-dominating block.
Swift SVN r8126
2013-09-12 00:06:52 +00:00
Chris Lattner
1dc9b9f062 fix the -allocbox-to-stack pass to handle the case when emiting a "destroy
address" expands out to multiple basic blocks.  This enables it to work
with the new union typelowering stuff.


Swift SVN r7948
2013-09-05 17:24:43 +00:00
Michael Gottesman
d41b871b3a At Joe's suggestion added the prefix strong to instructions Retain,Release,RetainAutoreleased,RetainUnowned to prevent confusion in between RetainUnowned and UnownedRetain.
This is was a very mechanical patch where I basically first renamed SILNodes.def
and then just kept fixing things until everything compiled, so even though it is
large patch I feel ok(ish) with committing it.

If anyone has any concerns/etc, please email me and I will revert in 1 second.

Swift SVN r7604
2013-08-26 23:32:16 +00:00
Stephen Lin
8d90466523 Reorganize SIL source tree: move lib/SIL/SILGen -> lib/SILGen, move lib/SIL/Passes -> lib/SILPasses, add lib/SILPasses/Utils
Swift SVN r7246
2013-08-14 23:47:29 +00:00