coins.ir.hir
Class SubsPtrTransformation

java.lang.Object
  extended bycoins.ir.hir.SubsPtrTransformation

public class SubsPtrTransformation
extends java.lang.Object

SubsPtrTransformation Array subscript (Subs) expression to pointer expression transformation and vice versa.


Field Summary
protected  int fDbgLevel
           
(package private)  HirRoot hirRoot
           
(package private)  IoRoot ioRoot
           
(package private)  SymRoot symRoot
           
 
Constructor Summary
SubsPtrTransformation(HirRoot pHirRoot)
          Constructor to prepare for transformation
 
Method Summary
 java.util.ArrayList listUpPtrNodes(HIR pHir)
          listUpPtrNodes
 java.util.ArrayList listUpSubsNodes(HIR pHir)
          listUpSubsNodes Make an array-list of Subs nodes in pHir in the order of pre-visiting depth-first order.
 boolean ptrToSubsTransformation(HIR pHir, java.util.Map pPtrSubsCorrespondence)
          ptrToSubsTrasnsformation Transform pointer expression in pHir to subscript expression if the pointer expression is recorded in pPtrSubsCorrespondence or it is an expression representing simple subscripted expression.
 boolean subsToPtrTrasnsformation(HIR pHir, java.util.Map pPtrSubsCorrespondence)
          subsToPtrTrasnsformation Transform subscripted expression in pHir to pointer expression and record its correspondence to pPtrSubsCorrespondence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ioRoot

IoRoot ioRoot

hirRoot

HirRoot hirRoot

symRoot

SymRoot symRoot

fDbgLevel

protected final int fDbgLevel
Constructor Detail

SubsPtrTransformation

public SubsPtrTransformation(HirRoot pHirRoot)
Constructor to prepare for transformation

Parameters:
pHirRoot - HirRoot instance to be recorded.
Method Detail

listUpSubsNodes

public java.util.ArrayList listUpSubsNodes(HIR pHir)
listUpSubsNodes Make an array-list of Subs nodes in pHir in the order of pre-visiting depth-first order.

Parameters:
pHir - the subtree to be searched (usually HIR-body of subprogram).
Returns:
the array-list of Subs nodes.

subsToPtrTrasnsformation

public boolean subsToPtrTrasnsformation(HIR pHir,
                                        java.util.Map pPtrSubsCorrespondence)
subsToPtrTrasnsformation Transform subscripted expression in pHir to pointer expression and record its correspondence to pPtrSubsCorrespondence.

Parameters:
pHir - HIR subtree to be transformed.
pPtrSubsCorrespondence - record the Subs-Ptr correspondence.
Returns:
true if some expression is transformed, false if no expression is transformed.

ptrToSubsTransformation

public boolean ptrToSubsTransformation(HIR pHir,
                                       java.util.Map pPtrSubsCorrespondence)
ptrToSubsTrasnsformation Transform pointer expression in pHir to subscript expression if the pointer expression is recorded in pPtrSubsCorrespondence or it is an expression representing simple subscripted expression.

Parameters:
pHir - HIR subtree to be transformed.
pPtrSubsCorrespondence - show the Subs-Ptr correspondence.
Returns:
true if some expression is transformed, false if no expression is transformed.

listUpPtrNodes

public java.util.ArrayList listUpPtrNodes(HIR pHir)
listUpPtrNodes
 Make an array-list of  pointer expressions taking the form
   (contents
    (add
     (decay
      )
     (exp ) ) )
  in pHir in the order of
 pre-visiting depth-first order.

Parameters:
pHir - the subtree to be searched (usually HIR-body of subprogram).
Returns:
the array-list of contents-nodes.