Commit Graph

83 Commits

Author SHA1 Message Date
Adrian Prantl
b994bde5b5 Reverting commits 29181-29187 to investigate buildbot breakage.
Swift SVN r29190
2015-05-31 06:13:03 +00:00
Adrian Prantl
6ad0679106 Make a deep copy of SILDebugScopes when doing a SILBasicBlock::splice()>
The cloned abstract variables may end up having different types
so they need to be distinct from the originals.

This fixes an crash/assertion in the LLVM backend.
rdar://problem/21109015

Swift SVN r29184
2015-05-31 05:39:30 +00:00
Michael Gottesman
3c217614b0 [g-arc-opts] Use RCStateTransitions when processing arguments as well.
Swift SVN r26914
2015-04-02 23:24:13 +00:00
Erik Eckstein
c2776c455b Rename SILBasicBlock::getID() -> getDebugID()
Swift SVN r24321
2015-01-09 19:37:03 +00:00
Erik Eckstein
a2f78d768f Add SILBasicBlock::getID() for dumping the block index in debug output.
Swift SVN r24308
2015-01-09 17:04:29 +00:00
Chris Lattner
f460716430 add a SILBasicBlock::removeWithParent method with the obvious semantics
(following LLVM IR), NFC.


Swift SVN r24298
2015-01-09 05:33:32 +00:00
John McCall
b6eb086af8 Add a rather hacky builtin function for constructing
a materializeForSet callback from a closure.

Swift SVN r23993
2014-12-17 22:23:26 +00:00
Michael Gottesman
1afc987739 Refactor the SILArgument API on SILBasicBlock so we can insert bb arguments anywhere in the argument list. Also clean up the API names so that they all match.
Swift SVN r23543
2014-11-22 00:24:40 +00:00
Michael Gottesman
c97ab1f11f [func-sig-opts] When splicing BB from one function to another, change
the debug scope of each instruction to be the debug scope of the new
function.

This will be tested by the functionality in function signature opts.

Swift SVN r22553
2014-10-06 23:16:52 +00:00
Michael Gottesman
ed124f6651 [func-sig-opts] Expose the ValueDecl argument of SILArgument's
constructor in SILBasicBlock::createArgument.

By default the argument is nullptr so any place that currently does not
need to pass in the ValueDecl will not need to be updated given the new
behavior.

Swift SVN r22379
2014-09-30 03:08:50 +00:00
Michael Gottesman
d3b9679795 Add the method SILArgument::getIncomingValues and refactor SILArgument implementation from SILBasicBlock.cpp => SILArgument.cpp.
SILArgument::getIncomingValues() takes in an out array parameter and attempts to
gather up all values from the SILArguments parents predecessors whose value the
SILArgument could take on.

This will let me refactor the single predecessor handling code to also handle
multiple predecessors in a simple way.

Swift SVN r21864
2014-09-11 01:53:29 +00:00
Michael Gottesman
225a5ca87b [func-sig-opts] Add the call SILFunction::spliceBody() to splice a function's body onto another function.
I also added code to ilist_traits so we can set the parent function on BB to be the new function.

Swift SVN r21729
2014-09-04 23:34:34 +00:00
Michael Gottesman
0f7053bd01 Remove SILBasicBlock::getBBArgIndex(SILArgument *) in favor of SILArgument::getIndex().
The index is a property of the argument. There is no reason from a modeling
perspective to go through the BB to get it.

Swift SVN r21338
2014-08-21 04:06:19 +00:00
Arnold Schwaighofer
2e83bdf01b Add a convenience function on SILBasicBlock to move it after another Block
Swift SVN r19633
2014-07-07 21:05:22 +00:00
John McCall
cd6fc21900 Allow SILBasicBlocks to be constructed after a specific
block, and do so when splitting a block.

Swift SVN r19076
2014-06-22 05:01:06 +00:00
Nadav Rotem
1b650dcdf6 Add helper functions to SILBlock and SILFunction.
Swift SVN r18858
2014-06-13 06:10:07 +00:00
Mark Lacey
8156008cd8 Add a dead code elimination optimization pass.
In a loop like this:
  var j = 2
  for var i = 0; i < 100; ++i {
    j += 3
  }
it will completely eliminate j.

It does not yet support rewriting conditional branches as unconditional
branches in the cases where only empty blocks are control dependent on
an edge. Once this support is added, it will also completely eliminate
the loop itself.

Swift SVN r18615
2014-05-24 07:02:18 +00:00
Mark Lacey
924e30ea61 Rewrite BB args whose only use is in struct/tuple extract.
If we have BB args that are only used in a struct/tuple extract, and
that are generated in each predecessor with a struct/tuple instruction,
retype the BB arg and replace the argument with what would have been the
extracted value.

This provides more opportunties for jump threading to kick in.

Swift SVN r16509
2014-04-18 07:19:33 +00:00
Dmitri Hrybenko
be7759b149 Track uptstream LLVM API change: llvm::next() was removed, use std::next() instead
Swift SVN r14572
2014-03-02 13:32:30 +00:00
Adrian Prantl
c610ac94ef Add an IsBare attribute to SILFunction for functions that do not have an
AST.

Swift SVN r11236
2013-12-13 04:48:37 +00:00
Adrian Prantl
2acb71831e SILArgument: Make Decls mandatory for function arguments.
Swift SVN r11099
2013-12-10 23:30:23 +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
Adrian Prantl
8808d48578 Debug info: emit captured variables in closures. rdar://problem/15035486
Swift SVN r8859
2013-10-02 22:46:03 +00:00
Anna Zaks
4d7de376bb [SIL] Refactor splitBasicBlock() into splitBasicBlock and splitBasicBlockAndBranch
This API is more explicit and avoids relying on passing around empty SILLocation.
(No functional change.)

Swift SVN r7988
2013-09-06 17:46:12 +00:00
Michael Gottesman
c86a54a438 Renamed SILBasicBlock::getInsts() => SILBasicBlock::getInstList() as discussed on the list.
Swift SVN r7776
2013-08-30 03:40:37 +00:00
Ted Kremenek
8f5b8ccb02 Rename "This" to "Self" and "this" to "self".
This was not likely an error-free change.  Where you see problems
please correct them.  This went through a fairly tedious audit
before committing, but comments might have been changed incorrectly,
not changed at all, etc.

Swift SVN r7631
2013-08-27 21:58:27 +00:00
Stephen Lin
4ae68cd72f Completion of MandatoryInlining pass: recursive inlining, multiple basic blocks, and diagnosis of circular inlining.
Swift SVN r7242
2013-08-14 22:30:21 +00:00
Anna Zaks
e5c3a7ea80 [SIL] Make sure SILBasicBlock destructor gets called.
This also ensures that the instructions indie the basic block
get destructed.

Swift SVN r6667
2013-07-27 00:25:03 +00:00
Chris Lattner
c7373c563b add regular convenience methods to SIL IR objects for getting parent containers.
Add a getOperand(n) method to SILInstruction.


Swift SVN r6425
2013-07-21 06:12:29 +00:00
Chris Lattner
0ad6fac283 Remove the basic block name field from SILBasicBlock. The name is currently
ignored and is going to be a private detail of the SILParser.


Swift SVN r5276
2013-05-22 22:24:39 +00:00
Chris Lattner
965242a833 rename SILBBArgument.h -> SILArgument.h to match the class name.
I'm done with renaming for now, boy do my fingers hurt.


Swift SVN r4595
2013-04-03 21:08:38 +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