Merge: nitvm: Basic blocks generation and SSA-algorithm
authorJean Privat <jean@pryen.org>
Wed, 10 Jun 2015 01:46:34 +0000 (21:46 -0400)
committerJean Privat <jean@pryen.org>
Wed, 10 Jun 2015 01:46:34 +0000 (21:46 -0400)
This PR introduces a SSA-algorithm implementation in the nitvm.

First, basic blocks are generated. A basic block is a sequence of instructions without a jump inside.
In this version, basic blocks are generated from the AST and so they contain only the first instruction and the last one.

Then, SSA-algorithm (Single-Static Assignment) is implemented. In SSA algorithm, variables are renamed to have only one assignment per variable.
Each time an assignment is made, a new version of a variable is made.

Some variables (phi-functions) have several assignment and so, several dependances.

The basic block generation and SSA are computed for each method in a lazy way in the nitvm.
The main objective of SSA is to give the dependances for each variable (this will be used in further PR).
This module also collect all object-mechanisms sites during the visit of methods.

Pull-Request: #1425
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

1  2 
src/semantize/scope.nit
src/semantize/typing.nit

@@@ -429,17 -429,9 +429,17 @@@ redef class AWithExp
        end
  end
  
 +redef class AAssertExpr
 +      redef fun accept_scope_visitor(v)
 +      do
 +              v.enter_visit(n_expr)
 +              v.enter_visit_block(n_else, null)
 +      end
 +end
 +
  redef class AVarFormExpr
        # The associated variable
-       var variable: nullable Variable
+       var variable: nullable Variable is writable
  end
  
  redef class ACallFormExpr
Simple merge