public class CodeGenAnalyzer
extends java.lang.Object
Pass 1: AS2CGAnalysisVisitor
Each AS Element is converted to a CGElement
This conversion creates objects such as CGLibraryOperationCallEXp that are more atuned to CG
and provides a tree that can be rewritten by optimizations.
Pass 2: CGPreAnalysisVisitor
Traversal of the CG containment tree performs
constant folding
Pass N-2: CG2JavaPreVisitor
Traversal of the CG containment tree prepares for Java CG by
gathering imports
Pass N-1: CommonSubexpressionEliminator
Traversal of the CG tree to share common terms and remove dead code
Pass N: CG2JavaVisitor
Traversal of the CG containment tree emits code
Modifier and Type | Field and Description |
---|---|
protected CGBoolean |
cgFalse |
protected CGNull |
cgNull |
protected CGBoolean |
cgTrue |
protected CodeGenerator |
codeGenerator |
protected NameManager |
nameManager |
Constructor and Description |
---|
CodeGenAnalyzer(CodeGenerator codeGenerator) |
@NonNull protected final CodeGenerator codeGenerator
@NonNull protected final NameManager nameManager
@NonNull protected final CGBoolean cgFalse
@NonNull protected final CGBoolean cgTrue
@NonNull protected final CGNull cgNull
public CodeGenAnalyzer(@NonNull CodeGenerator codeGenerator)
public void analyze(@NonNull CGElement cgRoot)
@NonNull public CGValuedElement createCGConstantExp(@NonNull CGConstant cgConstant)
@NonNull public CGConstantExp createCGConstantExp(@NonNull OCLExpression element, @NonNull CGConstant cgConstant)
@NonNull protected CGBoolean createCGBoolean(boolean booleanValue)
@NonNull protected CGNull createCGNull()
@NonNull public CGExecutorOperation createExecutorOperation(@NonNull Operation asOperation)
@NonNull public CGExecutorProperty createExecutorOppositeProperty(@NonNull Property asProperty)
@NonNull public CGExecutorProperty createExecutorProperty(@NonNull Property asProperty)
@NonNull public CGExecutorShadowPart createExecutorShadowPart(@NonNull Property asProperty)
@NonNull public CGExecutorType createExecutorType(@NonNull Type asType)
@NonNull public CGBoolean getBoolean(boolean aBoolean)
@NonNull public CodeGenerator getCodeGenerator()
@NonNull public CGElementId getElementId(@NonNull ElementId elementId)
@NonNull public CGValuedElement getExpression(@Nullable CGValuedElement cgExpression)
@NonNull public CGInteger getInteger(@NonNull java.lang.Number aNumber)
@NonNull public CGInvalid getInvalid()
@NonNull public CGInvalid getInvalid(java.lang.String messageTemplate, java.lang.Object... bindings)
@NonNull public CGNull getNull()
@NonNull public CGReal getReal(@NonNull java.lang.Number aNumber)
@NonNull public CGString getString(@NonNull java.lang.String aString)
@NonNull public NameManager getNameManager()
@NonNull public CGUnlimited getUnlimited()
@NonNull public CGValuedElement replace(@NonNull CGValuedElement oldElement, @NonNull CGValuedElement newElement, java.lang.String messageTemplate, java.lang.Object... bindings)
public void setConstant(@NonNull CGValuedElement oldElement, @NonNull CGValuedElement aConstant)
public void setExplicitNames(@NonNull CGValuedElement cgValue, @Nullable java.lang.Object anObject)
public void setNames(@NonNull CGValuedElement cgValue, @NonNull java.lang.Object anObject)