Skip to content

Commit

Permalink
ir: new pass iteration strategy
Browse files Browse the repository at this point in the history
Before:
 * IR basic blocks are in arbitrary order
 * when doing an IR pass, when a block is encountered, code
   must look at all the instructions in the old basic block,
   determine what blocks are referenced, and queue up those
   old basic blocks first.
 * This had a bug (See #667)

Now:
 * IR basic blocks are required to be in an order that guarantees
   they will be referenced by a branch, before any instructions
   within are referenced.
   ir pass1 is updated to meet this constraint.
 * When doing an IR pass, we iterate over old basic blocks
   in the order they appear. Blocks which have not been
   referenced are discarded.
 * After the pass is complete, we must iterate again to look
   for old basic blocks which now point to incomplete new
   basic blocks, due to comptime code generation.
 * This last part can probably be optimized - most of the time
   we don't need to iterate over the basic block again.

closes #667
  • Loading branch information
andrewrk committed Jan 3, 2018
1 parent aafb832 commit 0ea50b3
Show file tree
Hide file tree
Showing 5 changed files with 288 additions and 1,243 deletions.

0 comments on commit 0ea50b3

Please sign in to comment.