PrimitiveTypeSpec

public final class PrimitiveTypeSpec extends TypeSpec

A primitive type.

Constructors

PrimitiveTypeSpec

public PrimitiveTypeSpec(String name)

Creates a new primitive type with the given “name”.

Methods

acceptsMultiDirDimension

public boolean acceptsMultiDirDimension()

addWith

protected TypeSpec addWith(WrapperTypeSpec type)

Composition rules for PrimitiveTypeSpec:

We start from the following definitions:
?INTEGER == INTEGER or REAL or COMPLEX
?REAL    == REAL or COMPLEX
?COMPLEX == COMPLEX (therefore ?COMPLEX is useless)
Composition rules are symmetric,
but for implementation, we make them assymetric
to keep/return the left type ("this") whenever possible.
([llh] Not sure this is a good choice. Maybe the result
should share with neither left nor right type?)

[code 0] is for other primitive types (Strings, Fortran Logicals, etc...)
[code 1]  INTEGER addWith  INTEGER =>  INTEGER
[code 1]  INTEGER addWith ?INTEGER => ?INTEGER
[code 1]  INTEGER addWith  REAL    =>  REAL
[code 1]  INTEGER addWith ?REAL    => ?REAL
[code 1]  INTEGER addWith  COMPLEX =>  COMPLEX
[code 2] ?INTEGER addWith ?INTEGER => ?INTEGER
[code 2] ?INTEGER addWith  REAL    => ?REAL
[code 2] ?INTEGER addWith ?REAL    => ?REAL
[code 2] ?INTEGER addWith  COMPLEX =>  COMPLEX
[code 3]  REAL    addWith  REAL    =>  REAL
[code 3]  REAL    addWith ?REAL    => ?REAL
[code 3]  REAL    addWith  COMPLEX =>  COMPLEX
[code 4] ?REAL    addWith ?REAL    => ?REAL
[code 4] ?REAL    addWith  COMPLEX =>  COMPLEX
[code 5]  COMPLEX addWith  COMPLEX =>  COMPLEX

baseTypeName

protected String baseTypeName()

buildConstantOne

public Tree buildConstantOne()

buildConstantZero

public Tree buildConstantZero()

buildRealConstantZero

public static Tree buildRealConstantZero()
Returns

a Tree that is a good enough zero in the given environment.

cloneAsUndefinedNumeric

protected TypeSpec cloneAsUndefinedNumeric(boolean undefined)

computeSize

protected int computeSize()

double:8 float:4 long:8 int:4 short:2 byte:1 char:2 boolean:4 reference:4.

copy

public TypeSpec copy()
Returns

a copy of this type.

copyStopOnComposite

public TypeSpec copyStopOnComposite(Unit publishedUnit)

differentiateTypeSpec

public WrapperTypeSpec differentiateTypeSpec(SymbolTable symbolTable, SymbolTable srcSymbolTable, int diffUnitSort, String fSuffix, boolean localDecl, boolean multiDirMode, ArrayDim multiDirDimensionMax, String hintArrayNameInText, String hintArrayNameInIdent, Tree hintArrayNameTree, Tree nameTree)

dump

public void dump()

generateTree

public Tree generateTree(SymbolTable symbolTable, TapList<SymbolDecl> dependsOn, TapList<SymbolDecl> shortNames, boolean useShortNames, TapList<TypeSpec> dejaVu)

intToReal

public TypeSpec intToReal(TapList<TapPair<TypeSpec, TypeSpec>> dejaVu, SymbolTable symbolTable)

isAugmentedDouble

public boolean isAugmentedDouble()
Returns

True if this type is the augmented type for overloading-based AD.

isCharacter

public boolean isCharacter()

isComplex

public boolean isComplex()
Returns

True if this type is “complex”.

isDifferentiated

public boolean isDifferentiated(TapList<TypeSpec> dejaVu)

isInteger

public boolean isInteger()
Returns

True if this type is “integer”.

isProbablyRealOrComplex

public boolean isProbablyRealOrComplex()
Returns

True if this type, possibly yet undefined, can/will be either “float” or “complex”.

isReal

public boolean isReal()
Returns

True if this type is “float”.

isRealOrComplex

public boolean isRealOrComplex()
Returns

True if this type is either “float” or “complex”.

isUndefinedNumeric

protected boolean isUndefinedNumeric()

localize

protected TypeSpec localize(TapList<TapTriplet<TypeSpec, TypeSpec, Boolean>> toAlreadyCopied, ToBool containsMeta)

name

public String name()

The name of this primitive type.

needsADiffType

public boolean needsADiffType(TapList<TypeSpec> dejaVu)

precisionSize

public int precisionSize()

realToComplex

protected TypeSpec realToComplex(TapList<TapPair<TypeSpec, TypeSpec>> dejaVu, WrapperTypeSpec complexTypeSpec)

setPrimitiveTypeSize

protected void setPrimitiveTypeSize(int primitiveTypeSize)

The size in bytes of this primitive type.

setUndefinedNumeric

protected void setUndefinedNumeric(boolean value)

showType

public String showType()

testComparesWith

protected boolean testComparesWith(TypeSpec other, int comparison, TypeSpec toThis, TypeSpec toOther, TapList<TapPair<TypeSpec, TypeSpec>> dejaVu)

toString

public String toString()

weakenForInference

protected TypeSpec weakenForInference(int comparison)