public class LoopNormalizer extends NodeVisitor
Modifier and Type | Field and Description |
---|---|
protected Job |
job |
protected NodeFactory |
nf |
protected TypeSystem |
ts |
Constructor and Description |
---|
LoopNormalizer(Job job,
TypeSystem ts,
NodeFactory nf) |
Modifier and Type | Method and Description |
---|---|
protected void |
addInits(java.util.List<Stmt> stmts,
For source) |
protected Eval |
createAssign(LocalDecl var) |
protected Eval |
createAssign(LocalDecl var,
Expr right) |
protected Block |
createBlock() |
protected Block |
createBlock(java.util.List<Stmt> stmts) |
protected BooleanLit |
createBool(boolean val) |
protected If |
createInitIf(LocalDecl var,
Expr cond) |
protected If |
createIterIf(LocalDecl var,
java.util.List<ForUpdate> iters) |
protected Local |
createLocal(LocalInstance li,
Position pos) |
protected While |
createLoop(Loop source) |
protected If |
createLoopIf(LocalDecl var,
Stmt body) |
protected LocalDecl |
createLoopVar(Loop source) |
protected LocalDecl |
createLoopVar(Loop source,
Expr cond) |
JLang |
lang() |
Node |
leave(Node parent,
Node old,
Node n,
NodeVisitor v)
This method is called after all of the children of
n
have been visited. |
protected java.lang.String |
newId() |
protected <N extends Node> |
postCreate(N n)
Whenever a new node is created, this method is called and should do
additional processing of the node as needed.
|
protected Stmt |
translateDo(Do s) |
protected Stmt |
translateFor(For s) |
protected Stmt |
translateWhile(While s) |
protected final Job job
protected final TypeSystem ts
protected final NodeFactory nf
public LoopNormalizer(Job job, TypeSystem ts, NodeFactory nf)
public JLang lang()
lang
in class NodeVisitor
public Node leave(Node parent, Node old, Node n, NodeVisitor v)
NodeVisitor
n
have been visited. In this case, these children were visited by the
visitor v
. This is the last chance for the visitor to
modify the tree rooted at n
. This method will be called
exactly the same number of times as entry
is called.
That is, for each node that is not overridden, enter
and
leave
are each called exactly once.
Note that if old == n
then the visitor should make a copy
of n
before modifying it. It should then return the
modified copy.
The default implementation of this method is to call
leave(old, n, v)
,
as most subclasses do not need to know the parent of the
node n
.
leave
in class NodeVisitor
parent
- The parent of old
,
null
if old
has no parent.old
- The original state of root of the current subtree.n
- The current state of the root of the current subtree.v
- The NodeVisitor
object used to visit the children.n
.protected <N extends Node> N postCreate(N n)
protected java.lang.String newId()
protected Block createBlock()
protected Local createLocal(LocalInstance li, Position pos)
protected BooleanLit createBool(boolean val)