public class PushApply extends ExpVisitor<Expression,java.lang.Void>
((let (...) body) . args)
to (let (...) (body . args)).
Optimizes ((begin ... last) . args) to (begin ... (last . args)).
This helps optimize Scheme "named let" (and some other forms)
by making it more likely the application will be to a known procedure.
Optimizes (if (let (...) body) e1 [e2])
to (let (...) (if body e1 [e2]))
.
Optimizes (if (begin ... last) e1 [e2])
to (begin ... (if last e1 [e2]))
.
These optimizations have to be done after Declarations are bound.
Also, for each LambdaExp
set the canFinishCondition
field.
This information is used in the following InlineCalls
pass,
to determine which calls (and thus other expressions) have the type
neverReturnsType
. That in turn is used in the later
ChainLambda
pass to warn about unreachable code.SourceLocator.Simple
currentLambda, exitValue, messages
Constructor and Description |
---|
PushApply() |
Modifier and Type | Method and Description |
---|---|
protected Expression |
defaultValue(Expression r,
java.lang.Void ignored) |
void |
forkNext() |
void |
forkPop() |
void |
forkPush() |
static void |
pushApply(Expression exp,
Compilation comp) |
protected Expression |
update(Expression exp,
Expression r) |
protected Expression |
visitApplyExp(ApplyExp exp,
java.lang.Void ignored) |
protected Expression |
visitBlockExp(BlockExp exp,
java.lang.Void ignored) |
protected Expression |
visitCaseExp(CaseExp exp,
java.lang.Void ignored) |
protected Expression |
visitClassExp(ClassExp exp,
java.lang.Void ignored) |
protected Expression |
visitExitExp(ExitExp exp,
java.lang.Void ignored) |
protected Expression |
visitIfExp(IfExp exp,
java.lang.Void ignored) |
protected Expression |
visitLambdaExp(LambdaExp exp,
java.lang.Void ignored) |
protected Expression |
visitReferenceExp(ReferenceExp exp,
java.lang.Void ignored) |
protected Expression |
visitTryExp(TryExp exp,
java.lang.Void ignored) |
error, getColumnNumber, getCompilation, getCurrentLambda, getEndColumn, getEndLine, getExitValue, getFileName, getLanguage, getLineNumber, getMessages, getPublicId, getStartColumn, getStartLine, getSystemId, isStableSourceLocation, noteError, setColumn, setContext, setFile, setLine, setLine, visit, visit, visitAndUpdate, visitBeginExp, visitDeclarationType, visitDeclarationTypes, visitDefaultArgs, visitExpression, visitExps, visitExps, visitFluidLetExp, visitLangExp, visitLetExp, visitModuleExp, visitObjectExp, visitQuoteExp, visitScopeExp, visitSetExp, visitSynchronizedExp, visitThisExp
public static void pushApply(Expression exp, Compilation comp)
protected Expression update(Expression exp, Expression r)
update
in class ExpVisitor<Expression,java.lang.Void>
protected Expression defaultValue(Expression r, java.lang.Void ignored)
defaultValue
in class ExpVisitor<Expression,java.lang.Void>
protected Expression visitApplyExp(ApplyExp exp, java.lang.Void ignored)
visitApplyExp
in class ExpVisitor<Expression,java.lang.Void>
protected Expression visitIfExp(IfExp exp, java.lang.Void ignored)
visitIfExp
in class ExpVisitor<Expression,java.lang.Void>
protected Expression visitCaseExp(CaseExp exp, java.lang.Void ignored)
visitCaseExp
in class ExpVisitor<Expression,java.lang.Void>
protected Expression visitTryExp(TryExp exp, java.lang.Void ignored)
visitTryExp
in class ExpVisitor<Expression,java.lang.Void>
protected Expression visitBlockExp(BlockExp exp, java.lang.Void ignored)
visitBlockExp
in class ExpVisitor<Expression,java.lang.Void>
protected Expression visitExitExp(ExitExp exp, java.lang.Void ignored)
visitExitExp
in class ExpVisitor<Expression,java.lang.Void>
protected Expression visitReferenceExp(ReferenceExp exp, java.lang.Void ignored)
visitReferenceExp
in class ExpVisitor<Expression,java.lang.Void>
protected Expression visitClassExp(ClassExp exp, java.lang.Void ignored)
visitClassExp
in class ExpVisitor<Expression,java.lang.Void>
protected Expression visitLambdaExp(LambdaExp exp, java.lang.Void ignored)
visitLambdaExp
in class ExpVisitor<Expression,java.lang.Void>
public void forkPush()
public void forkNext()
public void forkPop()