org.eclipse.ocl.examples.codegen.cse
Class GlobalPlace

java.lang.Object
  extended by org.eclipse.ocl.examples.codegen.cse.AbstractPlace
      extended by org.eclipse.ocl.examples.codegen.cse.GlobalPlace

public class GlobalPlace
extends AbstractPlace

The GlobalPlace describes a forest of CG trees that can be resolved as global constants.


Field Summary
protected  CodeGenAnalyzer analyzer
           
protected  HashedAnalyses globalAnalyses
           
protected  ReferencesVisitor referencesVisitor
           
 
Constructor Summary
GlobalPlace(CodeGenAnalyzer analyzer)
           
 
Method Summary
 void addSimpleAnalysis(SimpleAnalysis simpleAnalysis)
           
protected  SimpleAnalysis buildSimpleAnalysisTree(CGElement cgElement, int depth)
          Populate the map from structural hash code to same-hashed analysis in the analysis tree rooted at thisAnalysis.
static AbstractPlace createGlobalPlace(java.util.Map<CGElement,AbstractPlace> element2place, CGElement cgElement)
           
 CodeGenAnalyzer getAnalyzer()
           
 ControlPlace getControlPlace(CGValuedElement cgElement)
           
 GlobalPlace getGlobalPlace()
          Return the GlobalPlace.
 GlobalPlace getParentPlace()
          Return the parent of this place, which is self for the GlobalPlace.
 AbstractPlace getPlace(CGElement cgElement)
           
 ReferencesVisitor getReferencesVisitor()
           
 SimpleAnalysis getSimpleAnalysis(java.lang.Object anObject)
           
 java.util.List<CGValuedElement> getSortedGlobals(DependencyVisitor dependencyVisitor)
           
 StackPlace getStackPlace()
          Return the stack place hosting this place.
protected  int getStructuralHashCode(CGElement cgElement, java.lang.String prefix)
           
 void optimize(CGElement cgRoot)
          Optimize the cgRoot tree by eliminating common subexpressions.
 void optimizeGlobals(CGElement cgRoot)
           
 void printHierarchy(java.lang.Appendable appendable, java.lang.String indentation)
           
 java.lang.String toString()
           
 
Methods inherited from class org.eclipse.ocl.examples.codegen.cse.AbstractPlace
getControlPlace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

analyzer

@NonNull
protected final CodeGenAnalyzer analyzer

referencesVisitor

@NonNull
protected final ReferencesVisitor referencesVisitor

globalAnalyses

@NonNull
protected final HashedAnalyses globalAnalyses
Constructor Detail

GlobalPlace

public GlobalPlace(@NonNull
                   CodeGenAnalyzer analyzer)
Method Detail

createGlobalPlace

@NonNull
public static AbstractPlace createGlobalPlace(@NonNull
                                                      java.util.Map<CGElement,AbstractPlace> element2place,
                                                      @NonNull
                                                      CGElement cgElement)

addSimpleAnalysis

public void addSimpleAnalysis(@NonNull
                              SimpleAnalysis simpleAnalysis)

buildSimpleAnalysisTree

@Nullable
protected SimpleAnalysis buildSimpleAnalysisTree(@NonNull
                                                          CGElement cgElement,
                                                          int depth)
Populate the map from structural hash code to same-hashed analysis in the analysis tree rooted at thisAnalysis.

Returns the SimpleAnalysis of cgElement.


getAnalyzer

@NonNull
public CodeGenAnalyzer getAnalyzer()

getControlPlace

@NonNull
public ControlPlace getControlPlace(@NonNull
                                            CGValuedElement cgElement)

getGlobalPlace

@NonNull
public GlobalPlace getGlobalPlace()
Description copied from class: AbstractPlace
Return the GlobalPlace.

Specified by:
getGlobalPlace in class AbstractPlace

getParentPlace

@NonNull
public GlobalPlace getParentPlace()
Description copied from class: AbstractPlace
Return the parent of this place, which is self for the GlobalPlace.

Specified by:
getParentPlace in class AbstractPlace

getPlace

@Nullable
public AbstractPlace getPlace(@NonNull
                                       CGElement cgElement)

getReferencesVisitor

@NonNull
public ReferencesVisitor getReferencesVisitor()

getSimpleAnalysis

@Nullable
public SimpleAnalysis getSimpleAnalysis(@NonNull
                                                 java.lang.Object anObject)

getSortedGlobals

@Nullable
public java.util.List<CGValuedElement> getSortedGlobals(@NonNull
                                                                 DependencyVisitor dependencyVisitor)

getStackPlace

@Nullable
public StackPlace getStackPlace()
Description copied from class: AbstractPlace
Return the stack place hosting this place. Returns for the GlobalPlace..

Specified by:
getStackPlace in class AbstractPlace

getStructuralHashCode

protected int getStructuralHashCode(@NonNull
                                    CGElement cgElement,
                                    @NonNull
                                    java.lang.String prefix)

optimize

public void optimize(@NonNull
                     CGElement cgRoot)
Optimize the cgRoot tree by eliminating common subexpressions.

Parameters:
globals -

optimizeGlobals

public void optimizeGlobals(@NonNull
                            CGElement cgRoot)

printHierarchy

public void printHierarchy(@NonNull
                           java.lang.Appendable appendable,
                           @NonNull
                           java.lang.String indentation)
Specified by:
printHierarchy in class AbstractPlace

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object