IterDescriptor

public final class IterDescriptor

Represents an iteration of a given “length”, i.e. from “init” to “init+length-1”. Holds the decision whether to implement this iteration with a do-loop or an array notation.

Fields

allSubArrayAccesses

public boolean allSubArrayAccesses

True if all uses of this iteration are in subArray mode, i.e. start from an array element and continue with stride one. In this case, we can use the classical Fortran pseudo-pointer trick that calls F(T(i)) for a function declared F(T(:)).

defaultUse

public Tree defaultUse

indexHolder

public NewSymbolHolder indexHolder

If the iteration is implemented with a do-loop, NewSymbolHolder of the loop index.

indexTree

public Tree indexTree

isArray

public boolean isArray

True if this iteration will not be implemented with a DO loop.

isImplicitCompleteDimension

public boolean isImplicitCompleteDimension

true iff this iteration ranges completely over a dimension and can therefore be replaced by an implicit “:”.

lengthTree

public Tree lengthTree

length of the iteration, i.e. number of successive values.

Constructors

IterDescriptor

public IterDescriptor(int depth, SymbolTable symbolTable, SymbolTable fwdSymbolTable, Tree initIndex, Tree hintRefTree, String hintArrayNameInText, String hintArrayNameInIdent, Tree hintTreeSize, int hintDim, int hintNDims)

Plain creation. Creates the NewSymbolHolder for the loop index, and register it at the enclosing local SymbolTable level.

IterDescriptor

public IterDescriptor(int depth, SymbolTable symbolTable, Tree initIndex, Tree hintRefTree, String hintArrayNameInText, Tree hintArrayNameInIdentTree, Tree hintTreeSize, int hintDim, int hintNDims)

Plain creation. Creates the NewSymbolHolder for the loop index, and register it at the enclosing local SymbolTable level.

IterDescriptor

public IterDescriptor(Tree doTree)

Alternative creation. Creates the IterDescriptor for an enclosing “do” iterator. This implies that the loop index name is given and need not be created.

IterDescriptor

public IterDescriptor(NewSymbolHolder dirIndexSymbolHolder)

Alternative creation. Creates the IterDescriptor for the “multiDir” dimension.

Methods

buildDoHeaderTree

public Tree buildDoHeaderTree(SymbolTable usageSymboltable, Unit targetUnit, boolean directOrder)

buildIndexTree

public Tree buildIndexTree(SymbolTable usageSymboltable, Unit targetUnit)
Returns

an index tree that will range over this iteration space. Will be an index identifier or an arrayTriplet according to the choice or array notation made in “isArray”.

getInitTree

public Tree getInitTree()

getLengthTree

public Tree getLengthTree()

justAnIndex

public boolean justAnIndex()

preciseDefaultLengthTree

public void preciseDefaultLengthTree(Unit targetUnit, SymbolTable symbolTable)

preciseLengthTree

public void preciseLengthTree(Tree lengthTree)

Tries to keep (TODO!) the simplest possible lengthTree, between the given “lengthTree” and the previously kept “this.lengthTree”

setHintArrayTreeForCallSize

public void setHintArrayTreeForCallSize(Tree tree)

setInitTree

public void setInitTree(Tree initTree)

setJustAnIndex

public void setJustAnIndex(boolean value)

setLengthTree

public void setLengthTree(Tree lengthTree)

toString

public String toString()