ANTAREX API

Clava API

LARA API

LARA Common Language API

Global Functions

GenCode_CPP_Memoization

GenCode_CPP_Memoization(className:, methName:, typeName:, nbparams:, fileToLoad:, FullOffLine:, FileToSave:, updateTableOnCollision:, precision:, tsize:, className, methName, typeName, nbparams, fileToLoad, fulloffline, FileToSave, updateTableOnCollision, approx, tsize)

Generates a DEF entry in the FILENAME_MEMOI_DEFS file for a C++ method, and declares the exposed variables.
Such a definition will be used for the generation of the memoization library.

Parameters

className:: string - the name of the class.
methName:: string - the name of the method to memoize.
typeName:: string - the type of the argument (equal to the type of the returned value).
nbparams:: int - the number of arguments of the function (input argument).
fileToLoad:: string - the name of the file to load to initialse the internal table, or none.
FullOffLine:: string - yes or no. yes implies a full off lime memoization (requires a fileToLoad).
FileToSave:: string - the name of the file to save the data of the table, or none.
updateTableOnCollision:: string - yes or no. yes implis that in case of collisions, the table is updated.
precision:: int - the number of bit to delete (float/double) for internal approximation, 0 for int.
tsize:: int - the size of the table.
className: any
methName: any
typeName: any
nbparams: any
fileToLoad: any
fulloffline: any
FileToSave: any
updateTableOnCollision: any
approx: any
tsize: any

GenCode_C_Memoization

GenCode_C_Memoization(functionName:, typeName:, nbparams:, fileToLoad:, FullOffLine:, FileToSave:, updateTableOnCollision:, precision:, tsize:, functionName, typeName, nbparams, fileToLoad, FullOffLine, FileToSave, updateTableOnCollision, approx, tsize)

Generates a DEF entry in the FILENAME_MEMOI_DEFS file for a C function, and declares the exposed variables.
Such a definition will be used for the generation of the memoization library.

Parameters

functionName:: string - the name of the function to memoize.
typeName:: string - the type of the argument (equal to the type of the returned value).
nbparams:: int - the number of arguments of the function (input argument).
fileToLoad:: string - the name of the file to load to initialse the internal table, or none.
FullOffLine:: string - yes or no. yes implies a full off lime memoization (requires a fileToLoad).
FileToSave:: string - the name of the file to save the data of the table, or none.
updateTableOnCollision:: string - yes or no. yes implis that in case of collisions, the table is updated.
precision:: int - the number of bit to delete (float/double) for internal approximation, 0 for int.
tsize:: int - the size of the table.
functionName: any
typeName: any
nbparams: any
fileToLoad: any
FullOffLine: any
FileToSave: any
updateTableOnCollision: any
approx: any
tsize: any

checkHeaderMemoizable

checkHeaderMemoizable($fm)

Testing if the header of a function or method ($fm) satisfies the conditions for the memoization.

Parameters

$fm: any

Returns

any - the number of parameters of $fm, or -1 if it is not memoizable.

checkHeaderMemoizableFunction

checkHeaderMemoizableFunction($function)

Testing if the header of a function satisfies the conditions for the memoization:
- the number of arguments is in the interval [1,3]
- all the arguments ans the returned value have the same
type restricted to the types tested in getMemoType().

Parameters

$function: any

Returns

any - the number of parameters or -1 if the C function is not memoizable,

checkHeaderMemoizableMethod

checkHeaderMemoizableMethod($method)

Testing if the header of a method ($method) satisfies the conditions for the memoization:
- the number of arguments is in the interval [1,3]
- all the arguments ans the returned value have the same
type restricted to the types tested in getMemoType().

Parameters

$method: any

Returns

any - the number of parameters or -1 if the C function is not memoizable,

genCodeWrapperHeader

genCodeWrapperHeader(vdecl)

Generates the declaration of the wrapper header in the FILENAME_MEMOI_WRAPPERS file.

Example: __EXTERN__ double log_wrapper(double);
The symbol __EXTERN__ is used to solve the compiling problem (C code compiled with or not a C++ compiler).

Parameters

vdecl: any

genExposedVariables

genExposedVariables(vfile., ExposedVariables., vfile, ExposedVariables)

Parameters

vfile.: jointpoint $file
ExposedVariables.: array of string - It generates in the file (vfile) the exposed variables of ExposedVariables. The variables that can be modified at run time (margot or other tool).
vfile: any
ExposedVariables: any

genExternSpec

genExternSpec(vfile)

This function adds the declaration of the predefined __EXTERN__ keyword used
to specify external C function with a C++ compiler.

Parameters

vfile: any

getDeclParameters

getDeclParameters(vtype, nbparams)

Parameters

vtype: any
nbparams: any

Returns

any - the string composed of nbparams times vtype separated by a comma.

getFuncWrapperName

getFuncWrapperName(func)

Parameters

func: any

Returns

any - the name of the wrapper of func.

getKindMathFunc

getKindMathFunc(aFunc)

Parameters

aFunc: string - the name of the math function.

Returns

any - the code of the definition to add in the "funs-static.def" file for a math function, or 'none' if aFunc is not a memoizable math function.

getMangledInfos

getMangledInfos(className, fmName, typeName, nbparams)

Parameters

className: any
fmName: any
typeName: any
nbparams: any

Returns

any - an array (T) of 2 strings - T[0] contains the mangled name of a function or method (fmName) - T[1] contains the informations of the associated wrapper function. To produce these mangled names, it uses the className( "" for a function), the name of the type (typeName) and the numbers of arguments (nbparams). The rules for the mangling are compiler dependent.

getManglingType

getManglingType(tt)

Parameters

tt: any

Returns

any - the code used for the mangling of a type (tt). Restricted to memoization type ( int, double, float).

getManglingTypeFor

getManglingTypeFor(typeName, nbparams)

Parameters

typeName: any
nbparams: any

Returns

any - the mangled name of a type (typeName) for a method with nbparams parameters of this type. Restricted to memoization type ( int, double, float).

getMemoType

getMemoType($vtype)

Parameters

$vtype: any

Returns

any - the string code of the type ($vtype) for - a predefined one, - a typedef built on a predefined one, - or a const type. or "NO" otherwise.

getWrapperDeclMathFunc

getWrapperDeclMathFunc(aFunc)

Parameters

aFunc: any

Returns

any - the code of the header for the wrapper math function(aFunc).

initFileMemoization

initFileMemoization()

Initializes the memoization by adding two files to Clava:
- One (FILENAME_MEMOI_DEFS) will contains the definitions used to produce the memoization library.
- The other one (FILENAME_EXPOSED_VARS) will contains the exposed variables.


initFileWrappers

initFileWrappers()

Initializes the wrapper file of the C memoized functions.


isTheSelectedMethod

isTheSelectedMethod($method, nbArgs, pType)

Parameters

$method: any
nbArgs: any
pType: any

Returns

any - "true" if a method ($method) has nbArgs parameters of type pType, "false" otherwise.