Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## avrora.core.isdl.gen
Class Inliner

    java.lang.Object
      avrora.core.isdl.ast.CodeRebuilder.DepthFirst
          avrora.core.isdl.ast.StmtRebuilder.DepthFirst
              avrora.core.isdl.gen.Inliner

All Implemented Interfaces:
  CodeRebuilder, StmtRebuilder

public class Inliner
extends StmtRebuilder.DepthFirst

The `Inliner` class implements a visitor over the code that inlines calls to known subroutines. This produces code that is free of calls to the subroutines declared within the architecture description and therefore is ready for constant and copy propagation optimizations.

The `Inliner` will aggressively inline all calls, therefore it cannot detect recursion. It assumes that return statements are at the end of subroutines and do not occur in branches. This is not enforced by any checking, which should be done in the future.

Nested Class Summary

Nested classes inherited from class avrora.core.isdl.ast.StmtRebuilder
`StmtRebuilder.DepthFirst`

Constructor Summary
`Inliner(Architecture architecture)`

Method Summary
`protected java.lang.String` | `inlineCall(Token m, SubroutineDecl d, java.util.List args)`
`protected java.lang.String` | `newTemp(java.lang.String orig)`
`protected Token` | `newToken(java.lang.String t)`
`java.util.LinkedList` | `process(java.util.List l)`
`protected boolean` | `shouldNotInline(SubroutineDecl d)`
`protected java.lang.String` | `varName(java.lang.String n)`
`protected java.lang.String` | `varName(Token n)`
`Expr` | `visit(CallExpr v, java.lang.Object env)`
`Stmt` | `visit(CallStmt s, java.lang.Object env)`
`Stmt` | `visit(DeclStmt s, java.lang.Object env)`
`Stmt` | `visit(ReturnStmt s, java.lang.Object env)`
`Stmt` | `visit(VarAssignStmt s, java.lang.Object env)`
`Stmt` | `visit(VarBitAssignStmt s, java.lang.Object env)`
`Stmt` | `visit(VarBitRangeAssignStmt s, java.lang.Object env)`
`Expr` | `visit(VarExpr v, java.lang.Object env)`

Methods inherited from class avrora.core.isdl.ast.StmtRebuilder.DepthFirst
`addStmt, visit, visit, visit, visit, visit, visitStmtList, visitStmts`

Methods inherited from class avrora.core.isdl.ast.CodeRebuilder.DepthFirst
`visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitExprList`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface avrora.core.isdl.ast.CodeRebuilder
`visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit`

Constructor Detail

### Inliner

    public Inliner(Architecture architecture)

Method Detail

### process

    public java.util.LinkedList process(java.util.List l)

### visit

    public Stmt visit(CallStmt s,
                      java.lang.Object env)

  Specified by:
    `visit` in interface `StmtRebuilder`
  Overrides:
    `visit` in class `StmtRebuilder.DepthFirst`

### visit

    public Stmt visit(VarAssignStmt s,
                      java.lang.Object env)

  Specified by:
    `visit` in interface `StmtRebuilder`
  Overrides:
    `visit` in class `StmtRebuilder.DepthFirst`

### visit

    public Stmt visit(VarBitAssignStmt s,
                      java.lang.Object env)

  Specified by:
    `visit` in interface `StmtRebuilder`
  Overrides:
    `visit` in class `StmtRebuilder.DepthFirst`

### visit

    public Stmt visit(VarBitRangeAssignStmt s,
                      java.lang.Object env)

  Specified by:
    `visit` in interface `StmtRebuilder`
  Overrides:
    `visit` in class `StmtRebuilder.DepthFirst`

### visit

    public Stmt visit(DeclStmt s,
                      java.lang.Object env)

  Specified by:
    `visit` in interface `StmtRebuilder`
  Overrides:
    `visit` in class `StmtRebuilder.DepthFirst`

### visit

    public Stmt visit(ReturnStmt s,
                      java.lang.Object env)

  Specified by:
    `visit` in interface `StmtRebuilder`
  Overrides:
    `visit` in class `StmtRebuilder.DepthFirst`

### newTemp

    protected java.lang.String newTemp(java.lang.String orig)

### inlineCall

    protected java.lang.String inlineCall(Token m,
                                          SubroutineDecl d,
                                          java.util.List args)

### visit

    public Expr visit(CallExpr v,
                      java.lang.Object env)

  Specified by:
    `visit` in interface `CodeRebuilder`
  Overrides:
    `visit` in class `CodeRebuilder.DepthFirst`

### shouldNotInline

    protected boolean shouldNotInline(SubroutineDecl d)

### visit

    public Expr visit(VarExpr v,
                      java.lang.Object env)

  Specified by:
    `visit` in interface `CodeRebuilder`
  Overrides:
    `visit` in class `CodeRebuilder.DepthFirst`

### varName

    protected java.lang.String varName(java.lang.String n)

### varName

    protected java.lang.String varName(Token n)

### newToken

    protected Token newToken(java.lang.String t)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD