CoDiPack  3.1.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
codi::LifetimeManager< T_Identifier, T_Lifetime > Struct Template Reference

Helper class for the lifetime management of the identifiers. More...

#include <identifierCacheOptimizer.hpp>

Inheritance diagram for codi::LifetimeManager< T_Identifier, T_Lifetime >:

Public Member Functions

 inlineLifetimeManager (Identifier invalidId)
 Constructor.
 
Functions for the translation phase. Lifetimes can only be read.
inlinebool isLLFStatement (Lifetime const &stmtId)
 Check if the statement has just one output.
 
inlinevoid prepareStatementRead (Lifetime const &stmtId)
 Call before lifetimes are read for a statement.
 
inlineLifetime getLifetime (Lifetime const &stmtId, Identifier const &outputId)
 Get the lifetime of an output of the statement. prepareStatementRead needs to be called first.
 
Functions for the lifetime analysis of the statement outputs.
inlinevoid setLifetime (Lifetime const &stmtId, Identifier const &outputId, Lifetime const &lifetime)
 Set the lifetime for an output of a statement. The statement should already be finalized.
 
inlinevoid addOutputToStatement (Identifier const &id)
 Add an output to the current statement.
 
inlinevoid finalizeStatement ()
 

Detailed Description

template<typename T_Identifier, typename T_Lifetime = int>
struct codi::LifetimeManager< T_Identifier, T_Lifetime >

Helper class for the lifetime management of the identifiers.

For each statement the lifetime of the output identifier is stored. Since low level functions or primal value tapes can have multiple outputs, an extra list is created for each tape entry that has more than one output. These can be looked up by statement id and the output id.

Template Parameters
T_IdentifierThe identifier of the CoDiPack type.
T_LifetimeThe lifetime type. For large tapes this needs to be increased. Signed type required since negative values are used for statements with multiple outputs.

Member Function Documentation

◆ finalizeStatement()

template<typename T_Identifier, typename T_Lifetime = int>
inlinevoid codi::LifetimeManager< T_Identifier, T_Lifetime >::finalizeStatement ( )
inline

Finalize the current statement. Sorts the list of output ids for the statement if it has more than one.


The documentation for this struct was generated from the following file: