FunctionDecl

public final class FunctionDecl extends SymbolDecl

The specific SymbolTable entry for a function definition.

Fields

declarator

public Tree declarator

C external declaration.

definitionSymbolTable

public SymbolTable definitionSymbolTable

symbolTable containing the principal FunctionDecl of this function. null corresponds to the rootSymbolTable.

formalArgRank

public int formalArgRank

for a formal parameter, its rank in the parameters list. From 1 up (special 0 for result).

initFunctionDecls

public FunctionDecl[] initFunctionDecls

When this is a “pointer-to-function” variable, holding a pointer to a function, holds the function it is given upon initialization.

Constructors

FunctionDecl

public FunctionDecl()

FunctionDecl

public FunctionDecl(Tree identTree, Unit unit)

FunctionDecl

public FunctionDecl(Tree identTree, Unit unit, SymbolTable symbolTable)

FunctionDecl

public FunctionDecl(Tree identTree, Unit unit, SymbolTable symbolTable, String className)

Methods

accumulateZones

public void accumulateZones(TapList intTree)

argumentsTypesSpec

public WrapperTypeSpec[] argumentsTypesSpec()

declarationMatchesCall

public boolean declarationMatchesCall(TypeSpec callResultType, TypeSpec[] callArgTypes)
Returns

true if this declaration of a function matches (i.e. can be called with) the types of the given actual arguments callArgTypes (and optionally matches the expected type of the result callResultType, although we are not sure it is reasonable to type-check on the result type?).

deleteUnitIfDifferent

public void deleteUnitIfDifferent(Unit otherUnit, CallGraph callGraph)

eraseDiffSymbolHolder

protected void eraseDiffSymbolHolder(int diffSort)

formalArgRankOrResultZero

public int formalArgRankOrResultZero()

functionTypeSpec

public FunctionTypeSpec functionTypeSpec()

getDiffSymbolHolder

public NewSymbolHolder getDiffSymbolHolder(int diffSort, ActivityPattern pattern, int replica)
Returns

the NewSymbolHolder that has been stored by setDiffSymbolHolder() as the differentiated symbol of this SymbolDecl, for the given diffSort and for the given pattern.

hasDiffSymbolHolders

public boolean hasDiffSymbolHolders()

isElemental

public boolean isElemental()

isExternal

public boolean isExternal()

isInterface

public boolean isInterface()

isIntrinsic

public boolean isIntrinsic()

isIntrinsicNotElemental

public boolean isIntrinsicNotElemental()

isModule

public boolean isModule()

isRenamed

public boolean isRenamed()

isStandard

public boolean isStandard()

isTarget

public boolean isTarget(WrapperTypeSpec modelTypeSpec)

isVarFunction

public boolean isVarFunction()

replaceDiffSymbolHolder

protected void replaceDiffSymbolHolder(NewSymbolHolder oldNSH, NewSymbolHolder newNSH)

For every NewSymbolHolder that is stored in this SymbolDecl (in provision of the moment when this Symboldecl will receive its finalname), replace it with newNSH if it was oldNSH. This is used when oldNSH is absorbed by newNSH.

returnTypeSpec

public WrapperTypeSpec returnTypeSpec()

sameTypes

public boolean sameTypes(WrapperTypeSpec otherReturnType, WrapperTypeSpec[] otherArgumentsTypes)

setDiffSymbolHolder

public void setDiffSymbolHolder(int diffSort, ActivityPattern pattern, int replica, NewSymbolHolder nSH)

Puts the NewSymbolHolder “nSH” as the differentiated symbol of this FunctionDecl, for the given diffSort and for the given ActivityPattern. “diffSort” is here because there may be different coexisting derivative symbols for a given original symbol, for example F_FWD, F_BWD, F_B for a given function F. “pattern” is used here only for functions, that may have several different coexisting derivatives, one per calling ActivityPattern. “replica” is not used, it is only for VariableDecl’s.

setUnit

public void setUnit(Unit unit)

Set the Unit declared by this FunctionDecl.

setZones

public void setZones(TapList intTree)

shareUnitFrom

public void shareUnitFrom(FunctionDecl otherFunctionDecl)

Really share the hat-to-Unit that comes from otherFunctionDecl.

toString

public String toString()

type

public WrapperTypeSpec type()

unit

public Unit unit()
Returns

the Unit declared by this FunctionDecl.

zones

public TapList zones()